|
|
@@ -17,6 +17,7 @@ namespace X2D1NoRefTaskServer.Service
|
|
|
{
|
|
|
private readonly string baseUrl;
|
|
|
CancellationTokenSource cts;
|
|
|
+ Dictionary<int, double> dicSatDelay = new Dictionary<int, double>();
|
|
|
public HistoryTaskService()
|
|
|
{
|
|
|
var posPlatformAddr = ConfigurationManager.AppSettings["PosPlatformAddr"].Trim();//like http://127.0.0.1:8091 or http://127.0.0.1:8091/
|
|
|
@@ -24,6 +25,25 @@ namespace X2D1NoRefTaskServer.Service
|
|
|
this.baseUrl = posPlatformAddr + "api/";
|
|
|
else
|
|
|
this.baseUrl = posPlatformAddr + "/api/";
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var satDelay = ConfigurationManager.AppSettings["SatDelay"]?.Trim();
|
|
|
+ if (!string.IsNullOrWhiteSpace(satDelay))
|
|
|
+ {
|
|
|
+ var arr = satDelay.Split("-".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
|
|
+ var sats = arr[0].Replace("[", "").Replace("]", "").Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
|
|
+ var delays = arr[1].Replace("[", "").Replace("]", "").Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
|
|
+ for (int i = 0; i < sats.Length; i++)
|
|
|
+ {
|
|
|
+ dicSatDelay.Add(Convert.ToInt32(sats[i]), Convert.ToDouble(delays[i]));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ throw new Exception("解析配置文件SatDelay出错", ex);
|
|
|
+ }
|
|
|
}
|
|
|
public void StartAsync(X2D1HistoryTaskHandleDto dto)
|
|
|
{
|
|
|
@@ -36,14 +56,21 @@ namespace X2D1NoRefTaskServer.Service
|
|
|
LogHelper.Info($"【任务{dto.ID}】开始执行...");
|
|
|
int.TryParse(ConfigurationManager.AppSettings["PosDtoFactor"], out int posDtoFactor);
|
|
|
if (posDtoFactor == 0) posDtoFactor = 1;//定位时时差系数
|
|
|
- bool canConnected = CanGetSatIdFromMySql();
|
|
|
- if (!canConnected)
|
|
|
- {
|
|
|
- LogHelper.Warning("无法连接MySql查询卫星编号,将使用任务中提供的卫星");
|
|
|
- }
|
|
|
+ LogHelper.Info($"【任务{dto.ID}】定位时差系数={posDtoFactor}");
|
|
|
+
|
|
|
+ bool parseSucceed = int.TryParse(ConfigurationManager.AppSettings["UTCValue"], out int utcValue);
|
|
|
+ if (!parseSucceed)
|
|
|
+ utcValue = 8;
|
|
|
+ int hours = 8 - utcValue;
|
|
|
+
|
|
|
//点击定位平台右上角查看接口可以在浏览器中查看平台提供的所有接口详细信息
|
|
|
Task.Run(async () =>
|
|
|
{
|
|
|
+ bool canConnected = CanGetSatIdFromMySql();
|
|
|
+ if (!canConnected)
|
|
|
+ {
|
|
|
+ LogHelper.Warning("无法连接MySql查询卫星编号,将使用任务中提供的卫星");
|
|
|
+ }
|
|
|
DateTime preTime = dto.StartTime;
|
|
|
int formatFlag;
|
|
|
if (string.IsNullOrWhiteSpace(dto.DateDirFormat))
|
|
|
@@ -56,6 +83,10 @@ namespace X2D1NoRefTaskServer.Service
|
|
|
//处理完一个目录后跳转到第二天的目录
|
|
|
formatFlag = 1;
|
|
|
}
|
|
|
+ else if (dto.DateDirFormat.ToUpper().EndsWith("\\HH"))//类似20241223\13的多级目录
|
|
|
+ {
|
|
|
+ formatFlag = 3;
|
|
|
+ }
|
|
|
else if (dto.DateDirFormat.ToUpper().EndsWith("HH"))
|
|
|
{
|
|
|
//处理完一个目录后跳转到下一个小时的目录
|
|
|
@@ -71,7 +102,6 @@ namespace X2D1NoRefTaskServer.Service
|
|
|
string filesDir = dto.CapDir;
|
|
|
try
|
|
|
{
|
|
|
-
|
|
|
if (formatFlag != 0)
|
|
|
{
|
|
|
filesDir = Path.Combine(dto.CapDir, $"{preTime.ToString(dto.DateDirFormat)}");//yyyyMMdd
|
|
|
@@ -196,13 +226,14 @@ namespace X2D1NoRefTaskServer.Service
|
|
|
X2D1NoXlNoParlPosDto x2D1 = new X2D1NoXlNoParlPosDto()
|
|
|
{
|
|
|
TaskID = dto.ID,
|
|
|
- SigTime = minfo.CapTime.AddSeconds(data1[i].Smpstart / minfo.FsHz),
|
|
|
+ SigTime = minfo.CapTime.AddHours(hours).AddSeconds(data1[i].Smpstart / minfo.FsHz),
|
|
|
MainCode = minfo.SatId,
|
|
|
AdjaCode = ninfo.SatId,
|
|
|
- SxDto = data1[i].Dt * posDtoFactor - data2[i].Dt * posDtoFactor,
|
|
|
+ SxDto = data1[i].Dt * posDtoFactor - data2[i].Dt * posDtoFactor
|
|
|
+ - GetSatDelay(minfo.SatId) + GetSatDelay(ninfo.SatId),
|
|
|
SxDfo = data1[i].Df,
|
|
|
SxSnr = data1[i].Snr,
|
|
|
- XdDto = data1[i].Dt * posDtoFactor,
|
|
|
+ XdDto = data1[i].Dt * posDtoFactor - GetSatDelay(minfo.SatId),
|
|
|
XdDfo = data2[i].Df,
|
|
|
XdSnr = data2[i].Snr,
|
|
|
SatTxLon = minfo.CapLon,
|
|
|
@@ -316,6 +347,8 @@ namespace X2D1NoRefTaskServer.Service
|
|
|
LogHelper.Warning($"【任务{dto.ID}】主星使用任务中的卫星[{dto.MainSatCode}]");
|
|
|
historyFile.SatId = dto.MainSatCode;
|
|
|
}
|
|
|
+ LogHelper.Info($"【任务{dto.ID}】主星{dto.MainSatCode}转发时延{GetSatDelay(dto.MainSatCode)}us");
|
|
|
+
|
|
|
}
|
|
|
else if (ch == 3)
|
|
|
{
|
|
|
@@ -324,9 +357,17 @@ namespace X2D1NoRefTaskServer.Service
|
|
|
LogHelper.Warning($"【任务{dto.ID}】邻星使用任务中的卫星[{dto.AdjaSatCode}]");
|
|
|
historyFile.SatId = dto.AdjaSatCode;
|
|
|
}
|
|
|
+ LogHelper.Info($"【任务{dto.ID}】邻星{dto.AdjaSatCode}转发时延{GetSatDelay(dto.AdjaSatCode)}us");
|
|
|
}
|
|
|
return historyFile;
|
|
|
}
|
|
|
+ double GetSatDelay(int satCode)
|
|
|
+ {
|
|
|
+ if (dicSatDelay.ContainsKey(satCode))
|
|
|
+ return dicSatDelay[satCode];
|
|
|
+ else
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
int GetSatId(double freqdown)
|
|
|
{
|
|
|
int satId = 0;
|