SignalEmulationApi.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace Ips.Sim.Interops
  8. {
  9. public static class SignalEmulationApi
  10. {
  11. const string DLLNAME = @"AppData\ddc\SignalEmulation.dll";
  12. //[DllImport(DLLNAME)]
  13. //public extern static void genSatSignal(double[] majorSat, double[] minorSat, double[] majorRecv, double[] minorRecv, double[] tarPos, long fsample, int tlen, string fmajor, string fminor, double[] dts);
  14. //[DllImport(DLLNAME)]
  15. //public extern static void genSatSignals(double[] majorSat, double[] minorSat1, double[] minorSat2, double[] majorRecv, double[] minorRecv1, double[] minorRecv2, double[] tarPos, long fsample, int tlen, string fmajor, string fminor1, string fminor2, double[] dts);
  16. // 根据参数生成一组目标信号
  17. // major_sat 主星星历 xyz
  18. // minor_sat 邻星星历 xyz
  19. // majorRecv 主星接收站 lla
  20. // minorRecv 邻星接收站 lla
  21. // tarPos 目标位置 lla
  22. // ------------------------
  23. // fsample 生成信号采样率
  24. // tlenms 生成信号时长 ms
  25. // fmajor 生成信号主星文件名称
  26. // fminor 生成信号邻星文件名称
  27. //
  28. [DllImport(DLLNAME)]
  29. public extern static void genSatSignal(double[] majorSat, double[] minorSat, double[] majorRecv, double[] minorRecv, double[] tarPos, long fsample, int tlenms, string fmajor, string fminor, double[] res);
  30. // 根据参数生成一组目标信号
  31. // major_sat 主星星历 xyz
  32. // minor_sat1 邻星星历 xyz
  33. // minor_sat2 邻星星历 xyz
  34. // majorRecv 主星接收站 lla
  35. // minorRecv1 邻星接收站 lla
  36. // minorRecv2 邻星接收站 lla
  37. // tarPos 目标位置 lla
  38. // ------------------------
  39. // fsample 生成信号采样率
  40. // tlenms 生成信号时长 ms
  41. // dtErrRange 误差范围, 根据该值 生成一个随机误差 单位us
  42. // dfs 频差,两个
  43. // fmajor 生成信号主星文件名称
  44. // fminor1 生成信号邻星文件名称
  45. // fminor2 生成信号邻星文件名称
  46. //
  47. [DllImport(DLLNAME)]
  48. public extern static void genSatSignals(double[] majorSat, double[] minorSat1, double[] minorSat2, double[] majorRecv, double[] minorRecv1, double[] minorRecv2, double[] tarPos, long fsample, int tlenms, int dtErrRange, double[] dfs, string fmajor, string fminor1, string fminor2, double[] res);
  49. // 根据参数生成一组目标信号
  50. // major_sat 主星星历 xyz
  51. // minor_sat1 邻星星历 xyz
  52. // minor_sat2 邻星星历 xyz
  53. // majorRecv 主星接收站 lla
  54. // minorRecv1 邻星接收站 lla
  55. // minorRecv2 邻星接收站 lla
  56. // tarPos 目标位置 lla
  57. // refPos 目标位置 lla
  58. // ------------------------
  59. // fsample 生成信号采样率
  60. // tlenms 生成信号时长 ms
  61. // dtErrRange 误差范围, 根据该值 生成一个随机误差 单位us
  62. // dfs 频差,四个
  63. // fmajor 生成信号主星文件名称
  64. // fminor1 生成信号邻星文件名称
  65. // fminor2 生成信号邻星文件名称
  66. // frmajor 生成参考信号主星文件名称
  67. // frminor1 生成参考信号邻星文件名称
  68. // frminor2 生成参考信号邻星文件名称
  69. // res 长度4 目标参考对应的时差
  70. //
  71. [DllImport(DLLNAME)]
  72. public extern static void genSatSignalsWithRef(double[] majorSat, double[] minorSat1, double[] minorSat2, double[] majorRecv, double[] minorRecv1, double[] minorRecv2, double[] tarPos, double[] refPos, long fsample, long fsampleref, int tlenms, int dtErrRange, double[] dfs, string fmajor, string fminor1, string fminor2, string frmajor, string frminor1, string frminor2, double[] res);
  73. /////
  74. ///// 根据给定文件生成其对应的时差文件
  75. ///// fIn 输入文件
  76. ///// fOut 输出文件
  77. ///// fsample 采样率
  78. ///// dt 时差
  79. ///// df 频差
  80. /////
  81. //SignalEmulation_EXPORT void genSignalWithDtDf(char* fIn, char* fOut, __int64 fsample, double dt, double df);
  82. [DllImport(DLLNAME)]
  83. public extern static void genSignalWithDtDf(string fIn, string fOut, long fsample, double dt, double df);
  84. ///
  85. /// 该函数用于合并两个信号到一个新的文件
  86. /// 两个信号文件必须是相同的采样率, 如果两个文件不一样长,最后生成的数据以较短的文件时长为准
  87. ///
  88. /// infsample: 输出文件的采样率
  89. /// 输入文件为复采样文件
  90. /// sigfile1: 输入文件1
  91. /// outffc1: 输入文件1 在输出文件的中频位置
  92. /// 请确保 outffc1 - infsample/2 >= -outfsample/2 && outffc1 + infsample/2 <= outfsample/2 否则将会返回错误
  93. /// sigfile2: 输入文件2
  94. /// outffc2: 输入文件2 在输出文件的中频位置
  95. /// 请确保 outffc2 - infsample/2 >= -outfsample/2 && outffc2 + infsample/2 <= outfsample/2 否则将会返回错误
  96. /// 请确保 [outffc1 - infsample/2, outffc1 + infsample/2] 与 [outffc2 - infsample/2, outffc2 + infsample/2] 无交集 否则将返回错误
  97. /// outfsample: 输出文件采样率
  98. /// 请确保 outfsample = infsample * 2^N (N为正整数)
  99. /// outfile: 输出文件名称,如果输出文件存在将覆盖
  100. /// 输出文件为复采样文件 IQ
  101. /// return: 返回值:0 成功
  102. /// 1 输入/输出文件不合法或者无法打开
  103. /// 2 输入文件太小 必须大于0.1秒对应的数据
  104. /// 3 outffc1,2 不合法
  105. /// 4 outffc1,outffc2 存在交集
  106. /// 5 输入输出采样率不满足规则
  107. ///
  108. [DllImport(DLLNAME)]
  109. public extern static int mergeSignals(long infsample, string sigfile1, long outffc1, string sigfile2, long outffc2, long outfsample, string outfile);
  110. ///
  111. /// 该函数用于合并两个信号到一个新的文件
  112. /// 两个信号文件必须是相同的采样率, 如果两个文件不一样长,最后生成的数据以较短的文件时长为准
  113. ///
  114. /// infsample: 输出文件的采样率
  115. /// 输入文件为复采样文件
  116. /// sigfile1: 输入文件1
  117. /// outffc1: 输入文件1 在输出文件的中频位置
  118. /// 请确保 outffc1 - infsample/2 >= -outfsample/2 && outffc1 + infsample/2 <= outfsample/2 否则将会返回错误
  119. /// sigfile2: 输入文件2
  120. /// outffc2: 输入文件2 在输出文件的中频位置
  121. /// 请确保 outffc2 - infsample/2 >= -outfsample/2 && outffc2 + infsample/2 <= outfsample/2 否则将会返回错误
  122. /// sigfile3: 输入文件3
  123. /// outffc3: 输入文件3 在输出文件的中频位置
  124. /// 请确保 outffc3 - infsample/2 >= -outfsample/2 && outffc3 + infsample/2 <= outfsample/2 否则将会返回错误
  125. /// 请确保 [outffc1 - infsample/2, outffc1 + infsample/2] , [outffc2 - infsample/2, outffc2 + infsample/2] , [outffc2 - infsample/2, outffc2 + infsample/2]无交集 否则将返回错误
  126. /// outfsample: 输出文件采样率
  127. /// 请确保 outfsample = infsample * 2^N (N为正整数)
  128. /// outfile: 输出文件名称,如果输出文件存在将覆盖
  129. /// 输出文件为复采样文件 IQ
  130. /// return: 返回值:0 成功
  131. /// 1 输入/输出文件不合法或者无法打开
  132. /// 2 输入文件太小 必须大于0.1秒对应的数据
  133. /// 3 outffc1,2,3 不合法
  134. /// 4 outffc1,outffc2,outffc3 存在交集
  135. /// 5 输入输出采样率不满足规则
  136. ///
  137. [DllImport(DLLNAME)]
  138. public extern static int mergeSignalsEx(long infsample, string sigfile1, long outffc1, string sigfile2, long outffc2, string sigfile3, long outffc3, long outfsample, string outfile);
  139. ///
  140. /// 该函数用于合并两个信号到一个新的文件
  141. /// 三个信号文件必须是相同的采样率, 如果三个文件不一样长,最后生成的数据以较短的文件时长为准
  142. ///
  143. /// infsample: 输出文件的采样率
  144. /// 输入文件为复采样文件
  145. /// sigfile1: 输入文件1
  146. /// outffc1: 输入文件1 在输出文件的中频位置
  147. /// 请确保 outffc1 - infsample/2 >= -outfsample/2 && outffc1 + infsample/2 <= outfsample/2 否则将会返回错误
  148. /// sigfile2: 输入文件2
  149. /// outffc2: 输入文件2 在输出文件的中频位置
  150. /// 请确保 outffc2 - infsample/2 >= -outfsample/2 && outffc2 + infsample/2 <= outfsample/2 否则将会返回错误
  151. /// sigfile3: 输入文件3
  152. /// outffc3: 输入文件3 在输出文件的中频位置
  153. /// 请确保 outffc3 - infsample/2 >= -outfsample/2 && outffc3 + infsample/2 <= outfsample/2 否则将会返回错误
  154. /// 请确保 [outffc1 - infsample/2, outffc1 + infsample/2] , [outffc2 - infsample/2, outffc2 + infsample/2] , [outffc2 - infsample/2, outffc2 + infsample/2]无交集 否则将返回错误
  155. /// outfsample: 输出文件采样率
  156. /// 请确保 outfsample = infsample * N (N为正整数 and N > 3)
  157. /// outfile: 输出文件名称,如果输出文件存在将覆盖
  158. /// 输出文件为复采样文件 IQ
  159. /// return: 返回值:0 成功
  160. /// 1 输入/输出文件不合法或者无法打开
  161. /// 2 输入文件太小 必须大于0.1秒对应的数据
  162. /// 3 outffc1,2,3 不合法
  163. /// 4 outffc1,outffc2,outffc3 存在交集
  164. /// 5 输入输出采样率不满足规则
  165. ///
  166. [DllImport(DLLNAME)]
  167. public extern static int mergeSignalsEx_M(long infsample, string sigfile1, long outffc1, string sigfile2, long outffc2, string sigfile3, long outffc3, long outfsample, string outfile);
  168. }
  169. }