using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace Ips.Sim.Interops { public static class SignalEmulationApi { const string DLLNAME = @"AppData\ddc\SignalEmulation.dll"; //[DllImport(DLLNAME)] //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); //[DllImport(DLLNAME)] //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); // 根据参数生成一组目标信号 // major_sat 主星星历 xyz // minor_sat 邻星星历 xyz // majorRecv 主星接收站 lla // minorRecv 邻星接收站 lla // tarPos 目标位置 lla // ------------------------ // fsample 生成信号采样率 // tlenms 生成信号时长 ms // fmajor 生成信号主星文件名称 // fminor 生成信号邻星文件名称 // [DllImport(DLLNAME)] 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); // 根据参数生成一组目标信号 // major_sat 主星星历 xyz // minor_sat1 邻星星历 xyz // minor_sat2 邻星星历 xyz // majorRecv 主星接收站 lla // minorRecv1 邻星接收站 lla // minorRecv2 邻星接收站 lla // tarPos 目标位置 lla // ------------------------ // fsample 生成信号采样率 // tlenms 生成信号时长 ms // dtErrRange 误差范围, 根据该值 生成一个随机误差 单位us // dfs 频差,两个 // fmajor 生成信号主星文件名称 // fminor1 生成信号邻星文件名称 // fminor2 生成信号邻星文件名称 // [DllImport(DLLNAME)] 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); // 根据参数生成一组目标信号 // major_sat 主星星历 xyz // minor_sat1 邻星星历 xyz // minor_sat2 邻星星历 xyz // majorRecv 主星接收站 lla // minorRecv1 邻星接收站 lla // minorRecv2 邻星接收站 lla // tarPos 目标位置 lla // refPos 目标位置 lla // ------------------------ // fsample 生成信号采样率 // tlenms 生成信号时长 ms // dtErrRange 误差范围, 根据该值 生成一个随机误差 单位us // dfs 频差,四个 // fmajor 生成信号主星文件名称 // fminor1 生成信号邻星文件名称 // fminor2 生成信号邻星文件名称 // frmajor 生成参考信号主星文件名称 // frminor1 生成参考信号邻星文件名称 // frminor2 生成参考信号邻星文件名称 // res 长度4 目标参考对应的时差 // [DllImport(DLLNAME)] 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); ///// ///// 根据给定文件生成其对应的时差文件 ///// fIn 输入文件 ///// fOut 输出文件 ///// fsample 采样率 ///// dt 时差 ///// df 频差 ///// //SignalEmulation_EXPORT void genSignalWithDtDf(char* fIn, char* fOut, __int64 fsample, double dt, double df); [DllImport(DLLNAME)] public extern static void genSignalWithDtDf(string fIn, string fOut, long fsample, double dt, double df); /// /// 该函数用于合并两个信号到一个新的文件 /// 两个信号文件必须是相同的采样率, 如果两个文件不一样长,最后生成的数据以较短的文件时长为准 /// /// infsample: 输出文件的采样率 /// 输入文件为复采样文件 /// sigfile1: 输入文件1 /// outffc1: 输入文件1 在输出文件的中频位置 /// 请确保 outffc1 - infsample/2 >= -outfsample/2 && outffc1 + infsample/2 <= outfsample/2 否则将会返回错误 /// sigfile2: 输入文件2 /// outffc2: 输入文件2 在输出文件的中频位置 /// 请确保 outffc2 - infsample/2 >= -outfsample/2 && outffc2 + infsample/2 <= outfsample/2 否则将会返回错误 /// 请确保 [outffc1 - infsample/2, outffc1 + infsample/2] 与 [outffc2 - infsample/2, outffc2 + infsample/2] 无交集 否则将返回错误 /// outfsample: 输出文件采样率 /// 请确保 outfsample = infsample * 2^N (N为正整数) /// outfile: 输出文件名称,如果输出文件存在将覆盖 /// 输出文件为复采样文件 IQ /// return: 返回值:0 成功 /// 1 输入/输出文件不合法或者无法打开 /// 2 输入文件太小 必须大于0.1秒对应的数据 /// 3 outffc1,2 不合法 /// 4 outffc1,outffc2 存在交集 /// 5 输入输出采样率不满足规则 /// [DllImport(DLLNAME)] public extern static int mergeSignals(long infsample, string sigfile1, long outffc1, string sigfile2, long outffc2, long outfsample, string outfile); /// /// 该函数用于合并两个信号到一个新的文件 /// 两个信号文件必须是相同的采样率, 如果两个文件不一样长,最后生成的数据以较短的文件时长为准 /// /// infsample: 输出文件的采样率 /// 输入文件为复采样文件 /// sigfile1: 输入文件1 /// outffc1: 输入文件1 在输出文件的中频位置 /// 请确保 outffc1 - infsample/2 >= -outfsample/2 && outffc1 + infsample/2 <= outfsample/2 否则将会返回错误 /// sigfile2: 输入文件2 /// outffc2: 输入文件2 在输出文件的中频位置 /// 请确保 outffc2 - infsample/2 >= -outfsample/2 && outffc2 + infsample/2 <= outfsample/2 否则将会返回错误 /// sigfile3: 输入文件3 /// outffc3: 输入文件3 在输出文件的中频位置 /// 请确保 outffc3 - infsample/2 >= -outfsample/2 && outffc3 + infsample/2 <= outfsample/2 否则将会返回错误 /// 请确保 [outffc1 - infsample/2, outffc1 + infsample/2] , [outffc2 - infsample/2, outffc2 + infsample/2] , [outffc2 - infsample/2, outffc2 + infsample/2]无交集 否则将返回错误 /// outfsample: 输出文件采样率 /// 请确保 outfsample = infsample * 2^N (N为正整数) /// outfile: 输出文件名称,如果输出文件存在将覆盖 /// 输出文件为复采样文件 IQ /// return: 返回值:0 成功 /// 1 输入/输出文件不合法或者无法打开 /// 2 输入文件太小 必须大于0.1秒对应的数据 /// 3 outffc1,2,3 不合法 /// 4 outffc1,outffc2,outffc3 存在交集 /// 5 输入输出采样率不满足规则 /// [DllImport(DLLNAME)] public extern static int mergeSignalsEx(long infsample, string sigfile1, long outffc1, string sigfile2, long outffc2, string sigfile3, long outffc3, long outfsample, string outfile); /// /// 该函数用于合并两个信号到一个新的文件 /// 三个信号文件必须是相同的采样率, 如果三个文件不一样长,最后生成的数据以较短的文件时长为准 /// /// infsample: 输出文件的采样率 /// 输入文件为复采样文件 /// sigfile1: 输入文件1 /// outffc1: 输入文件1 在输出文件的中频位置 /// 请确保 outffc1 - infsample/2 >= -outfsample/2 && outffc1 + infsample/2 <= outfsample/2 否则将会返回错误 /// sigfile2: 输入文件2 /// outffc2: 输入文件2 在输出文件的中频位置 /// 请确保 outffc2 - infsample/2 >= -outfsample/2 && outffc2 + infsample/2 <= outfsample/2 否则将会返回错误 /// sigfile3: 输入文件3 /// outffc3: 输入文件3 在输出文件的中频位置 /// 请确保 outffc3 - infsample/2 >= -outfsample/2 && outffc3 + infsample/2 <= outfsample/2 否则将会返回错误 /// 请确保 [outffc1 - infsample/2, outffc1 + infsample/2] , [outffc2 - infsample/2, outffc2 + infsample/2] , [outffc2 - infsample/2, outffc2 + infsample/2]无交集 否则将返回错误 /// outfsample: 输出文件采样率 /// 请确保 outfsample = infsample * N (N为正整数 and N > 3) /// outfile: 输出文件名称,如果输出文件存在将覆盖 /// 输出文件为复采样文件 IQ /// return: 返回值:0 成功 /// 1 输入/输出文件不合法或者无法打开 /// 2 输入文件太小 必须大于0.1秒对应的数据 /// 3 outffc1,2,3 不合法 /// 4 outffc1,outffc2,outffc3 存在交集 /// 5 输入输出采样率不满足规则 /// [DllImport(DLLNAME)] public extern static int mergeSignalsEx_M(long infsample, string sigfile1, long outffc1, string sigfile2, long outffc2, string sigfile3, long outffc3, long outfsample, string outfile); } }