Browse Source

添加检测突发中有无参考信号,定位算法未实现找参考

wyq 1 year ago
parent
commit
ab457d11b0

+ 1 - 1
Service/X2D1TaskServer/App.config

@@ -27,7 +27,7 @@
 		<add key="AdjaSatDelay" value="0"/>
 
 		<!--检测文件类型(上行信号=0,主星下行信号=1)-->
-		<add key="CheckFileType" value="1"/>
+		<add key="CheckFileType" value="0"/>
 
 		<!--并行处理线程个数(支持0到N,0表示不限制,每个频点都在独立的线程中处理)-->
 		<add key="ThreadCount" value="0"/>

+ 42 - 0
Service/X2D1TaskServer/Service/BaseParamInfo.cs

@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using XdCxRhDW.Dto;
+
+namespace X2D1TaskServer
+{
+    public class BaseParamInfo
+    {
+        public BaseParamInfo(TaskSigDto taskSig, HistoryFile dinfo, HistoryFile minfo, HistoryFile ninfo)
+        {
+            this.TaskSig = taskSig;
+            this.Dinfo = dinfo;
+            this.Minfo = minfo;
+            this.Ninfo = ninfo;
+        }
+        public TaskSigDto TaskSig { get; set; }
+        public HistoryFile Dinfo { get; set; }
+        public HistoryFile Minfo { get; set; }
+
+        public HistoryFile Ninfo { get; set; }
+
+        public double? Delay1 { get; set; }
+
+        public double? Delay2 { get; set; }
+
+
+        public void SetDelay(double? mainSatDelay, double? adjaSatDelay)
+        {
+            Delay1 = TaskSig.SigDelay.FirstOrDefault(p => p.SatInfoSatCode == Minfo.SatId)?.Delay;
+            Delay2 = TaskSig.SigDelay.FirstOrDefault(p => p.SatInfoSatCode == Ninfo.SatId)?.Delay;
+            if (Delay1 == null)
+                Delay1 = mainSatDelay;
+            if (Delay2 == null)
+                Delay2 = adjaSatDelay;
+            if (Delay1 == null) Delay1 = 0;
+            if (Delay2 == null) Delay2 = 0;
+        }
+    }
+}

+ 238 - 162
Service/X2D1TaskServer/Service/TaskService.cs

@@ -1,12 +1,10 @@
 using System;
-using System.Collections;
 using System.Collections.Generic;
 using System.Configuration;
 using System.Diagnostics;
 using System.Globalization;
 using System.IO;
 using System.Linq;
-using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
 using X2D1TaskServer.Service;
@@ -314,6 +312,74 @@ namespace X2D1TaskServer
         }
 
 
