#pragma once #ifndef _WIN32 //linux #ifndef DECL_EXPORT # define DECL_EXPORT __attribute__((visibility("default"))) #endif #ifndef DECL_IMPORT # define DECL_IMPORT __attribute__((visibility("default"))) #endif #else //Windows #ifndef DECL_EXPORT # define DECL_EXPORT __declspec(dllexport) #endif #ifndef DECL_IMPORT # define DECL_IMPORT __declspec(dllimport) #endif #endif #ifdef SignalEmulation_Lib #define SignalEmulation_EXPORT DECL_EXPORT #else #define SignalEmulation_EXPORT DECL_IMPORT #endif extern "C" { // 根据卫星 接收站位置 目标位置 推算 // pos1 xyz 3 // pos2 xyz 3 // recv1 lla 3 // recv2 lla 3 // tar lla 3 * n // tarCount n // deltaT n void genDeltaT(double *pos1, double *pos2, double *recv1, double *recv2, double *tar, int tarCount, double *deltaT); // 生成psk调整信号 // x 输入符号 // len 符号长度 // mode alphabet size 2^N (1,2,3,4) // phase initial phase // Amplify 幅度 // N 升采样系数 >= 0 void pskMod(int *x, int len, int mode, double phase, int Amplify, int N, double *y, int &olen); // 添加高斯白噪声 // sig IQ信号 // len 信号个数 // sigPower signal power in dBW < 0 表示需要进行测量 // reqSNR void awgn(double *sig, int len, double sigPower, double reqSNR); // 添加高斯白噪声 // sig IQ信号 // len 信号个数 // sigPower signal power in dBW < 0 表示需要进行测量 // reqSNR void awgnComplex(double *sig, int len, double sigPower, double reqSNR); //生成升余弦滤波器 // mode =0 normal // delay = span*sps/2; // t = (-delay:delay) / sps; // denom = (1-(2*beta*t).^2); // sinc(t(idx1)).*(cos(pi*beta*t(idx1))./denom(idx1))/sps; // mod = 1 sqrt 暂未实现 // double *rcosdesign(double beta, int span, int sps, int mode, int &len); // 根据参数生成一组目标信号 // major_sat 主星星历 xyz // minor_sat 邻星星历 xyz // majorRecv 主星接收站 lla // minorRecv 邻星接收站 lla // tarPos 目标位置 lla // ------------------------ // fsample 生成信号采样率 // tlenms 生成信号时长 ms // fmajor 生成信号主星文件名称 // fminor 生成信号邻星文件名称 // SignalEmulation_EXPORT void genSatSignal(double majorSat[3], double minorSat[3], double majorRecv[3], double minorRecv[3], double tarPos[3] , __int64 fsample, int tlenms, char *fmajor, char *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 // fmajor 生成信号主星文件名称 // fminor1 生成信号邻星文件名称 // fminor2 生成信号邻星文件名称 // SignalEmulation_EXPORT void genSatSignals(double majorSat[3], double minorSat1[3], double minorSat2[3] , double majorRecv[3], double minorRecv1[3], double minorRecv2[3] , double tarPos[3], __int64 fsample, int tlenms, int dtErrRange, double df[2] , char *fmajor, char *fminor1, char *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 // fmajor 生成信号主星文件名称 // fminor1 生成信号邻星文件名称 // fminor2 生成信号邻星文件名称 // frmajor 生成参考信号主星文件名称 // frminor1 生成参考信号邻星文件名称 // frminor2 生成参考信号邻星文件名称 // res 长度4 目标参考对应的时差 // SignalEmulation_EXPORT void genSatSignalsWithRef(double majorSat[3], double minorSat1[3], double minorSat2[3] , double majorRecv[3], double minorRecv1[3], double minorRecv2[3] , double tarPos[3], double refPos[3], __int64 fsample, __int64 fsampleref, int tlenms, int dtErrRange, double df[4] , char *fmajor, char *fminor1, char *fminor2 , char *frmajor, char *frminor1, char *frminor2 , double *res); /// /// 根据给定文件生成其对应的时差文件 /// fIn 输入文件 /// fOut 输出文件 /// fsample 采样率 /// dt 时差 /// df 频差 /// SignalEmulation_EXPORT void genSignalWithDtDf(char *fIn, char *fOut, __int64 fsample, double dt, double df); /// /// 根据给定时频差生成信号 /// f1 主星文件 /// f2 邻星文件 /// fsample 采样率 // tlenms 生成信号时长 ms /// dt 时差 /// df 频差 /// SignalEmulation_EXPORT void genSignalsWithDtDf(char *file1, char *file2, __int64 fsample, int tlenms, double dt, double df, int snr1, int snr2); /// /// 根据给定时频差生成信号 /// f1 主星文件 /// fsample 采样率 // tlenms 生成信号时长 ms /// Am 最大幅度 /// SignalEmulation_EXPORT void genNoizes(char *file1, __int64 fsample, int tlenms, int Am); /// /// 该函数用于合并两个信号到一个新的文件 /// 两个信号文件必须是相同的采样率, 如果两个文件不一样长,最后生成的数据以较短的文件时长为准 /// /// 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 输入输出采样率不满足规则 /// SignalEmulation_EXPORT int mergeSignals(__int64 infsample, char *sigfile1, __int64 outffc1, char *sigfile2, __int64 outffc2, __int64 outfsample, char *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 输入输出采样率不满足规则 /// SignalEmulation_EXPORT int mergeSignalsEx(__int64 infsample, char *sigfile1, __int64 outffc1, char *sigfile2, __int64 outffc2, char *sigfile3, __int64 outffc3, __int64 outfsample, char *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 输入输出采样率不满足规则 /// SignalEmulation_EXPORT int mergeSignalsEx_MN(__int64 infsample, char *sigfile1, __int64 outffc1, char *sigfile2, __int64 outffc2, char *sigfile3, __int64 outffc3, __int64 outfsample, char *outfile); /// /// 该函数用于合并两个信号到一个新的文件 /// 三个信号文件必须是相同的采样率, 如果三个文件不一样长,最后生成的数据以较短的文件时长为准 /// /// infsample: 输出文件的采样率 /// 确保infsample %(outfsample / 3062500)==0 /// 输入文件为复采样文件 /// 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: 输出文件采样率 3062500 的倍数 /// outfile: 输出文件名称,如果输出文件存在将覆盖 /// 输出文件为复采样文件 IQ /// return: 返回值:0 成功 /// 1 输入/输出文件不合法或者无法打开 /// 2 输入文件太小 必须大于0.1秒对应的数据 /// 3 outffc1,2,3 不合法 /// 4 outffc1,outffc2,outffc3 存在交集 /// 5 输入输出采样率不满足规则 /// 1.outfsample % 3062500 == 0 /// 2.infsample %(outfsample / 3062500)==0 /// 3.outfsample / infsample > 3 /// SignalEmulation_EXPORT int mergeSignalsEx_M(__int64 infsample, char *sigfile1, __int64 outffc1, char *sigfile2, __int64 outffc2, char *sigfile3, __int64 outffc3, __int64 outfsample, char *outfile); };