|
@@ -97,10 +97,10 @@ namespace XdCxRhDW.App.WebAPI
|
|
|
CgResID = cgRes.ID,
|
|
|
TarName = string.IsNullOrWhiteSpace(dto.TarName) ? "未知目标" : dto.TarName,
|
|
|
TsName = dto.TsName,
|
|
|
- PosLon = Math.Round(res[0], 4),
|
|
|
- PosLat = Math.Round(res[1], 4),
|
|
|
- MirrLon = Math.Round(res[3], 4),
|
|
|
- MirrLat = Math.Round(res[4], 4),
|
|
|
+ PosLon = res[0],
|
|
|
+ PosLat = res[1],
|
|
|
+ MirrLon =res[3],
|
|
|
+ MirrLat =res[4],
|
|
|
};
|
|
|
posRes = db.PosRes.Add(posRes);
|
|
|
await db.SaveChangesAsync();
|
|
@@ -460,7 +460,7 @@ namespace XdCxRhDW.App.WebAPI
|
|
|
var runTask = await db.TaskInfos.Where(p => p.TaskState == EnumTaskState.Running && p.PosType == EnumPosType.X2D1).FirstOrDefaultAsync();
|
|
|
if (runTask == null)
|
|
|
{
|
|
|
- Serilog.Log.Warning($"接收到两星一地带参定位(无星历)参数,由于任务没有运行中忽略本次定位!");
|
|
|
+ Serilog.Log.Warning($"接收到两星一地无参定位(无星历)参数,由于任务没有运行中忽略本次定位!");
|
|
|
return Error<PosRes>($"多模式融合定位平台没有启动两星一地定位任务");
|
|
|
}
|
|
|
var parameter1 = new SQLiteParameter("@sigTime", dto.SigTime);
|
|
@@ -767,7 +767,7 @@ namespace XdCxRhDW.App.WebAPI
|
|
|
if (runTask == null)
|
|
|
{
|
|
|
Serilog.Log.Warning($"接收到三星双时差带参定位(含星历)参数,由于任务没有运行中忽略本次定位!");
|
|
|
- return Error<PosRes>($"多模式融合定位平台没有启动两星一地定位任务");
|
|
|
+ return Error<PosRes>($"多模式融合定位平台没有启动三星双时差定位任务");
|
|
|
}
|
|
|
|
|
|
var StationRes = db.StationRes.Add(new StationRes()
|
|
@@ -806,7 +806,7 @@ namespace XdCxRhDW.App.WebAPI
|
|
|
Adja2Z = dto.Adja2Z,
|
|
|
});
|
|
|
|
|
|
- var res = PosApi.X2D1_Pos(cgRes, StationRes);
|
|
|
+ var res = PosApi.X3_Pos(cgRes, StationRes);
|
|
|
|
|
|
PosRes posRes = new PosRes()
|
|
|
{
|
|
@@ -836,11 +836,11 @@ namespace XdCxRhDW.App.WebAPI
|
|
|
{
|
|
|
using (RHDWContext db = new RHDWContext())
|
|
|
{
|
|
|
- var runTask = await db.TaskInfos.Where(p => p.TaskState == EnumTaskState.Running && p.PosType == EnumPosType.X2D1).FirstOrDefaultAsync();
|
|
|
+ var runTask = await db.TaskInfos.Where(p => p.TaskState == EnumTaskState.Running && p.PosType == EnumPosType.X3TwoDto).FirstOrDefaultAsync();
|
|
|
if (runTask == null)
|
|
|
{
|
|
|
- Serilog.Log.Warning($"接收到两星一地带参定位(无星历)参数,由于任务没有运行中忽略本次定位!");
|
|
|
- return Error<PosRes>($"多模式融合定位平台没有启动两星一地定位任务");
|
|
|
+ Serilog.Log.Warning($"接收到三星双时差带参定位(无星历)参数,由于任务没有运行中忽略本次定位!");
|
|
|
+ return Error<PosRes>($"多模式融合定位平台没有启动三星双时差定位任务");
|
|
|
}
|
|
|
var parameter1 = new SQLiteParameter("@sigTime", dto.SigTime);
|
|
|
var parameter2 = new SQLiteParameter("@satcode", dto.MainSatID);
|
|
@@ -939,7 +939,208 @@ namespace XdCxRhDW.App.WebAPI
|
|
|
Adja2Z = ephAdja2.Z,
|
|
|
});
|
|
|
|
|
|
- var res = PosApi.X2D1_Pos(cgRes, StationRes);
|
|
|
+ var res = PosApi.X3_Pos(cgRes, StationRes);
|
|
|
+
|
|
|
+ PosRes posRes = new PosRes()
|
|
|
+ {
|
|
|
+ SigTime = dto.SigTime,
|
|
|
+ TaskInfoID = runTask.ID,
|
|
|
+ CgResID = cgRes.ID,
|
|
|
+ TarName = string.IsNullOrWhiteSpace(dto.TarName) ? "未知目标" : dto.TarName,
|
|
|
+ TsName = dto.TsName,
|
|
|
+ PosLon = res[0],
|
|
|
+ PosLat = res[1],
|
|
|
+ MirrLon = res[3],
|
|
|
+ MirrLat = res[4],
|
|
|
+ };
|
|
|
+ posRes = db.PosRes.Add(posRes);
|
|
|
+ await db.SaveChangesAsync();
|
|
|
+ PosObServer.Instance.Pub(posRes);
|
|
|
+ return Success(posRes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 三星双时差无参定位(含星历)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto">定位参数</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public async Task<AjaxResult<PosRes>> PosX3TwoDtoNoParAsync(X3TwoDtoNoParPosDto dto)
|
|
|
+ {
|
|
|
+ using (RHDWContext db = new RHDWContext())
|
|
|
+ {
|
|
|
+ var runTask = await db.TaskInfos.FirstOrDefaultAsync(p => p.PosType == EnumPosType.X3TwoDto && p.TaskState == EnumTaskState.Running);
|
|
|
+ if (runTask == null)
|
|
|
+ {
|
|
|
+ Serilog.Log.Warning($"接收到三星双时差无参定位(含星历)参数,由于任务没有运行中忽略本次定位!");
|
|
|
+ return Error<PosRes>($"多模式融合定位平台没有启动三星双时差定位任务");
|
|
|
+ }
|
|
|
+
|
|
|
+ var StationRes = db.StationRes.Add(new StationRes()
|
|
|
+ {
|
|
|
+ SatTxLon = dto.StationResInfo.SatTxLon,
|
|
|
+ SatTxLat = dto.StationResInfo.SatTxLat,
|
|
|
+ CdbTxLon = dto.StationResInfo.CdbTxLon,
|
|
|
+ CdbTxLat = dto.StationResInfo.CdbTxLat,
|
|
|
+ CxLon = dto.StationResInfo.CxLon,
|
|
|
+ CxLat = dto.StationResInfo.CxLat,
|
|
|
+ RefLon = dto.StationResInfo.RefLon,
|
|
|
+ RefLat = dto.StationResInfo.RefLat,
|
|
|
+ });
|
|
|
+
|
|
|
+ var cgRes = db.CgRes.Add(new CgRes()
|
|
|
+ {
|
|
|
+ SigTime = dto.SigTime,
|
|
|
+ Dto1 = dto.Dto1,
|
|
|
+ Dfo1 = dto.Dfo1,
|
|
|
+ Snr1 = dto.Snr1,
|
|
|
+ Dto2 = dto.Dto2,
|
|
|
+ Dfo2 = dto.Dfo2,
|
|
|
+ Snr2 = dto.Snr2,
|
|
|
+ StationResID = StationRes.ID,
|
|
|
+ MainX = dto.MainX,
|
|
|
+ MainY = dto.MainY,
|
|
|
+ MainZ = dto.MainZ,
|
|
|
+ Adja1X = dto.Adja1X,
|
|
|
+ Adja1Y = dto.Adja1Y,
|
|
|
+ Adja1Z = dto.Adja1Z,
|
|
|
+ Adja2X = dto.Adja2X,
|
|
|
+ Adja2Y = dto.Adja2Y,
|
|
|
+ Adja2Z = dto.Adja2Z,
|
|
|
+ });
|
|
|
+
|
|
|
+ var res = PosApi.X3_PosNoRef(cgRes, StationRes);
|
|
|
+
|
|
|
+ PosRes posRes = new PosRes()
|
|
|
+ {
|
|
|
+ SigTime = cgRes.SigTime,
|
|
|
+ TaskInfoID = runTask.ID,
|
|
|
+ CgResID = cgRes.ID,
|
|
|
+ TarName = string.IsNullOrWhiteSpace(dto.TarName) ? "未知目标" : dto.TarName,
|
|
|
+ TsName = dto.TsName,
|
|
|
+ PosLon = res[0],
|
|
|
+ PosLat = res[1],
|
|
|
+ MirrLon = res[3],
|
|
|
+ MirrLat = res[4],
|
|
|
+ };
|
|
|
+ posRes = db.PosRes.Add(posRes);
|
|
|
+ await db.SaveChangesAsync();
|
|
|
+ PosObServer.Instance.Pub(posRes);
|
|
|
+ return Success(posRes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 三星双时差无参定位(无星历)
|
|
|
+ /// </summary>
|
|
|
+ /// <returns>返回定位结果ID</returns>
|
|
|
+ [HttpPost]
|
|
|
+ public async Task<AjaxResult<PosRes>> PosX3TwoDtoNoXlNoParAsync(X3TwoDtoNoXlNoParPosDto dto)
|
|
|
+ {
|
|
|
+ using (RHDWContext db = new RHDWContext())
|
|
|
+ {
|
|
|
+ var runTask = await db.TaskInfos.Where(p => p.TaskState == EnumTaskState.Running && p.PosType == EnumPosType.X3TwoDto).FirstOrDefaultAsync();
|
|
|
+ if (runTask == null)
|
|
|
+ {
|
|
|
+ Serilog.Log.Warning($"接收到两星一地无参定位(无星历)参数,由于任务没有运行中忽略本次定位!");
|
|
|
+ return Error<PosRes>($"多模式融合定位平台没有启动三星双时差定位任务");
|
|
|
+ }
|
|
|
+ var parameter1 = new SQLiteParameter("@sigTime", dto.SigTime);
|
|
|
+ var parameter2 = new SQLiteParameter("@satcode", dto.MainSatID);
|
|
|
+ var parameter3 = new SQLiteParameter("@satcode", dto.Adja1SatID);
|
|
|
+ var parameter4 = new SQLiteParameter("@satcode", dto.Adja2SatID);
|
|
|
+ var xlInfo1 = await db.XlInfos.SqlQuery("select * from XlInfo where ABS(JULIANDAY(TimeBJ)-JULIANDAY(@sigTime))=(select min(ABS(JULIANDAY(TimeBJ)-JULIANDAY(@sigTime))) from XlInfo where satcode=@satcode)", parameter1, parameter2).FirstOrDefaultAsync();
|
|
|
+ if (xlInfo1 == null)
|
|
|
+ {
|
|
|
+ Serilog.Log.Error($"未找到卫星[{dto.MainSatID}]的双行根数星历");
|
|
|
+ return Error<PosRes>($"未找到卫星[{dto.MainSatID}]的双行根数星历");
|
|
|
+ }
|
|
|
+
|
|
|
+ var xlInfo2 = await db.XlInfos.SqlQuery("select * from XlInfo where ABS(JULIANDAY(TimeBJ)-JULIANDAY(@sigTime))=(select min(ABS(JULIANDAY(TimeBJ)-JULIANDAY(@sigTime))) from XlInfo where satcode=@satcode)", parameter1, parameter3).FirstOrDefaultAsync();
|
|
|
+ if (xlInfo2 == null)
|
|
|
+ {
|
|
|
+ Serilog.Log.Error($"未找到卫星[{dto.Adja1SatID}]的双行根数星历");
|
|
|
+ return Error<PosRes>($"未找到卫星[{dto.Adja1SatID}]的双行根数星历");
|
|
|
+ }
|
|
|
+
|
|
|
+ var xlInfo3 = await db.XlInfos.SqlQuery("select * from XlInfo where ABS(JULIANDAY(TimeBJ)-JULIANDAY(@sigTime))=(select min(ABS(JULIANDAY(TimeBJ)-JULIANDAY(@sigTime))) from XlInfo where satcode=@satcode)", parameter1, parameter4).FirstOrDefaultAsync();
|
|
|
+ if (xlInfo3 == null)
|
|
|
+ {
|
|
|
+ Serilog.Log.Error($"未找到卫星[{dto.Adja2SatID}]的双行根数星历");
|
|
|
+ return Error<PosRes>($"未找到卫星[{dto.Adja2SatID}]的双行根数星历");
|
|
|
+ }
|
|
|
+ Serilog.Log.Information($"卫星{dto.MainSatID}使用{xlInfo1.TwoLine}进行星历推算");
|
|
|
+ Serilog.Log.Information($"卫星{dto.Adja1SatID}使用{xlInfo2.TwoLine}进行星历推算");
|
|
|
+ Serilog.Log.Information($"卫星{dto.Adja2SatID}使用{xlInfo3.TwoLine}进行星历推算");
|
|
|
+ var settings = await db.SysSetings.FirstOrDefaultAsync();
|
|
|
+ var client = new HttpClient();
|
|
|
+
|
|
|
+ string url = string.Format("http://{0}:{1}/Api/", IpHelper.GetLocalIp(), settings.HttpPort);
|
|
|
+ var url1 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo1.TwoLine, dto.SigTime);
|
|
|
+ var response = await client.GetAsync(url1);
|
|
|
+ if (!response.IsSuccessStatusCode) // 处理响应失败
|
|
|
+ {
|
|
|
+ Serilog.Log.Error($"[{dto.MainSatID}]星厉推算失败");
|
|
|
+ return Error<PosRes>($"[{dto.MainSatID}]星厉推算失败");
|
|
|
+ }
|
|
|
+ var content = await response.Content.ReadAsStringAsync();
|
|
|
+ var ephMain = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content).data;
|
|
|
+
|
|
|
+ var url2 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo2.TwoLine, dto.SigTime);
|
|
|
+ var response2 = await client.GetAsync(url2);
|
|
|
+ if (!response2.IsSuccessStatusCode) // 处理响应失败
|
|
|
+ {
|
|
|
+ Serilog.Log.Error($"[{dto.Adja1SatID}]星厉推算失败");
|
|
|
+ return Error<PosRes>($"[{dto.Adja1SatID}]星厉推算失败");
|
|
|
+ }
|
|
|
+ var content2 = await response2.Content.ReadAsStringAsync();
|
|
|
+ var ephAdja1 = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content2).data;
|
|
|
+
|
|
|
+ var url3 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo3.TwoLine, dto.SigTime);
|
|
|
+ var response3 = await client.GetAsync(url3);
|
|
|
+ if (!response3.IsSuccessStatusCode) // 处理响应失败
|
|
|
+ {
|
|
|
+ Serilog.Log.Error($"[{dto.Adja2SatID}]星厉推算失败");
|
|
|
+ return Error<PosRes>($"[{dto.Adja2SatID}]星厉推算失败");
|
|
|
+ }
|
|
|
+ var content3 = await response2.Content.ReadAsStringAsync();
|
|
|
+ var ephAdja2 = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content3).data;
|
|
|
+
|
|
|
+ var StationRes = db.StationRes.Add(new StationRes()
|
|
|
+ {
|
|
|
+ SatTxLon = dto.StationResInfo.SatTxLon,
|
|
|
+ SatTxLat = dto.StationResInfo.SatTxLat,
|
|
|
+ CdbTxLon = dto.StationResInfo.CdbTxLon,
|
|
|
+ CdbTxLat = dto.StationResInfo.CdbTxLat,
|
|
|
+ CxLon = dto.StationResInfo.CxLon,
|
|
|
+ CxLat = dto.StationResInfo.CxLat,
|
|
|
+ RefLon = dto.StationResInfo.RefLon,
|
|
|
+ RefLat = dto.StationResInfo.RefLat,
|
|
|
+ });
|
|
|
+
|
|
|
+ var cgRes = db.CgRes.Add(new Model.CgRes()
|
|
|
+ {
|
|
|
+ SigTime = dto.SigTime,
|
|
|
+ Dto1 = dto.Dto1,
|
|
|
+ Dfo1 = dto.Dfo1,
|
|
|
+ Snr1 = dto.Snr1,
|
|
|
+ Dto2 = dto.Dto2,
|
|
|
+ Dfo2 = dto.Dfo2,
|
|
|
+ Snr2 = dto.Snr2,
|
|
|
+ StationResID = StationRes.ID,
|
|
|
+ MainX = ephMain.X,
|
|
|
+ MainY = ephMain.Y,
|
|
|
+ MainZ = ephMain.Z,
|
|
|
+ Adja1X = ephAdja1.X,
|
|
|
+ Adja1Y = ephAdja1.Y,
|
|
|
+ Adja1Z = ephAdja1.Z,
|
|
|
+ Adja2X = ephAdja2.X,
|
|
|
+ Adja2Y = ephAdja2.Y,
|
|
|
+ Adja2Z = ephAdja2.Z,
|
|
|
+ });
|
|
|
+
|
|
|
+ var res = PosApi.X3_PosNoRef(cgRes, StationRes);
|
|
|
|
|
|
PosRes posRes = new PosRes()
|
|
|
{
|
|
@@ -962,11 +1163,438 @@ namespace XdCxRhDW.App.WebAPI
|
|
|
#endregion
|
|
|
|
|
|
#region 三星双频差定位
|
|
|
+ /// <summary>
|
|
|
+ /// 三星双频差带参定位(含星历)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto">定位参数</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public async Task<AjaxResult<PosRes>> PosX3TwoDfoAsync(X3TwoDfoPosDto dto)
|
|
|
+ {
|
|
|
+ using (RHDWContext db = new RHDWContext())
|
|
|
+ {
|
|
|
+ var runTask = await db.TaskInfos.FirstOrDefaultAsync(p => p.PosType == EnumPosType.X3TwoDfo && p.TaskState == EnumTaskState.Running);
|
|
|
+ if (runTask == null)
|
|
|
+ {
|
|
|
+ Serilog.Log.Warning($"接收到三星双频差带参定位(含星历)参数,由于任务没有运行中忽略本次定位!");
|
|
|
+ return Error<PosRes>($"多模式融合定位平台没有启动三星双频差定位任务");
|
|
|
+ }
|
|
|
|
|
|
- #endregion
|
|
|
+ var StationRes = db.StationRes.Add(new StationRes()
|
|
|
+ {
|
|
|
+ SatTxLon = dto.StationResInfo.SatTxLon,
|
|
|
+ SatTxLat = dto.StationResInfo.SatTxLat,
|
|
|
+ CdbTxLon = dto.StationResInfo.CdbTxLon,
|
|
|
+ CdbTxLat = dto.StationResInfo.CdbTxLat,
|
|
|
+ CxLon = dto.StationResInfo.CxLon,
|
|
|
+ CxLat = dto.StationResInfo.CxLat,
|
|
|
+ RefLon = dto.StationResInfo.RefLon,
|
|
|
+ RefLat = dto.StationResInfo.RefLat,
|
|
|
+ });
|
|
|
|
|
|
- #region 双星时频差定位
|
|
|
+ var cgRes = db.CgRes.Add(new CgRes()
|
|
|
+ {
|
|
|
+ SigTime = dto.SigTime,
|
|
|
+ Dto1 = dto.Dto1,
|
|
|
+ Dfo1 = dto.Dfo1,
|
|
|
+ Snr1 = dto.Snr1,
|
|
|
+ Dto2 = dto.Dto2,
|
|
|
+ Dfo2 = dto.Dfo2,
|
|
|
+ Snr2 = dto.Snr2,
|
|
|
+ YbMainDfo = dto.YbMainDfo,
|
|
|
+ YbAdja1Dfo = dto.YbAdja1Dfo,
|
|
|
+ YbAdja2Dfo = dto.YbAdja2Dfo,
|
|
|
+ TarFreqUp= dto.TarFreqUp,
|
|
|
+ TarFreqDown=dto.TarFreqDown,
|
|
|
+ RefFreqUp=dto.RefFreqUp,
|
|
|
+ RefFreqDown=dto.RefFreqDown,
|
|
|
+ StationResID = StationRes.ID,
|
|
|
+ MainX = dto.MainX,
|
|
|
+ MainY = dto.MainY,
|
|
|
+ MainZ = dto.MainZ,
|
|
|
+ MainVx = dto.MainVx,
|
|
|
+ MainVy = dto.MainVy,
|
|
|
+ MainVz = dto.MainVz,
|
|
|
+ Adja1X = dto.Adja1X,
|
|
|
+ Adja1Y = dto.Adja1Y,
|
|
|
+ Adja1Z = dto.Adja1Z,
|
|
|
+ Adja1Vx = dto.Adja1Vx,
|
|
|
+ Adja1Vy = dto.Adja1Vy,
|
|
|
+ Adja1Vz = dto.Adja1Vz,
|
|
|
+ Adja2X = dto.Adja2X,
|
|
|
+ Adja2Y = dto.Adja2Y,
|
|
|
+ Adja2Z = dto.Adja2Z,
|
|
|
+ Adja2Vx = dto.Adja2Vx,
|
|
|
+ Adja2Vy = dto.Adja2Vy,
|
|
|
+ Adja2Vz = dto.Adja2Vz,
|
|
|
+ });
|
|
|
+
|
|
|
+ var res = PosApi.X3_PosTwoDfo(cgRes, StationRes);
|
|
|
|
|
|
+ PosRes posRes = new PosRes()
|
|
|
+ {
|
|
|
+ SigTime = cgRes.SigTime,
|
|
|
+ TaskInfoID = runTask.ID,
|
|
|
+ CgResID = cgRes.ID,
|
|
|
+ TarName = string.IsNullOrWhiteSpace(dto.TarName) ? "未知目标" : dto.TarName,
|
|
|
+ TsName = dto.TsName,
|
|
|
+ PosLon = res[0],
|
|
|
+ PosLat = res[1],
|
|
|
+ MirrLon = res[3],
|
|
|
+ MirrLat = res[4],
|
|
|
+ };
|
|
|
+ posRes = db.PosRes.Add(posRes);
|
|
|
+ await db.SaveChangesAsync();
|
|
|
+ PosObServer.Instance.Pub(posRes);
|
|
|
+ return Success(posRes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 三星双频差带参定位(无星历)
|
|
|
+ /// </summary>
|
|
|
+ /// <returns>返回定位结果ID</returns>
|
|
|
+ [HttpPost]
|
|
|
+ public async Task<AjaxResult<PosRes>> PosX3TwoDfoNoXlAsync(X3TwoDfoNoXlPosDto dto)
|
|
|
+ {
|
|
|
+ using (RHDWContext db = new RHDWContext())
|
|
|
+ {
|
|
|
+ var runTask = await db.TaskInfos.Where(p => p.TaskState == EnumTaskState.Running && p.PosType == EnumPosType.X3TwoDto).FirstOrDefaultAsync();
|
|
|
+ if (runTask == null)
|
|
|
+ {
|
|
|
+ Serilog.Log.Warning($"接收到三星双频差带参定位(无星历)参数,由于任务没有运行中忽略本次定位!");
|
|
|
+ return Error<PosRes>($"多模式融合定位平台没有启动三星双频差定位任务");
|
|
|
+ }
|
|
|
+ var parameter1 = new SQLiteParameter("@sigTime", dto.SigTime);
|
|
|
+ var parameter2 = new SQLiteParameter("@satcode", dto.MainSatID);
|
|
|
+ var parameter3 = new SQLiteParameter("@satcode", dto.Adja1SatID);
|
|
|
+ var parameter4 = new SQLiteParameter("@satcode", dto.Adja2SatID);
|
|
|
+ var xlInfo1 = await db.XlInfos.SqlQuery("select * from XlInfo where ABS(JULIANDAY(TimeBJ)-JULIANDAY(@sigTime))=(select min(ABS(JULIANDAY(TimeBJ)-JULIANDAY(@sigTime))) from XlInfo where satcode=@satcode)", parameter1, parameter2).FirstOrDefaultAsync();
|
|
|
+ if (xlInfo1 == null)
|
|
|
+ {
|
|
|
+ Serilog.Log.Error($"未找到卫星[{dto.MainSatID}]的双行根数星历");
|
|
|
+ return Error<PosRes>($"未找到卫星[{dto.MainSatID}]的双行根数星历");
|
|
|
+ }
|
|
|
+
|
|
|
+ var xlInfo2 = await db.XlInfos.SqlQuery("select * from XlInfo where ABS(JULIANDAY(TimeBJ)-JULIANDAY(@sigTime))=(select min(ABS(JULIANDAY(TimeBJ)-JULIANDAY(@sigTime))) from XlInfo where satcode=@satcode)", parameter1, parameter3).FirstOrDefaultAsync();
|
|
|
+ if (xlInfo2 == null)
|
|
|
+ {
|
|
|
+ Serilog.Log.Error($"未找到卫星[{dto.Adja1SatID}]的双行根数星历");
|
|
|
+ return Error<PosRes>($"未找到卫星[{dto.Adja1SatID}]的双行根数星历");
|
|
|
+ }
|
|
|
+
|
|
|
+ var xlInfo3 = await db.XlInfos.SqlQuery("select * from XlInfo where ABS(JULIANDAY(TimeBJ)-JULIANDAY(@sigTime))=(select min(ABS(JULIANDAY(TimeBJ)-JULIANDAY(@sigTime))) from XlInfo where satcode=@satcode)", parameter1, parameter4).FirstOrDefaultAsync();
|
|
|
+ if (xlInfo3 == null)
|
|
|
+ {
|
|
|
+ Serilog.Log.Error($"未找到卫星[{dto.Adja2SatID}]的双行根数星历");
|
|
|
+ return Error<PosRes>($"未找到卫星[{dto.Adja2SatID}]的双行根数星历");
|
|
|
+ }
|
|
|
+ Serilog.Log.Information($"卫星{dto.MainSatID}使用{xlInfo1.TwoLine}进行星历推算");
|
|
|
+ Serilog.Log.Information($"卫星{dto.Adja1SatID}使用{xlInfo2.TwoLine}进行星历推算");
|
|
|
+ Serilog.Log.Information($"卫星{dto.Adja2SatID}使用{xlInfo3.TwoLine}进行星历推算");
|
|
|
+ var settings = await db.SysSetings.FirstOrDefaultAsync();
|
|
|
+ var client = new HttpClient();
|
|
|
+
|
|
|
+ string url = string.Format("http://{0}:{1}/Api/", IpHelper.GetLocalIp(), settings.HttpPort);
|
|
|
+ var url1 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo1.TwoLine, dto.SigTime);
|
|
|
+ var response = await client.GetAsync(url1);
|
|
|
+ if (!response.IsSuccessStatusCode) // 处理响应失败
|
|
|
+ {
|
|
|
+ Serilog.Log.Error($"[{dto.MainSatID}]星厉推算失败");
|
|
|
+ return Error<PosRes>($"[{dto.MainSatID}]星厉推算失败");
|
|
|
+ }
|
|
|
+ var content = await response.Content.ReadAsStringAsync();
|
|
|
+ var ephMain = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content).data;
|
|
|
+
|
|
|
+ var url2 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo2.TwoLine, dto.SigTime);
|
|
|
+ var response2 = await client.GetAsync(url2);
|
|
|
+ if (!response2.IsSuccessStatusCode) // 处理响应失败
|
|
|
+ {
|
|
|
+ Serilog.Log.Error($"[{dto.Adja1SatID}]星厉推算失败");
|
|
|
+ return Error<PosRes>($"[{dto.Adja1SatID}]星厉推算失败");
|
|
|
+ }
|
|
|
+ var content2 = await response2.Content.ReadAsStringAsync();
|
|
|
+ var ephAdja1 = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content2).data;
|
|
|
+
|
|
|
+ var url3 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo3.TwoLine, dto.SigTime);
|
|
|
+ var response3 = await client.GetAsync(url3);
|
|
|
+ if (!response3.IsSuccessStatusCode) // 处理响应失败
|
|
|
+ {
|
|
|
+ Serilog.Log.Error($"[{dto.Adja2SatID}]星厉推算失败");
|
|
|
+ return Error<PosRes>($"[{dto.Adja2SatID}]星厉推算失败");
|
|
|
+ }
|
|
|
+ var content3 = await response2.Content.ReadAsStringAsync();
|
|
|
+ var ephAdja2 = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content3).data;
|
|
|
+
|
|
|
+ var StationRes = db.StationRes.Add(new StationRes()
|
|
|
+ {
|
|
|
+ SatTxLon = dto.StationResInfo.SatTxLon,
|
|
|
+ SatTxLat = dto.StationResInfo.SatTxLat,
|
|
|
+ CdbTxLon = dto.StationResInfo.CdbTxLon,
|
|
|
+ CdbTxLat = dto.StationResInfo.CdbTxLat,
|
|
|
+ CxLon = dto.StationResInfo.CxLon,
|
|
|
+ CxLat = dto.StationResInfo.CxLat,
|
|
|
+ RefLon = dto.StationResInfo.RefLon,
|
|
|
+ RefLat = dto.StationResInfo.RefLat,
|
|
|
+ });
|
|
|
+
|
|
|
+ var cgRes = db.CgRes.Add(new Model.CgRes()
|
|
|
+ {
|
|
|
+ SigTime = dto.SigTime,
|
|
|
+ Dto1 = dto.Dto1,
|
|
|
+ Dfo1 = dto.Dfo1,
|
|
|
+ Snr1 = dto.Snr1,
|
|
|
+ Dto2 = dto.Dto2,
|
|
|
+ Dfo2 = dto.Dfo2,
|
|
|
+ Snr2 = dto.Snr2,
|
|
|
+ YbMainDfo = dto.YbMainDfo,
|
|
|
+ YbAdja1Dfo = dto.YbAdja1Dfo,
|
|
|
+ YbAdja2Dfo = dto.YbAdja2Dfo,
|
|
|
+ TarFreqUp = dto.TarFreqUp,
|
|
|
+ TarFreqDown = dto.TarFreqDown,
|
|
|
+ RefFreqUp = dto.RefFreqUp,
|
|
|
+ RefFreqDown = dto.RefFreqDown,
|
|
|
+ StationResID = StationRes.ID,
|
|
|
+ MainX = ephMain.X,
|
|
|
+ MainY = ephMain.Y,
|
|
|
+ MainZ = ephMain.Z,
|
|
|
+ MainVx = ephMain.VX,
|
|
|
+ MainVy = ephMain.VY,
|
|
|
+ MainVz = ephMain.VZ,
|
|
|
+ Adja1X = ephAdja1.X,
|
|
|
+ Adja1Y = ephAdja1.Y,
|
|
|
+ Adja1Z = ephAdja1.Z,
|
|
|
+ Adja1Vx = ephAdja1.VX,
|
|
|
+ Adja1Vy = ephAdja1.VY,
|
|
|
+ Adja1Vz = ephAdja1.VZ,
|
|
|
+ Adja2X = ephAdja2.X,
|
|
|
+ Adja2Y = ephAdja2.Y,
|
|
|
+ Adja2Z = ephAdja2.Z,
|
|
|
+ Adja2Vx = ephAdja2.VX,
|
|
|
+ Adja2Vy = ephAdja2.VY,
|
|
|
+ Adja2Vz = ephAdja2.VZ,
|
|
|
+ });
|
|
|
+
|
|
|
+ var res = PosApi.X3_PosTwoDfo(cgRes, StationRes);
|
|
|
+
|
|
|
+ PosRes posRes = new PosRes()
|
|
|
+ {
|
|
|
+ SigTime = dto.SigTime,
|
|
|
+ TaskInfoID = runTask.ID,
|
|
|
+ CgResID = cgRes.ID,
|
|
|
+ TarName = string.IsNullOrWhiteSpace(dto.TarName) ? "未知目标" : dto.TarName,
|
|
|
+ TsName = dto.TsName,
|
|
|
+ PosLon = res[0],
|
|
|
+ PosLat = res[1],
|
|
|
+ MirrLon = res[3],
|
|
|
+ MirrLat = res[4],
|
|
|
+ };
|
|
|
+ posRes = db.PosRes.Add(posRes);
|
|
|
+ await db.SaveChangesAsync();
|
|
|
+ PosObServer.Instance.Pub(posRes);
|
|
|
+ return Success(posRes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 双星时频差定位
|
|
|
+ /// <summary>
|
|
|
+ /// 双星时频差带参定位(含星历)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto">定位参数</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public async Task<AjaxResult<PosRes>> PosX2DtoDfoAsync(X2DtoDfoPosDto dto)
|
|
|
+ {
|
|
|
+ using (RHDWContext db = new RHDWContext())
|
|
|
+ {
|
|
|
+ var runTask = await db.TaskInfos.FirstOrDefaultAsync(p => p.PosType == EnumPosType.X2Dfo && p.TaskState == EnumTaskState.Running);
|
|
|
+ if (runTask == null)
|
|
|
+ {
|
|
|
+ Serilog.Log.Warning($"接收到双星时频差带参定位(含星历)参数,由于任务没有运行中忽略本次定位!");
|
|
|
+ return Error<PosRes>($"多模式融合定位平台没有启动双星时频差定位任务");
|
|
|
+ }
|
|
|
+
|
|
|
+ var StationRes = db.StationRes.Add(new StationRes()
|
|
|
+ {
|
|
|
+ SatTxLon = dto.StationResInfo.SatTxLon,
|
|
|
+ SatTxLat = dto.StationResInfo.SatTxLat,
|
|
|
+ CdbTxLon = dto.StationResInfo.CdbTxLon,
|
|
|
+ CdbTxLat = dto.StationResInfo.CdbTxLat,
|
|
|
+ CxLon = dto.StationResInfo.CxLon,
|
|
|
+ CxLat = dto.StationResInfo.CxLat,
|
|
|
+ RefLon = dto.StationResInfo.RefLon,
|
|
|
+ RefLat = dto.StationResInfo.RefLat,
|
|
|
+ });
|
|
|
+
|
|
|
+ var cgRes = db.CgRes.Add(new CgRes()
|
|
|
+ {
|
|
|
+ SigTime = dto.SigTime,
|
|
|
+ Dto1 = dto.Dto,
|
|
|
+ Dfo1 = dto.Dfo,
|
|
|
+ Snr1 = dto.Snr,
|
|
|
+ YbMainDto = dto.YbMainDto,
|
|
|
+ YbAdja1Dto = dto.YbAdjaDto,
|
|
|
+ YbMainDfo = dto.YbMainDfo,
|
|
|
+ YbAdja1Dfo = dto.YbAdjaDfo,
|
|
|
+ TarFreqUp = dto.TarFreqUp,
|
|
|
+ TarFreqDown = dto.TarFreqDown,
|
|
|
+ RefFreqUp = dto.RefFreqUp,
|
|
|
+ RefFreqDown = dto.RefFreqDown,
|
|
|
+ StationResID = StationRes.ID,
|
|
|
+ MainX = dto.MainX,
|
|
|
+ MainY = dto.MainY,
|
|
|
+ MainZ = dto.MainZ,
|
|
|
+ MainVx = dto.MainVx,
|
|
|
+ MainVy = dto.MainVy,
|
|
|
+ MainVz = dto.MainVz,
|
|
|
+ Adja1X = dto.AdjaX,
|
|
|
+ Adja1Y = dto.AdjaY,
|
|
|
+ Adja1Z = dto.AdjaZ,
|
|
|
+ Adja1Vx = dto.AdjaVx,
|
|
|
+ Adja1Vy = dto.AdjaVy,
|
|
|
+ Adja1Vz = dto.AdjaVz,
|
|
|
+ });
|
|
|
+
|
|
|
+ var res = PosApi.X2_PosDtoDfo(cgRes, StationRes);
|
|
|
+
|
|
|
+ PosRes posRes = new PosRes()
|
|
|
+ {
|
|
|
+ SigTime = cgRes.SigTime,
|
|
|
+ TaskInfoID = runTask.ID,
|
|
|
+ CgResID = cgRes.ID,
|
|
|
+ TarName = string.IsNullOrWhiteSpace(dto.TarName) ? "未知目标" : dto.TarName,
|
|
|
+ TsName = dto.TsName,
|
|
|
+ PosLon = res[0],
|
|
|
+ PosLat = res[1],
|
|
|
+ MirrLon = res[3],
|
|
|
+ MirrLat = res[4],
|
|
|
+ };
|
|
|
+ posRes = db.PosRes.Add(posRes);
|
|
|
+ await db.SaveChangesAsync();
|
|
|
+ PosObServer.Instance.Pub(posRes);
|
|
|
+ return Success(posRes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 双星时频差带参定位(无星历)
|
|
|
+ /// </summary>
|
|
|
+ /// <returns>返回定位结果ID</returns>
|
|
|
+ [HttpPost]
|
|
|
+ public async Task<AjaxResult<PosRes>> PosX2DtoDfoNoXlAsync(X2DtoDfoNoXlPosDto dto)
|
|
|
+ {
|
|
|
+ using (RHDWContext db = new RHDWContext())
|
|
|
+ {
|
|
|
+ var runTask = await db.TaskInfos.Where(p => p.TaskState == EnumTaskState.Running && p.PosType == EnumPosType.X2Dfo).FirstOrDefaultAsync();
|
|
|
+ if (runTask == null)
|
|
|
+ {
|
|
|
+ Serilog.Log.Warning($"接收到双星时频差带参定位(无星历)参数,由于任务没有运行中忽略本次定位!");
|
|
|
+ return Error<PosRes>($"多模式融合定位平台没有启动双星时频差定位任务");
|
|
|
+ }
|
|
|
+ var parameter1 = new SQLiteParameter("@sigTime", dto.SigTime);
|
|
|
+ var parameter2 = new SQLiteParameter("@satcode", dto.MainSatID);
|
|
|
+ var parameter3 = new SQLiteParameter("@satcode", dto.AdjaSatID);
|
|
|
+ var xlInfo1 = await db.XlInfos.SqlQuery("select * from XlInfo where ABS(JULIANDAY(TimeBJ)-JULIANDAY(@sigTime))=(select min(ABS(JULIANDAY(TimeBJ)-JULIANDAY(@sigTime))) from XlInfo where satcode=@satcode)", parameter1, parameter2).FirstOrDefaultAsync();
|
|
|
+ if (xlInfo1 == null)
|
|
|
+ {
|
|
|
+ Serilog.Log.Error($"未找到卫星[{dto.MainSatID}]的双行根数星历");
|
|
|
+ return Error<PosRes>($"未找到卫星[{dto.MainSatID}]的双行根数星历");
|
|
|
+ }
|
|
|
+
|
|
|
+ var xlInfo2 = await db.XlInfos.SqlQuery("select * from XlInfo where ABS(JULIANDAY(TimeBJ)-JULIANDAY(@sigTime))=(select min(ABS(JULIANDAY(TimeBJ)-JULIANDAY(@sigTime))) from XlInfo where satcode=@satcode)", parameter1, parameter3).FirstOrDefaultAsync();
|
|
|
+ if (xlInfo2 == null)
|
|
|
+ {
|
|
|
+ Serilog.Log.Error($"未找到卫星[{dto.AdjaSatID}]的双行根数星历");
|
|
|
+ return Error<PosRes>($"未找到卫星[{dto.AdjaSatID}]的双行根数星历");
|
|
|
+ }
|
|
|
+ Serilog.Log.Information($"卫星{dto.MainSatID}使用{xlInfo1.TwoLine}进行星历推算");
|
|
|
+ Serilog.Log.Information($"卫星{dto.AdjaSatID}使用{xlInfo2.TwoLine}进行星历推算");
|
|
|
+ var settings = await db.SysSetings.FirstOrDefaultAsync();
|
|
|
+ var client = new HttpClient();
|
|
|
+
|
|
|
+ string url = string.Format("http://{0}:{1}/Api/", IpHelper.GetLocalIp(), settings.HttpPort);
|
|
|
+ var url1 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo1.TwoLine, dto.SigTime);
|
|
|
+ var response = await client.GetAsync(url1);
|
|
|
+ if (!response.IsSuccessStatusCode) // 处理响应失败
|
|
|
+ {
|
|
|
+ Serilog.Log.Error($"[{dto.MainSatID}]星厉推算失败");
|
|
|
+ return Error<PosRes>($"[{dto.MainSatID}]星厉推算失败");
|
|
|
+ }
|
|
|
+ var content = await response.Content.ReadAsStringAsync();
|
|
|
+ var ephMain = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content).data;
|
|
|
+
|
|
|
+ var url2 = string.Format(url + "Xl/Calc?tleStr={0}&dt={1}", xlInfo2.TwoLine, dto.SigTime);
|
|
|
+ var response2 = await client.GetAsync(url2);
|
|
|
+ if (!response2.IsSuccessStatusCode) // 处理响应失败
|
|
|
+ {
|
|
|
+ Serilog.Log.Error($"[{dto.AdjaSatID}]星厉推算失败");
|
|
|
+ return Error<PosRes>($"[{dto.AdjaSatID}]星厉推算失败");
|
|
|
+ }
|
|
|
+ var content2 = await response2.Content.ReadAsStringAsync();
|
|
|
+ var ephAdja1 = JsonConvert.DeserializeObject<AjaxResult<SatEphDto>>(content2).data;
|
|
|
+
|
|
|
+ var StationRes = db.StationRes.Add(new StationRes()
|
|
|
+ {
|
|
|
+ SatTxLon = dto.StationResInfo.SatTxLon,
|
|
|
+ SatTxLat = dto.StationResInfo.SatTxLat,
|
|
|
+ CdbTxLon = dto.StationResInfo.CdbTxLon,
|
|
|
+ CdbTxLat = dto.StationResInfo.CdbTxLat,
|
|
|
+ CxLon = dto.StationResInfo.CxLon,
|
|
|
+ CxLat = dto.StationResInfo.CxLat,
|
|
|
+ RefLon = dto.StationResInfo.RefLon,
|
|
|
+ RefLat = dto.StationResInfo.RefLat,
|
|
|
+ });
|
|
|
+
|
|
|
+ var cgRes = db.CgRes.Add(new Model.CgRes()
|
|
|
+ {
|
|
|
+ SigTime = dto.SigTime,
|
|
|
+ Dto1 = dto.Dto,
|
|
|
+ Dfo1 = dto.Dfo,
|
|
|
+ Snr1 = dto.Snr,
|
|
|
+ YbMainDto = dto.YbMainDto,
|
|
|
+ YbAdja1Dto = dto.YbAdjaDto,
|
|
|
+ YbMainDfo = dto.YbMainDfo,
|
|
|
+ YbAdja1Dfo = dto.YbAdjaDfo,
|
|
|
+ TarFreqUp = dto.TarFreqUp,
|
|
|
+ TarFreqDown = dto.TarFreqDown,
|
|
|
+ RefFreqUp = dto.RefFreqUp,
|
|
|
+ RefFreqDown = dto.RefFreqDown,
|
|
|
+ StationResID = StationRes.ID,
|
|
|
+ MainX = ephMain.X,
|
|
|
+ MainY = ephMain.Y,
|
|
|
+ MainZ = ephMain.Z,
|
|
|
+ MainVx = ephMain.VX,
|
|
|
+ MainVy = ephMain.VY,
|
|
|
+ MainVz = ephMain.VZ,
|
|
|
+ Adja1X = ephAdja1.X,
|
|
|
+ Adja1Y = ephAdja1.Y,
|
|
|
+ Adja1Z = ephAdja1.Z,
|
|
|
+ Adja1Vx = ephAdja1.VX,
|
|
|
+ Adja1Vy = ephAdja1.VY,
|
|
|
+ Adja1Vz = ephAdja1.VZ,
|
|
|
+ });
|
|
|
+
|
|
|
+ var res = PosApi.X2_PosDtoDfo(cgRes, StationRes);
|
|
|
+
|
|
|
+ PosRes posRes = new PosRes()
|
|
|
+ {
|
|
|
+ SigTime = dto.SigTime,
|
|
|
+ TaskInfoID = runTask.ID,
|
|
|
+ CgResID = cgRes.ID,
|
|
|
+ TarName = string.IsNullOrWhiteSpace(dto.TarName) ? "未知目标" : dto.TarName,
|
|
|
+ TsName = dto.TsName,
|
|
|
+ PosLon = res[0],
|
|
|
+ PosLat = res[1],
|
|
|
+ MirrLon = res[3],
|
|
|
+ MirrLat = res[4],
|
|
|
+ };
|
|
|
+ posRes = db.PosRes.Add(posRes);
|
|
|
+ await db.SaveChangesAsync();
|
|
|
+ PosObServer.Instance.Pub(posRes);
|
|
|
+ return Success(posRes);
|
|
|
+ }
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|