+        private bool GetLocalFile(long size, string localFile, string sourceFile, CancellationTokenSource cts)
+        {
+            using (FileStream fs = new FileStream(localFile, FileMode.Create))
+            {
+                using (FileStream fs2 = new FileStream(sourceFile, FileMode.Open))
+                {
+                    size += fs2.Length;
+                    while (fs2.Position < fs2.Length)
+                    {
+                        if (cts.IsCancellationRequested) return false;
+                        byte[] data = new byte[1024];
+                        var len = fs2.Read(data, 0, 1024);
+                        data = data.Take(len).ToArray();
+                        fs.Write(data, 0, len);
+                    }
+                }
+            }
+            return true;
+        }
+
+        private async Task<(bool, List<DetectResDto>)> DetectCalc(string cdbFile, string mainFile, BaseParamInfo paramInfo, CancellationTokenSource cts)
+        {
+            List<DetectResDto> deteRes = new List<DetectResDto>();
+
+            DetectDto detectDto = new DetectDto()
+            {
+                file1 = cdbFile,//使用上行泄露信号进行检测
+                dmcType = paramInfo.TaskSig.SigType,//上行信号检测目前的算法只能使用基于能量的KY或IBS检测
+                fsHz = paramInfo.Minfo.FsHz,
+                mergeRes = true,
+                SigProc = true,
+                band = paramInfo.TaskSig.BandHz / 1e3,
+            };
+            if (_config.checkFileType == 0)//检测上行信号=0,检测主星下行信号=1
+            {
+                detectDto.dmcType = detectDto.dmcType & ~EnumSigCheckTypeDto.DAMA;//DAMA不支持上行信号检测,在这里移除掉
+                if ((int)detectDto.dmcType == 0)
+                {
+                    await LogHelper.Warning($"【任务{paramInfo.TaskSig.TaskInfoID}】信号[{paramInfo.TaskSig.FreqUp / 1e6:f3}MHz],上行信号不支持仅DAMA检测");
+                    return (false, deteRes);
+                }
+            }
+            else
+            {
+                detectDto.file1 = mainFile;//使用主星下行信号进行检测
+            }
+            if (detectDto.dmcType == EnumSigCheckTypeDto.Normal)
+            {
+                await LogHelper.Warning($"【任务{paramInfo.TaskSig.TaskInfoID}】信号[{paramInfo.TaskSig.FreqUp / 1e6:f3}MHz],该服务不支持Normal类型信号");
+                return (false, deteRes);
+            }
+            Stopwatch sw3 = new Stopwatch();
+            sw3.Start();
+            var deteResp = await HttpHelper.PostRequestAsync<List<DetectResDto>>(_config.baseUrl + "DetectCg/DetectCalc", detectDto, token: cts.Token);
+            if (deteResp.code != 200)
+            {
+                if (deteResp.msg.Contains("超时"))
+                    await LogHelper.Error($"【任务{paramInfo.TaskSig.TaskInfoID}】信号[{paramInfo.TaskSig.FreqUp / 1e6:f3}MHz],{paramInfo.Minfo.CapTime:yyyyMMddHHmmss}时刻{deteResp.msg}");
+                else
+                    await LogHelper.Error($"【任务{paramInfo.TaskSig.TaskInfoID}】信号[{paramInfo.TaskSig.FreqUp / 1e6:f3}MHz],{paramInfo.Minfo.CapTime:yyyyMMddHHmmss}时刻信号检测出错.{deteResp.msg}");
+                return (false, deteRes);
+            }
+            sw3.Stop();
+            await LogHelper.Info($"【任务{paramInfo.TaskSig.TaskInfoID}】信号[{paramInfo.TaskSig.FreqUp / 1e6:f3}MHz],{paramInfo.Minfo.CapTime:yyyyMMddHHmmss}时刻{_config.checkFileTypeStr}检测完成,共{deteResp.data.Count}个时隙,耗时{sw3.ElapsedMilliseconds}ms");
+            deteRes.AddRange(deteResp.data);
+            return (true, deteRes);
+        }
+
         internal Task GetPosTask(X2D1TaskHandleDto dto, List<IGrouping<int, HistoryFile>> item, bool isLocal, CancellationTokenSource cts)
         {
             var task = Task.Run(async () =>
@@ -358,16 +424,11 @@ namespace X2D1TaskServer
                         await LogHelper.Info($"【任务{dto.ID}】信号[{taskSig.FreqUp / 1e6}],{capTime:yyyyMMddHHmmss}时刻未找到邻星信号ch3文件,跳过此组数据");
                         continue;
                     }
+
+                    var paramInfo = new BaseParamInfo(taskSig, dinfo, minfo, ninfo);
                     try
                     {
-                        double? delay1 = taskSig.SigDelay.FirstOrDefault(p => p.SatInfoSatCode == minfo.SatId)?.Delay;
-                        double? delay2 = taskSig.SigDelay.FirstOrDefault(p => p.SatInfoSatCode == ninfo.SatId)?.Delay;
-                        if (delay1 == null)
-                            delay1 = _config.mainSatDelay;
-                        if (delay2 == null)
-                            delay2 = _config.adjaSatDelay;
-                        if (delay1 == null) delay1 = 0;
-                        if (delay2 == null) delay2 = 0;
+                        paramInfo.SetDelay(_config.mainSatDelay, _config.adjaSatDelay);
 
                         string localFile1 = minfo.FilePath;
                         string localFile2 = ninfo.FilePath;
@@ -379,54 +440,16 @@ namespace X2D1TaskServer
                             Stopwatch sw22 = new Stopwatch();
                             sw22.Start();
                             localFile1 = $"wwwroot\\{Path.GetFileName(minfo.FilePath)}";
-                            using (FileStream fs = new FileStream(localFile1, FileMode.Create))
-                            {
-                                using (FileStream fs2 = new FileStream(minfo.FilePath, FileMode.Open))
-                                {
-                                    size += fs2.Length;
-                                    while (fs2.Position < fs2.Length)
-                                    {
-                                        if (cts.IsCancellationRequested) return;
-                                        byte[] data = new byte[1024];
-                                        var len = fs2.Read(data, 0, 1024);
-                                        data = data.Take(len).ToArray();
-                                        fs.Write(data, 0, len);
-                                    }
-                                }
-                            }
+                            bool ret = GetLocalFile(size, localFile1, minfo.FilePath, cts);
+                            if (ret) return;
+
                             localFile2 = $"wwwroot\\{Path.GetFileName(ninfo.FilePath)}";
-                            using (FileStream fs = new FileStream(localFile2, FileMode.Create))
-                            {
-                                using (FileStream fs2 = new FileStream(ninfo.FilePath, FileMode.Open))
-                                {
-                                    size += fs2.Length;
-                                    while (fs2.Position < fs2.Length)
-                                    {
-                                        if (cts.IsCancellationRequested) return;
-                                        byte[] data = new byte[1024];
-                                        var len = fs2.Read(data, 0, 1024);
-                                        data = data.Take(len).ToArray();
-                                        fs.Write(data, 0, len);
-                                    }
-                                }
-                            }
-                            localFile3 = $"wwwroot\\{Path.GetFileName(dinfo.FilePath)}";
-                            using (FileStream fs = new FileStream(localFile3, FileMode.Create))
-                            {
-                                using (FileStream fs2 = new FileStream(dinfo.FilePath, FileMode.Open))
-                                {
-                                    size += fs2.Length;
-                                    while (fs2.Position < fs2.Length)
-                                    {
-                                        if (cts.IsCancellationRequested) return;
-                                        byte[] data = new byte[1024];
-                                        var len = fs2.Read(data, 0, 1024);
-                                        data = data.Take(len).ToArray();
-                                        fs.Write(data, 0, len);
-                                    }
-                                }
+                            ret = GetLocalFile(size, localFile2, ninfo.FilePath, cts);
+                            if (ret) return;
 
-                            }
+                            localFile3 = $"wwwroot\\{Path.GetFileName(dinfo.FilePath)}";
+                            ret = GetLocalFile(size, localFile3, dinfo.FilePath, cts);
+                            if (ret) return;
 
                             sw22.Stop();
                             var spped = size / 1024d / 1024d / (sw22.ElapsedMilliseconds / 1000d);
@@ -443,47 +466,11 @@ namespace X2D1TaskServer
                             File.Delete(localFile3);
                         }
 
-                        DetectDto detectDto = new DetectDto()
-                        {
-                            file1 = cdbFile,//使用上行泄露信号进行检测
-                            dmcType = taskSig.SigType,//上行信号检测目前的算法只能使用基于能量的KY或IBS检测
-                            fsHz = minfo.FsHz,
-                            mergeRes = true,
-                            SigProc = true,
-                            band = taskSig.BandHz / 1e3,
-                        };
-                        if (_config.checkFileType == 0)//检测上行信号=0,检测主星下行信号=1
-                        {
-                            detectDto.dmcType = detectDto.dmcType & ~EnumSigCheckTypeDto.DAMA;//DAMA不支持上行信号检测,在这里移除掉
-                            if ((int)detectDto.dmcType == 0)
-                            {
-                                await LogHelper.Warning($"【任务{dto.ID}】信号[{taskSig.FreqUp / 1e6:f3}MHz],上行信号不支持仅DAMA检测");
-                                continue;
-                            }
-                        }
-                        else
-                        {
-                            detectDto.file1 = mainFile;//使用主星下行信号进行检测
-                        }
-                        if (detectDto.dmcType == EnumSigCheckTypeDto.Normal)
-                        {
-                            await LogHelper.Warning($"【任务{dto.ID}】信号[{taskSig.FreqUp / 1e6:f3}MHz],该服务不支持Normal类型信号");
-                            continue;
-                        }
-                        Stopwatch sw3 = new Stopwatch();
-                        sw3.Start();
-                        var deteResp = await HttpHelper.PostRequestAsync<List<DetectResDto>>(_config.baseUrl + "DetectCg/DetectCalc", detectDto, token: cts.Token);
-                        if (deteResp.code != 200)
-                        {
-                            if (deteResp.msg.Contains("超时"))
-                                await LogHelper.Error($"【任务{dto.ID}】信号[{taskSig.FreqUp / 1e6:f3}MHz],{capTime:yyyyMMddHHmmss}时刻{deteResp.msg}");
-                            else
-                                await LogHelper.Error($"【任务{dto.ID}】信号[{taskSig.FreqUp / 1e6:f3}MHz],{capTime:yyyyMMddHHmmss}时刻信号检测出错.{deteResp.msg}");
-                            continue;
-                        }
-                        sw3.Stop();
-                        await LogHelper.Info($"【任务{dto.ID}】信号[{taskSig.FreqUp / 1e6:f3}MHz],{capTime:yyyyMMddHHmmss}时刻{_config.checkFileTypeStr}检测完成,共{deteResp.data.Count}个时隙,耗时{sw3.ElapsedMilliseconds}ms");
-                        var smps = deteResp.data.Select(m => new SmpPosition(m.Start, m.Length)).ToList();//怎么补0?
+                        //检测
+                        (bool deret, List<DetectResDto> deteRes) = await DetectCalc(cdbFile, mainFile, paramInfo, cts);
+                        if (!deret) continue;
+
+                        var smps = deteRes.Select(m => new SmpPosition(m.Start, m.Length)).ToList();//怎么补0?
                         var cgDto = new CpuCgMultiDto()
                         {
                             dtCenter = 260000,
@@ -560,77 +547,23 @@ namespace X2D1TaskServer
                         await HttpHelper.DeleteFileAsync(_config.baseUrl, mainFile, adjaFile, cdbFile);
                         var data1 = result1.data;
                         var data2 = result2.data;
-                        if (data1.Count != data2.Count || data1.Count != deteResp.data.Count)
+                        if (data1.Count != data2.Count || data1.Count != deteRes.Count)
                         {
                             await LogHelper.Error($"【任务{dto.ID}】信号[{taskSig.FreqUp / 1e6:f3}MHz],{capTime:yyyyMMddHHmmss}时刻参估结果个数和检测结果个数不匹配");
                             continue;
                         }
-                        for (int i = 0; i < data1.Count; i++)
+                        List<DetectResDto> refDetects = await DoRefAsync(dto, paramInfo, deteRes, data1, data2, cts);
+                        bool beFindRef = false;
+
+                        if (refDetects != null && refDetects.Count > 0)//有参考信号
                         {
-                            try
-                            {
-                                if (cts.IsCancellationRequested) break;
-                                X2D1NoXlNoParlPosDto x2D1 = new X2D1NoXlNoParlPosDto()
-                                {
-                                    TaskID = dto.ID,
-                                    SigTime = minfo.CapTime.AddSeconds(data1[i].Smpstart / minfo.FsHz),
-                                    MainCode = minfo.SatId,
-                                    AdjaCode = ninfo.SatId,
-                                    XdDfo = data2[i].Df,
-                                    XdSnr = data2[i].Snr,
-                                    SatTxLon = dto.CapLon,
-                                    SatTxLat = dto.CapLat,
-                                    CdbTxLon = dto.CapLon,
-                                    CdbTxLat = dto.CapLat,
-                                    FreqDown = minfo.FreqHz,
-                                    FreqUp = dinfo.FreqHz,
-                                    CheckRes = new CheckResDto()
-                                    {
-                                        FileName = Path.GetFileName(dinfo.FilePath),
-                                        ModRate = deteResp.data[i].ModRate,
-                                        ModType = deteResp.data[i].ModType,
-                                        SmpCount = deteResp.data[i].Length,
-                                        SmpStart = deteResp.data[i].Start,
-                                        UserName = deteResp.data[i].UserName,
-                                        FfcHz = deteResp.data[i].FfcHz,
-                                        PosCheckType = deteResp.data[i].DmcType.GetEnumByDisplayName<EnumPosCheckTypeDto>(),
-                                    }
-                                };
-                                if (data1[i].Snr > 0 && data2[i].Snr > 0)
-                                {
-                                    //卫星转发某些频点可能有时延,无参定位由于不能抵消需要减去这个时延
-                                    if (_config.checkFileType == 0)
-                                    {
-                                        x2D1.SxDto = data1[i].Dt * _config.posDtoFactor - data2[i].Dt * _config.posDtoFactor - delay1.Value + delay2.Value;
-                                        x2D1.SxDfo = data1[i].Df - data2[i].Df;
-                                        x2D1.SxSnr = (data1[i].Snr + data2[i].Snr) / 2;
-                                        x2D1.XdDto = data1[i].Dt * _config.posDtoFactor - delay1.Value;
-                                        x2D1.XdDfo = data1[i].Df;
-                                        x2D1.XdSnr = data1[i].Snr;
-                                    }
-                                    else
-                                    {
-                                        x2D1.SxDto = data2[i].Dt * _config.posDtoFactor - delay1.Value + delay2.Value;
-                                        x2D1.SxDfo = data2[i].Df;
-                                        x2D1.SxSnr = data2[i].Snr;
-                                        x2D1.XdDto = data1[i].Dt * _config.posDtoFactor - delay1.Value;
-                                        x2D1.XdDfo = data1[i].Df;
-                                        x2D1.XdSnr = data1[i].Snr;
-                                    }
-                                }
-
-                                var result = await HttpHelper.PostRequestAsync<PosResDto>(_config.baseUrl + "Pos/PosX2D1NoXlNoParAsync", x2D1);
-                                if (result.code != 200)
-                                {
-                                    await LogHelper.Error($"【任务{dto.ID}】信号[{taskSig.FreqUp / 1e6:f3}MHz],{capTime:yyyyMMddHHmmss}时刻时隙位置{data1[i].Smpstart}定位异常.{result.msg}");
-                                }
-                            }
-                            catch (Exception ex)
-                            {
-                                await LogHelper.Error($"【任务{dto.ID}】信号[{taskSig.FreqUp / 1e6:f3}MHz],{capTime:yyyyMMddHHmmss}时刻时隙位置{data1[i].Smpstart}定位异常", ex);
-                            }
+                            beFindRef = true;
+                            //过滤参考信号
+                            data1 = data1.Where(c => !refDetects.Any(r => r.Start == c.Smpstart && r.Length == c.Smplen)).ToList();
+                            data2 = data2.Where(c => !refDetects.Any(r => r.Start == c.Smpstart && r.Length == c.Smplen)).ToList();
                         }
-                        await LogHelper.Info($"【任务{dto.ID}】信号[{taskSig.FreqUp / 1e6:f3}MHz],{capTime:yyyyMMddHHmmss}时刻定位完成");
+                        await DoX2D1NoParPosAsync(dto, paramInfo, deteRes, data1, data2, cts, true, beFindRef);
+
                     }
                     catch (TaskCanceledException)
                     {
@@ -648,5 +581,148 @@ namespace X2D1TaskServer
             });
             return task;
         }
