Loc32Util.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. using CliWrap;
  2. using CliWrap.Buffered;
  3. using Ips.Library.Basic;
  4. using Ips.Library.CliLib;
  5. using Ips.Library.Entity;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading;
  11. using System.Threading.Tasks;
  12. namespace Ips.LocAlgorithm
  13. {
  14. public class Loc32Util
  15. {
  16. static readonly string CliPath = Path.Combine(IpsPath.CliRootDir, "loc32", "loc32.exe");
  17. public static async Task<ExeResult<PosResult>> X3(
  18. double dtotar1,
  19. double dtotar2,
  20. double[] msant1,
  21. double[] nsant1,
  22. double[] msant2,
  23. double[] nsant2,
  24. double[] mseph1,
  25. double[] nseph1,
  26. double[] mseph2,
  27. double[] nseph2,
  28. int timeout = 60,
  29. CancellationToken token = default
  30. )
  31. {
  32. const string cmd = "x3";
  33. var cli = Cli.Wrap(CliPath)
  34. .WithArguments(args =>
  35. {
  36. args.Add(cmd);
  37. args.IpsAdd(nameof(dtotar1), dtotar1);
  38. args.IpsAdd(nameof(dtotar2), dtotar2);
  39. args.IpsAdd(nameof(msant1), msant1);
  40. args.IpsAdd(nameof(nsant1), nsant1);
  41. args.IpsAdd(nameof(msant2), msant2);
  42. args.IpsAdd(nameof(nsant2), nsant2);
  43. args.IpsAdd(nameof(mseph1), mseph1);
  44. args.IpsAdd(nameof(nseph1), nseph1);
  45. args.IpsAdd(nameof(mseph2), mseph2);
  46. args.IpsAdd(nameof(nseph2), nseph2);
  47. });
  48. var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
  49. var dwResult = PosResult.FromString(PosType.X3, false, res.StandardOutput);
  50. return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode, res.StandardError);
  51. }
  52. public static async Task<ExeResult<PosResult>> X3Ref(
  53. double dtotar1,
  54. double dtotar2,
  55. double dtoref1,
  56. double dtoref2,
  57. double[] refgeod1,
  58. double[] refgeod2,
  59. double[] msant1,
  60. double[] nsant1,
  61. double[] msant2,
  62. double[] nsant2,
  63. double[] mseph1,
  64. double[] nseph1,
  65. double[] mseph2,
  66. double[] nseph2,
  67. int timeout = 60,
  68. CancellationToken token = default
  69. )
  70. {
  71. const string cmd = "x3ref";
  72. var cli = Cli.Wrap(CliPath)
  73. .WithArguments(args =>
  74. {
  75. args.Add(cmd);
  76. args.IpsAdd(nameof(dtotar1), dtotar1);
  77. args.IpsAdd(nameof(dtotar2), dtotar2);
  78. args.IpsAdd(nameof(dtoref1), dtoref1);
  79. args.IpsAdd(nameof(dtoref2), dtoref2);
  80. args.IpsAdd(nameof(refgeod1), refgeod1);
  81. args.IpsAdd(nameof(refgeod2), refgeod2);
  82. args.IpsAdd(nameof(msant1), msant1);
  83. args.IpsAdd(nameof(nsant1), nsant1);
  84. args.IpsAdd(nameof(msant2), msant2);
  85. args.IpsAdd(nameof(nsant2), nsant2);
  86. args.IpsAdd(nameof(mseph1), mseph1);
  87. args.IpsAdd(nameof(nseph1), nseph1);
  88. args.IpsAdd(nameof(mseph2), mseph2);
  89. args.IpsAdd(nameof(nseph2), nseph2);
  90. });
  91. var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
  92. var dwResult = PosResult.FromString(PosType.X3Ref, true, res.StandardOutput);
  93. return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode, res.StandardError);
  94. }
  95. public static Task<ExeResult<PosResult>> X4(
  96. double dtotar1,
  97. double dtotar2,
  98. double dtotar3,
  99. double[] nsant1,
  100. double[] nsant2,
  101. double[] nsant3,
  102. double[] nseph1,
  103. double[] nseph2,
  104. double[] nseph3,
  105. int timeout = 60,
  106. CancellationToken token = default
  107. )
  108. {
  109. var dt1 = dtotar2 - dtotar1;
  110. var dt2 = dtotar3 - dtotar1;
  111. return X3(dt1, dt2, nsant1, nsant2, nsant1, nsant3, nseph1, nseph2, nseph1, nseph3, timeout, token);
  112. }
  113. public static Task<ExeResult<PosResult>> X4Ref(
  114. double dtotar1,
  115. double dtotar2,
  116. double dtotar3,
  117. double dtoref1,
  118. double dtoref2,
  119. double dtoref3,
  120. double[] refgeod,
  121. double[] nsant1,
  122. double[] nsant2,
  123. double[] nsant3,
  124. double[] nseph1,
  125. double[] nseph2,
  126. double[] nseph3,
  127. int timeout = 60,
  128. CancellationToken token = default
  129. )
  130. {
  131. var dt1 = dtotar2 - dtotar1;
  132. var dt2 = dtotar3 - dtotar1;
  133. var refdt1 = dtoref2 - dtoref1;
  134. var refdt2 = dtoref3 - dtoref1;
  135. return X3Ref(dt1, dt2, refdt1, refdt2, refgeod, refgeod, nsant1, nsant2, nsant1, nsant3, nseph1, nseph2, nseph1, nseph3, timeout, token);
  136. }
  137. public static async Task<ExeResult<List<GeoLine>>> DtoLineSx(double dtotar, double[] msant, double[] nsant, double[] mseph, double[] nseph, int timeout = 60, CancellationToken token = default)
  138. {
  139. const string cmd = "dtolinesx";
  140. var cli = Cli.Wrap(CliPath)
  141. .WithArguments(args =>
  142. {
  143. args.Add(cmd);
  144. args.IpsAdd(nameof(dtotar), dtotar);
  145. args.IpsAdd(nameof(msant), msant);
  146. args.IpsAdd(nameof(nsant), nsant);
  147. args.IpsAdd(nameof(mseph), mseph);
  148. args.IpsAdd(nameof(nseph), nseph);
  149. });
  150. var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
  151. var dwResult = GeoLine.FromListString(res.StandardOutput);
  152. return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
  153. }
  154. public static async Task<ExeResult<List<GeoLine>>> DtoLineSxRef(double dtotar, double dtoref, double[] refgeod, double[] mseph, double[] nseph, double[] msant, double[] nsaant, int timeout = 60, CancellationToken token = default)
  155. {
  156. const string cmd = "dtolinesxref";
  157. var cli = Cli.Wrap(CliPath)
  158. .WithArguments(args =>
  159. {
  160. args.Add(cmd);
  161. args.IpsAdd(nameof(dtotar), dtotar);
  162. args.IpsAdd(nameof(dtoref), dtoref);
  163. args.IpsAdd(nameof(refgeod), refgeod);
  164. args.IpsAdd(nameof(mseph), mseph);
  165. args.IpsAdd(nameof(nseph), nseph);
  166. });
  167. var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
  168. var dwResult = GeoLine.FromListString(res.StandardOutput);
  169. return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
  170. }
  171. public static async Task<ExeResult<List<GeoLine>>> DtoLineLoc(double[] pos, double[] msant, double[] nsant, double[] mseph, double[] nseph, int timeout = 60, CancellationToken token = default)
  172. {
  173. const string cmd = "dtolineloc";
  174. var cli = Cli.Wrap(CliPath)
  175. .WithArguments(args =>
  176. {
  177. args.Add(cmd);
  178. args.IpsAdd(nameof(pos), pos);
  179. args.IpsAdd(nameof(msant), msant);
  180. args.IpsAdd(nameof(nsant), nsant);
  181. args.IpsAdd(nameof(mseph), mseph);
  182. args.IpsAdd(nameof(nseph), nseph);
  183. });
  184. var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
  185. var dwResult = GeoLine.FromListString(res.StandardOutput);
  186. return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
  187. }
  188. public static async Task<ExeResult<PosResult>> X2Ref(
  189. double[] msant,
  190. double[] nsant,
  191. double[] refgeod,
  192. double tarfreq,
  193. double reffreq,
  194. double msturn,
  195. double nsturn,
  196. double dtotar,
  197. double dtoref,
  198. double dfotar,
  199. double dforef,
  200. double[] mseph,
  201. double[] nseph,
  202. int timeout = 60,
  203. CancellationToken token = default
  204. )
  205. {
  206. const string cmd = "x2ref";
  207. var cli = Cli.Wrap(CliPath)
  208. .WithArguments(args =>
  209. {
  210. args.Add(cmd);
  211. args.IpsAdd(nameof(msant), msant);
  212. args.IpsAdd(nameof(nsant), nsant);
  213. args.IpsAdd(nameof(refgeod), refgeod);
  214. args.IpsAdd(nameof(tarfreq), tarfreq);
  215. args.IpsAdd(nameof(reffreq), reffreq);
  216. args.IpsAdd(nameof(msturn), msturn);
  217. args.IpsAdd(nameof(nsturn), nsturn);
  218. args.IpsAdd(nameof(dtotar), dtotar);
  219. args.IpsAdd(nameof(dtoref), dtoref);
  220. args.IpsAdd(nameof(dfotar), dfotar);
  221. args.IpsAdd(nameof(dforef), dforef);
  222. args.IpsAdd(nameof(mseph), mseph);
  223. args.IpsAdd(nameof(nseph), nseph);
  224. });
  225. var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
  226. var dwResult = PosResult.FromString(PosType.X2Ref, true, res.StandardOutput);
  227. return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode, res.StandardError);
  228. }
  229. public static async Task<ExeResult<PosResult>> X3Df(
  230. double tarfreq,
  231. double reffreq,
  232. double msturn,
  233. double nsturn,
  234. double dfotar1,
  235. double dfotar2,
  236. double dforef1,
  237. double dforef2,
  238. double[] refgeod1,
  239. double[] refgeod2,
  240. double[] msant1,
  241. double[] nsant1,
  242. double[] msant2,
  243. double[] nsant2,
  244. double[] mseph1,
  245. double[] nseph1,
  246. double[] mseph2,
  247. double[] nseph2,
  248. int timeout = 60,
  249. CancellationToken token = default)
  250. {
  251. const string cmd = "x3df";
  252. var cli = Cli.Wrap(CliPath)
  253. .WithArguments(args =>
  254. {
  255. args.Add(cmd);
  256. args.IpsAdd(nameof(tarfreq), tarfreq);
  257. args.IpsAdd(nameof(reffreq), reffreq);
  258. args.IpsAdd(nameof(msturn), msturn);
  259. args.IpsAdd(nameof(nsturn), nsturn);
  260. args.IpsAdd(nameof(dfotar1), dfotar1);
  261. args.IpsAdd(nameof(dfotar2), dfotar2);
  262. args.IpsAdd(nameof(dforef1), dforef1);
  263. args.IpsAdd(nameof(dforef2), dforef2);
  264. args.IpsAdd(nameof(refgeod1), refgeod1);
  265. args.IpsAdd(nameof(refgeod2), refgeod2);
  266. args.IpsAdd(nameof(msant1), msant1);
  267. args.IpsAdd(nameof(nsant1), nsant1);
  268. args.IpsAdd(nameof(msant2), msant2);
  269. args.IpsAdd(nameof(nsant2), nsant2);
  270. args.IpsAdd(nameof(mseph1), mseph1);
  271. args.IpsAdd(nameof(nseph1), nseph1);
  272. args.IpsAdd(nameof(mseph2), mseph2);
  273. args.IpsAdd(nameof(nseph2), nseph2);
  274. });
  275. var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
  276. var dwResult = PosResult.FromString(PosType.X3Ref, true, res.StandardOutput);
  277. return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode, res.StandardError);
  278. }
  279. public static async Task<ExeResult<List<GeoLine>>> DtoLineLocRef(double[] pos, double[] refgeod, double[] mseph, double[] nseph, int timeout = 60, CancellationToken token = default)
  280. {
  281. const string cmd = "dtolinelocref";
  282. var cli = Cli.Wrap(CliPath)
  283. .WithArguments(args =>
  284. {
  285. args.Add(cmd);
  286. args.IpsAdd(nameof(pos), pos);
  287. args.IpsAdd(nameof(refgeod), refgeod);
  288. args.IpsAdd(nameof(mseph), mseph);
  289. args.IpsAdd(nameof(nseph), nseph);
  290. });
  291. var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
  292. var dwResult = GeoLine.FromListString(res.StandardOutput);
  293. return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
  294. }
  295. public static async Task<ExeResult<List<GeoLine>>> DtoLineYiDi(double dtotar, double[] mseph, double[] nseph, double[] msant, double[] nsant, int timeout = 60, CancellationToken token = default)
  296. {
  297. const string cmd = "dtolineyidi";
  298. var cli = Cli.Wrap(CliPath)
  299. .WithArguments(args =>
  300. {
  301. args.Add(cmd);
  302. args.IpsAdd(nameof(dtotar), dtotar);
  303. args.IpsAdd(nameof(mseph), mseph);
  304. args.IpsAdd(nameof(nseph), nseph);
  305. args.IpsAdd(nameof(msant), msant);
  306. args.IpsAdd(nameof(nsant), nsant);
  307. });
  308. var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
  309. var dwResult = GeoLine.FromListString(res.StandardOutput);
  310. return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
  311. }
  312. public static async Task<ExeResult<List<GeoLine>>> DfoLine(
  313. double[] msant,
  314. double[] nsant,
  315. double[] mseph,
  316. double[] nseph,
  317. double[] dfo,
  318. double frequp,
  319. double msturn,
  320. double nsturn,
  321. double? refdfo = null,
  322. double? reffrequp = null,
  323. double[] refgeod = null,
  324. double[] pos = null,
  325. int timeout = 60,
  326. CancellationToken token = default)
  327. {
  328. const string cmd = "dfoline";
  329. var cli = Cli.Wrap(CliPath)
  330. .WithArguments(args =>
  331. {
  332. args.Add(cmd);
  333. args.IpsAdd(nameof(msant), msant);
  334. args.IpsAdd(nameof(nsant), nsant);
  335. args.IpsAdd(nameof(mseph), mseph);
  336. args.IpsAdd(nameof(nseph), nseph);
  337. args.IpsAdd(nameof(dfo), dfo);
  338. args.IpsAdd(nameof(frequp), frequp);
  339. args.IpsAdd(nameof(msturn), msturn);
  340. args.IpsAdd(nameof(nsturn), nsturn);
  341. if (refdfo.HasValue)
  342. args.IpsAdd(nameof(refdfo), refdfo);
  343. if (reffrequp.HasValue)
  344. args.IpsAdd(nameof(reffrequp), reffrequp);
  345. if (refgeod != null && refgeod.Length > 1)
  346. args.IpsAdd(nameof(refgeod), refgeod);
  347. if (pos != null && pos.Length > 1)
  348. args.IpsAdd(nameof(pos), pos);
  349. });
  350. var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
  351. var dwResult = GeoLine.FromListString(res.StandardOutput);
  352. return ExeResult.Create(dwResult, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
  353. }
  354. public static async Task<ExeResult<GdopResult>> Gdop(double[] recgeod, double[] mseph1, double[] nseph1, double[] mseph2, double[] nseph2, int timeout = 60, CancellationToken token = default)
  355. {
  356. const string cmd = "gdop";
  357. var cli = Cli.Wrap(CliPath)
  358. .WithArguments(args =>
  359. {
  360. args.Add(cmd);
  361. args.IpsAdd(nameof(recgeod), recgeod);
  362. args.IpsAdd(nameof(mseph1), mseph1);
  363. args.IpsAdd(nameof(nseph1), nseph1);
  364. args.IpsAdd(nameof(mseph2), mseph2);
  365. args.IpsAdd(nameof(nseph2), nseph2);
  366. });
  367. var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
  368. var result = new GdopResult(res.StandardOutput);
  369. return ExeResult.Create(result, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
  370. }
  371. public static async Task<ExeResult<GdopResult>> GdopRef(double[] refgeod, double[] mseph1, double[] nseph1, double[] mseph2, double[] nseph2, int timeout = 60, CancellationToken token = default)
  372. {
  373. const string cmd = "gdopref";
  374. var cli = Cli.Wrap(CliPath)
  375. .WithArguments(args =>
  376. {
  377. args.Add(cmd);
  378. args.IpsAdd(nameof(refgeod), refgeod);
  379. args.IpsAdd(nameof(mseph1), mseph1);
  380. args.IpsAdd(nameof(nseph1), nseph1);
  381. args.IpsAdd(nameof(mseph2), mseph2);
  382. args.IpsAdd(nameof(nseph2), nseph2);
  383. });
  384. var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
  385. var result = new GdopResult(res.StandardOutput);
  386. return ExeResult.Create(result, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
  387. }
  388. public static async Task<ExeResult<LocErrResult>> LocErr(double[] pos, double[] recgeod, double[] mseph1, double[] nseph1, double[] mseph2, double[] nseph2, int timeout = 60, CancellationToken token = default)
  389. {
  390. const string cmd = "locerr";
  391. var cli = Cli.Wrap(CliPath)
  392. .WithArguments(args =>
  393. {
  394. args.Add(cmd);
  395. args.IpsAdd(nameof(pos), pos);
  396. args.IpsAdd(nameof(recgeod), recgeod);
  397. args.IpsAdd(nameof(mseph1), mseph1);
  398. args.IpsAdd(nameof(nseph1), nseph1);
  399. args.IpsAdd(nameof(mseph2), mseph2);
  400. args.IpsAdd(nameof(nseph2), nseph2);
  401. });
  402. var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
  403. var result = new LocErrResult(res.StandardOutput);
  404. return ExeResult.Create(result, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
  405. }
  406. public static async Task<ExeResult<LocErrResult>> LocErrRef(double[] pos, double[] refgeod, double[] mseph1, double[] nseph1, double[] mseph2, double[] nseph2, int timeout = 60, CancellationToken token = default)
  407. {
  408. const string cmd = "locerrref";
  409. var cli = Cli.Wrap(CliPath)
  410. .WithArguments(args =>
  411. {
  412. args.Add(cmd);
  413. args.IpsAdd(nameof(pos), pos);
  414. args.IpsAdd(nameof(refgeod), refgeod);
  415. args.IpsAdd(nameof(mseph1), mseph1);
  416. args.IpsAdd(nameof(nseph1), nseph1);
  417. args.IpsAdd(nameof(mseph2), mseph2);
  418. args.IpsAdd(nameof(nseph2), nseph2);
  419. });
  420. var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
  421. var result = new LocErrResult(res.StandardOutput);
  422. return ExeResult.Create(result, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
  423. }
  424. public static async Task<ExeResult<double>> RefCalc(DateTime[] intimes, double[] inmsephs, double[] innsephs, double[] indtorefs, double[] refgeod, double[] recgeod, DateTime time, double[] mseph, double[] nseph, int timeout = 60, CancellationToken token = default)
  425. {
  426. const string cmd = "refcalc";
  427. var cli = Cli.Wrap(CliPath)
  428. .WithArguments(args =>
  429. {
  430. args.Add(cmd);
  431. args.IpsAdd(nameof(intimes), intimes);
  432. args.IpsAdd(nameof(inmsephs), inmsephs);
  433. args.IpsAdd(nameof(innsephs), innsephs);
  434. args.IpsAdd(nameof(indtorefs), indtorefs);
  435. args.IpsAdd(nameof(refgeod), refgeod);
  436. args.IpsAdd(nameof(recgeod), recgeod);
  437. args.IpsAdd(nameof(time), time);
  438. args.IpsAdd(nameof(mseph), mseph);
  439. args.IpsAdd(nameof(nseph), nseph);
  440. });
  441. var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
  442. var dtoRefOut = double.Parse(res.StandardOutput);
  443. return ExeResult.Create(dtoRefOut, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
  444. }
  445. //[CommandOption("pos", 'p', Description = "定位点位置", IsRequired = true)]
  446. //public double[] Pos { get; set; }
  447. //[CommandOption("mseph", Description = "主星星历", IsRequired = true)]
  448. //public double[] MsEph { get; set; }
  449. //[CommandOption("nseph", Description = "邻星星历", IsRequired = true)]
  450. //public double[] NsEph { get; set; }
  451. //[CommandOption("msant", Description = "主星天线位置", IsRequired = true)]
  452. //public double[] MsAnt { get; set; }
  453. //[CommandOption("nsant", Description = "邻星天线位置", IsRequired = true)]
  454. //public double[] NsAnt { get; set; }
  455. //[CommandOption("refgeod", Description = "参考站位置")]
  456. //public double[] RefGeod { get; set; }
  457. public static async Task<ExeResult<double>> CalcDt(
  458. double[] pos,
  459. double[] mseph,
  460. double[] nseph,
  461. double[] msant,
  462. double[] nsant,
  463. double[] refgeod = null,
  464. int timeout = 60,
  465. CancellationToken token = default)
  466. {
  467. const string cmd = "calcdt";
  468. var cli = Cli.Wrap(CliPath)
  469. .WithArguments(args =>
  470. {
  471. args.Add(cmd);
  472. args.IpsAdd(nameof(pos), pos);
  473. args.IpsAdd(nameof(mseph), mseph);
  474. args.IpsAdd(nameof(nseph), nseph);
  475. args.IpsAdd(nameof(msant), msant);
  476. args.IpsAdd(nameof(nsant), nsant);
  477. if (refgeod != null && refgeod.Length > 1)
  478. args.IpsAdd(nameof(refgeod), refgeod);
  479. });
  480. var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
  481. var dtoRefOut = double.Parse(res.StandardOutput);
  482. return ExeResult.Create(dtoRefOut, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
  483. }
  484. public static async Task<ExeResult<double>> CalcDf(
  485. double frequp,
  486. double msturn,
  487. double nsturn,
  488. double[] pos,
  489. double[] mseph,
  490. double[] nseph,
  491. double[] msant,
  492. double[] nsant,
  493. double? reffrequp = null,
  494. double[] refgeod = null,
  495. int timeout = 60,
  496. CancellationToken token = default)
  497. {
  498. const string cmd = "calcdf";
  499. var cli = Cli.Wrap(CliPath)
  500. .WithArguments(args =>
  501. {
  502. args.Add(cmd);
  503. args.IpsAdd(nameof(frequp), frequp);
  504. args.IpsAdd(nameof(msturn), msturn);
  505. args.IpsAdd(nameof(nsturn), nsturn);
  506. args.IpsAdd(nameof(pos), pos);
  507. args.IpsAdd(nameof(mseph), mseph);
  508. args.IpsAdd(nameof(nseph), nseph);
  509. args.IpsAdd(nameof(msant), msant);
  510. args.IpsAdd(nameof(nsant), nsant);
  511. if (reffrequp.HasValue)
  512. args.IpsAdd(nameof(reffrequp), reffrequp);
  513. if (refgeod != null && refgeod.Length > 1)
  514. args.IpsAdd(nameof(refgeod), refgeod);
  515. });
  516. var res = await cli.ExecuteBufferedAsync(token.LinkTimeout(timeout));
  517. var dtoRefOut = double.Parse(res.StandardOutput);
  518. return ExeResult.Create(dtoRefOut, cli.Arguments, res.StartTime, res.ExitTime, res.ExitCode);
  519. }
  520. }
  521. }