+
+        private async Task DoX2D1NoParPosAsync(X2D1TaskHandleDto dto, BaseParamInfo paramInfo, List<DetectResDto> deteRes, List<CpuCgResDto> data1, List<CpuCgResDto> data2, CancellationTokenSource cts, bool beTar = false, bool beFindRef = false)
+        {
+            string msg = $"【任务{dto.ID}】{(!beTar ? "参考" : "目标")}信号[{paramInfo.TaskSig.FreqUp / 1e6:f3}MHz]";
+            for (int i = 0; i < data1.Count; i++)
+            {
+                try
+                {
+                    if (cts.IsCancellationRequested) break;
+                    var detect = deteRes.First(r => r.Start == data1[i].Smpstart && r.Length == data1[i].Smplen);
+
+                    X2D1NoXlNoParlPosDto x2D1 = new X2D1NoXlNoParlPosDto()
+                    {
+                        TaskID = dto.ID,
+                        SigTime = paramInfo.Minfo.CapTime.AddSeconds(data1[i].Smpstart / paramInfo.Minfo.FsHz),
+                        MainCode = paramInfo.Minfo.SatId,
+                        AdjaCode = paramInfo.Ninfo.SatId,
+                        XdDfo = data2[i].Df,
+                        XdSnr = data2[i].Snr,
+                        SatTxLon = dto.CapLon,
+                        SatTxLat = dto.CapLat,
+                        CdbTxLon = dto.CapLon,
+                        CdbTxLat = dto.CapLat,
+                        FreqDown = paramInfo.Minfo.FreqHz,
+                        FreqUp = paramInfo.Dinfo.FreqHz,
+                        BeFindRef = beFindRef,
+                        CheckRes = new CheckResDto()
+                        {
+                            FileName = Path.GetFileName(paramInfo.Dinfo.FilePath),
+                            ModRate = detect.ModRate,
+                            ModType = detect.ModType,
+                            SmpCount = detect.Length,
+                            SmpStart = detect.Start,
+                            UserName = detect.UserName,
+                            FfcHz = detect.FfcHz,
+                            PosCheckType = detect.DmcType.GetEnumByDisplayName<EnumPosCheckTypeDto>(),
+                        }
+                    };
+                    if (dto.FixedStationDto != null)
+                    {
+                        x2D1.FixedStationId = dto.FixedStationDto.FixedStationId;
+                    }
+                    if (data1[i].Snr > 0 && data2[i].Snr > 0)
+                    {
+                        //卫星转发某些频点可能有时延,无参定位由于不能抵消需要减去这个时延
+                        if (_config.checkFileType == 0)
+                        {
+                            x2D1.SxDto = data1[i].Dt * _config.posDtoFactor - data2[i].Dt * _config.posDtoFactor - paramInfo.Delay1.Value + paramInfo.Delay2.Value;
+                            x2D1.SxDfo = data1[i].Df - data2[i].Df;
+                            x2D1.SxSnr = (data1[i].Snr + data2[i].Snr) / 2;
+                            x2D1.XdDto = data1[i].Dt * _config.posDtoFactor - paramInfo.Delay1.Value;
+                            x2D1.XdDfo = data1[i].Df;
+                            x2D1.XdSnr = data1[i].Snr;
+                        }
+                        else
+                        {
+                            x2D1.SxDto = data2[i].Dt * _config.posDtoFactor - paramInfo.Delay1.Value + paramInfo.Delay2.Value;
+                            x2D1.SxDfo = data2[i].Df;
+                            x2D1.SxSnr = data2[i].Snr;
+                            x2D1.XdDto = data1[i].Dt * _config.posDtoFactor - paramInfo.Delay1.Value;
+                            x2D1.XdDfo = data1[i].Df;
+                            x2D1.XdSnr = data1[i].Snr;
+                        }
+                    }
+
+                    var result = await HttpHelper.PostRequestAsync<PosResDto>(_config.baseUrl + "Pos/PosX2D1NoXlNoParAsync", x2D1);
+                    if (result.code != 200)
+                    {
+                        await LogHelper.Error($"{msg},{paramInfo.Minfo.CapTime:yyyyMMddHHmmss}时刻时隙位置{data1[i].Smpstart}定位异常.{result.msg}");
+                    }
+                }
+                catch (Exception ex)
+                {
+                    await LogHelper.Error($"{msg},{paramInfo.Minfo.CapTime:yyyyMMddHHmmss}时刻时隙位置{data1[i].Smpstart}定位异常", ex);
+                }
+            }
+            await LogHelper.Info($"{msg},{paramInfo.Minfo.CapTime:yyyyMMddHHmmss}时刻定位完成");
+        }
+
+        /// <summary>
+        /// 做参考信号
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <param name="paramInfo"></param>
+        /// <param name="detects"></param>
+        /// <param name="cg1"></param>
+        /// <param name="cg2"></param>
+        /// <param name="cts"></param>
+        /// <returns></returns>
+        private async Task<List<DetectResDto>> DoRefAsync(X2D1TaskHandleDto dto, BaseParamInfo paramInfo, List<DetectResDto> detects, List<CpuCgResDto> cg1, List<CpuCgResDto> cg2, CancellationTokenSource cts)
+        {
+
+            bool beRef = false;
+
+            //没有固定站时 做无参
+            if (dto.FixedStationDto == null)
+            {
+                return null;
+            }
+            //检测下行信号 做无参
+            if (_config.checkFileType != 0)
+            {
+                return null;
+            }
+            if (dto.FixedStationDto != null && _config.checkFileType == 0)
+            {
+                beRef = true;
+            }
+            if (!beRef) return null;
+
+
+            //获取满足固定站条件的参考信号 
+            List<DetectResDto> refDetects = new List<DetectResDto>();
+            for (int i = 0; i < detects.Count; i++)
+            {
+                if (i + 1 == detects.Count)
+                {
+                    break;
+                }
+                var currentdete = detects[i];
+                var nextdete = detects[i + 1];
+                double seconds = (nextdete.Start / paramInfo.Minfo.FsHz) - (currentdete.Start / paramInfo.Minfo.FsHz);
+                //突发距离前一个突发的时间超过判定规则值(秒)此突发为参考信号
+                if (seconds >= dto.FixedStationDto.Value)
+                {
+                    refDetects.Add(nextdete);
+                }
+            }
+            if (refDetects.Count == 0) return null;
+            var capTime = paramInfo.Minfo.CapTime;
+            await LogHelper.Info($"【任务{dto.ID}】参考信号[{dto.FixedStationDto.FreqUp / 1e6:f3}MHz],{capTime:yyyyMMddHHmmss}时刻{_config.checkFileTypeStr}检测完成,共{refDetects.Count}个时隙");
+            var smps = refDetects.Select(m => new SmpPosition(m.Start, m.Length)).ToList();//怎么补0?
+            var data1 = cg1.Where(c => refDetects.Any(r => r.Start == c.Smpstart && r.Length == c.Smplen)).ToList();
+            var data2 = cg2.Where(c => refDetects.Any(r => r.Start == c.Smpstart && r.Length == c.Smplen)).ToList();
+            if (data1.Count != data2.Count || data1.Count != refDetects.Count)
+            {
+                await LogHelper.Error($"【任务{dto.ID}】参考信号[{dto.FixedStationDto.FreqUp / 1e6:f3}MHz],{capTime:yyyyMMddHHmmss}时刻参估结果个数和检测结果个数不匹配");
+                return null;
+            }
+
+            await DoX2D1NoParPosAsync(dto, paramInfo, refDetects, data1, data2, cts);
+            return refDetects;
+        }
     }
 }

+ 1 - 0
Service/X2D1TaskServer/X2D1TaskServer.csproj

@@ -131,6 +131,7 @@
     <Compile Include="MainForm.Designer.cs">
       <DependentUpon>MainForm.cs</DependentUpon>
     </Compile>
+    <Compile Include="Service\BaseParamInfo.cs" />
     <Compile Include="Service\BaseTaskI.cs" />
     <Compile Include="Service\TaskHistoryService.cs" />
     <Compile Include="Service\TaskRealService.cs" />

+ 1 - 0
XdCxRhDW.App/Controllers/PosController.cs

@@ -722,6 +722,7 @@ namespace XdCxRhDW.App.Controllers
                     DfoCdb = Math.Round(dto.XdDfo, 10),
                     SnrCdb = Math.Round(dto.XdSnr, 1),
                     StationResID = StationRes.ID,
+                    FixedStationResID=dto.FixedStationId,
                     MainCode = dto.MainCode,
                     Adja1Code = dto.AdjaCode,
                     MainXlTime = ephMain.data.TleTime,

+ 1 - 0
XdCxRhDW.App/UserControl/CtrlHome.cs

@@ -633,6 +633,7 @@ namespace XdCxRhDW.App.UserControl
                             {
                                 dto.FixedStationDto = new X2D1FixedStationDto()
                                 {
+                                    FixedStationId=fixedStation.ID,
                                     FreqUp = fixedStation.FreqUpHz,
                                     Lon = fixedStation.Lon,
                                     Lat = fixedStation.Lat,

+ 10 - 0
XdCxRhDw.Dto/PosDto/X2D1NoXlNoParlPosDto.cs

@@ -119,6 +119,16 @@ namespace XdCxRhDW.Dto
         [Obsolete]
         public bool CalcConfidence { get; set; } = false;
 
+        /// <summary>
+        /// 固定站ID
+        /// </summary>
+        public int? FixedStationId { get; set; }
+
+        /// <summary>
+        /// 获取参考信号
+        /// </summary>
+        public bool BeFindRef { get; set; }
+
     }
 
 }

+ 4 - 0
XdCxRhDw.Dto/TaskHandleDto/X2D1TaskHandleDto.cs

@@ -93,6 +93,10 @@ namespace XdCxRhDW.Dto
     /// </summary>
     public class X2D1FixedStationDto
     {
+        /// <summary>
+        /// 固定站ID
+        /// </summary>
+        public int FixedStationId { get; set; }
         /// <summary>
         /// 名称
         /// </summary>