123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937 |
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Net;
- using System.Net.Http;
- using System.Net.Sockets;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using XdCxRhDW.Dto;
- namespace XdCxRhDW.Sender
- {
- public partial class Form1 : DevExpress.XtraEditors.XtraForm
- {
- public Form1()
- {
- InitializeComponent();
- this.IconOptions.SvgImage = DxHelper.SvgHelper.LoadFromFile("Service.svg");
- }
- CancellationTokenSource cts1;
- private async void btn1_Click(object sender, EventArgs e)
- {
- layoutControlItem1.Enabled = false;
- layoutControlItem7.Enabled = false;
- if (btn1.Text == "推送")
- {
- try
- {
- cts1 = new CancellationTokenSource();
- btn1.Text = "停止";
- var addrArr = txtAddr1.Text.Trim().Replace(":", ":").Split(":".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
- string ip = addrArr[0];
- int port = Convert.ToInt32(addrArr[1]);
- if (txtTskType.EditValue == null)
- {
- Log($"请选择定位类型");
- return;
- }
- string tskType = txtTskType.EditValue.ToString();
- await Task.Run(async () =>
- {
- //while (true)
- //{
- // if (cts1.IsCancellationRequested)
- // break;
- using (var client = new HttpClient())
- {
- try
- {
- string url = string.Format("http://{0}:{1}/Api/Pos/", ip, port);
- if (tskType == "X1D1CX")//一星一地测向定位
- {
- var lines = File.ReadAllLines("Simulation_Data2023.dat");
- int idx = 1;
- url += "PosX1D1Async";
- foreach (var line in lines)
- {
- if (cts1.IsCancellationRequested) break;
- if (string.IsNullOrWhiteSpace(line)) continue;
- var items = line.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
- CheckResDto checkResDto = new CheckResDto()
- {
- UserName = "UserName",
- FileName = "FileName",
- SmpStart = 1,
- SmpCount = 2,
- ModType = "ModType",
- PosCheckType = EnumPosCheckTypeDto.Ky5758,
- ModRate = null
- };
- X1D1PosDto dto = new X1D1PosDto()
- {
- SigTime = DateTime.Now,
- MainCode = 23467,
- XdDto = Convert.ToDouble(items[1]) * 1e6,
- MainYbDto = Convert.ToDouble(items[2]) * 1e6,
- CxRes = Convert.ToDouble(items[4]),
- MainX = Convert.ToDouble(items[7]),
- MainY = Convert.ToDouble(items[8]),
- MainZ = Convert.ToDouble(items[9]),
- FreqDown = 295.425e6,//For Api Test
- FreqUp = 260.425e6,//For Api Test
- XdDfo = 1529,//For Api Test
- XdSnr = 25,//For Api Test
- SatTxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "卫星接收天线", "Lon"),
- SatTxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "卫星接收天线", "Lat"),
- CdbTxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "超短波接收天线", "Lon"),
- CdbTxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "超短波接收天线", "Lat"),
- CxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "侧向站", "Lon"),
- CxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "侧向站", "Lat"),
- RefLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lon"),
- RefLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lat"),
- CheckRes= checkResDto,
- };
- var result = await HttpHelper.PostRequestAsync<PosResDto>(url, dto);
- if (result.code != 200)
- {
- Log($"{result.msg}");
- return;
- }
- //Thread.Sleep(1000);
- Log($"已向[{txtAddr1.Text}]发送第{idx++}条仿真结果");
- }
- }
- if (tskType == "X2D1")//两星一地定位
- {
- var lines = File.ReadAllLines("Simulation_Data2023.dat");
- int idx = 1;
- url += "PosX2D1Async";
- foreach (var line in lines)
- {
- if (cts1.IsCancellationRequested) break;
- if (string.IsNullOrWhiteSpace(line)) continue;
- var items = line.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
- X2D1PosDto X2D1PosDto = new X2D1PosDto()
- {
- SigTime = DateTime.Now,
- MainCode = 23467,
- AdjaCode = 39206,
- FreqDown = 295.425e6,//For Api Test
- FreqUp = 260.425e6,//For Api Test
- XdDfo = 1529,//For Api Test
- XdSnr = 25,//For Api Test
- SxDfo = 1024,//For Api Test
- SxSnr = 25,//For Api Test
- MainVX = 1,//For Api Test
- MainVY = 1,//For Api Test
- MainVZ = 1,//For Api Test
- AdjaVX = 1,//For Api Test
- AdjaVY = 1,//For Api Test
- AdjaVZ = 1,//For Api Test
- SxDto = Convert.ToDouble(items[0]) * 1e6,
- XdDto = Convert.ToDouble(items[1]) * 1e6,
- MainYbDto = Convert.ToDouble(items[2]) * 1e6,
- AdjaYbDto = Convert.ToDouble(items[3]) * 1e6,
- MainX = Convert.ToDouble(items[7]),
- MainY = Convert.ToDouble(items[8]),
- MainZ = Convert.ToDouble(items[9]),
- AdjaX = Convert.ToDouble(items[10]),
- AdjaY = Convert.ToDouble(items[11]),
- AdjaZ = Convert.ToDouble(items[12]),
- SatTxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "卫星接收天线", "Lon"),
- SatTxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "卫星接收天线", "Lat"),
- CdbTxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "超短波接收天线", "Lon"),
- CdbTxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "超短波接收天线", "Lat"),
- RefLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lon"),
- RefLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lat"),
- };
- var result = await HttpHelper.PostRequestAsync<PosResDto>(url, X2D1PosDto);
- if (result.code != 200)
- {
- Log($"{result.msg}");
- return;
- }
- Thread.Sleep(1000);
- Log($"已向[{txtAddr1.Text}]发送第{idx++}条仿真结果");
- }
- }
- if (tskType == "X2D1NoPar")//两星一地无参定位
- {
- url += "PosX2D1NoParAsync";
- var res = X2D1NoPar();
- var result = await HttpHelper.PostRequestAsync<PosResDto>(url, res);
- if (result.code != 200)
- {
- Log($"{result.msg}");
- return;
- }
- Log($"已向[{txtAddr1.Text}]发送两星一地无参定位仿真结果");
- }
- if (tskType == "RH")//融合定位
- {
- var lines = File.ReadAllLines("Simulation_Data2023.dat");
- int idx = 1;
- url += "PosRHAsync";
- foreach (var line in lines)
- {
- if (cts1.IsCancellationRequested) break;
- if (string.IsNullOrWhiteSpace(line)) continue;
- var items = line.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
- RHPosDto RHPosDto = new RHPosDto()
- {
- SigTime = DateTime.Now,
- MainCode = 23467,
- AdjaCode = 39206,
- SxDto = Convert.ToDouble(items[0]) * 1e6,
- XdDto = Convert.ToDouble(items[1]) * 1e6,
- MainYbDto = Convert.ToDouble(items[2]) * 1e6,
- AdjaYbDto = Convert.ToDouble(items[3]) * 1e6,
- CxRes = Convert.ToDouble(items[4]),
- MainX = Convert.ToDouble(items[7]),
- MainY = Convert.ToDouble(items[8]),
- MainZ = Convert.ToDouble(items[9]),
- AdjaX = Convert.ToDouble(items[10]),
- AdjaY = Convert.ToDouble(items[11]),
- AdjaZ = Convert.ToDouble(items[12]),
- FreqDown = 295.425e6,//For Api Test
- FreqUp = 260.425e6,//For Api Test
- XdDfo = 1529,//For Api Test
- XdSnr = 25,//For Api Test
- SxDfo = 1024,//For Api Test
- SxSnr = 25,//For Api Test
- SatTxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "卫星接收天线", "Lon"),
- SatTxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "卫星接收天线", "Lat"),
- CdbTxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "超短波接收天线", "Lon"),
- CdbTxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "超短波接收天线", "Lat"),
- CxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "侧向站", "Lon"),
- CxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "侧向站", "Lat"),
- RefLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lon"),
- RefLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lat"),
- };
- var result = await HttpHelper.PostRequestAsync<PosResDto>(url, RHPosDto);
- if (result.code != 200)
- {
- Log($"{result.msg}");
- return;
- }
- Thread.Sleep(1000);
- Log($"已向[{txtAddr1.Text}]发送第{idx++}条仿真结果");
- }
- }
- if (tskType == "X3TwoDto")//三星双时差定位
- {
- url += "PosX3TwoDtoAsync";
- var res = X3TwoDto();
- var result = await HttpHelper.PostRequestAsync<PosResDto>(url, res);
- if (result.code != 200)
- {
- Log($"{result.msg}");
- return;
- }
- Log($"已向[{txtAddr1.Text}]发送三星双时差定位仿真结果");
- }
- if (tskType == "X3TwoDtoNoPar")//三星双时差无参定位
- {
- url += "PosX3TwoDtoNoParAsync";
- var res = X3TwoDtoNoPar();
- var result = await HttpHelper.PostRequestAsync<PosResDto>(url, res);
- if (result.code != 200)
- {
- Log($"{result.msg}");
- return;
- }
- Log($"已向[{txtAddr1.Text}]发送三星双时差定位仿真结果");
- }
- if (tskType == "X3TwoDfo")//三星双频差定位
- {
- url += "PosX3TwoDfoAsync";
- var res = X3TwoDfo();
- var result = await HttpHelper.PostRequestAsync<PosResDto>(url, res);
- if (result.code != 200)
- {
- Log($"{result.msg}");
- return;
- }
- Log($"已向[{txtAddr1.Text}]发送三星双频差定位仿真结果");
- }
- if (tskType == "X2Dfo")//双星时频差定位
- {
- url += "PosX2DtoDfoAsync";
- var res = X2Dfo();
- var result = await HttpHelper.PostRequestAsync<PosResDto>(url, res);
- if (result.code != 200)
- {
- Log($"{result.msg}");
- return;
- }
- Log($"已向[{txtAddr1.Text}]发送双星时频差定位仿真结果");
- }
- if (tskType == "X1D1CXNoXL")//一星一地测向定位无星历
- {
- var lines = File.ReadAllLines("Simulation_Data2023.dat");
- int idx = 1;
- url += "PosX1D1NoXlAsync";
- foreach (var line in lines)
- {
- if (cts1.IsCancellationRequested) break;
- if (string.IsNullOrWhiteSpace(line)) continue;
- var items = line.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
- X1D1NoXlPosDto dto = new X1D1NoXlPosDto()
- {
- SigTime = DateTime.Now,
- MainCode = 23467,
- XdDto = Convert.ToDouble(items[1]) * 1e6,
- MainYbDto = Convert.ToDouble(items[2]) * 1e6,
- CxRes = Convert.ToDouble(items[4]),
- SatTxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "卫星接收天线", "Lon"),
- SatTxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "卫星接收天线", "Lat"),
- CdbTxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "超短波接收天线", "Lon"),
- CdbTxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "超短波接收天线", "Lat"),
- CxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "侧向站", "Lon"),
- CxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "侧向站", "Lat"),
- RefLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lon"),
- RefLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lat"),
- FreqDown = 295.425e6,//For Api Test
- FreqUp = 260.425e6,//For Api Test
- XdDfo = 1529,//For Api Test
- XdSnr = 25,//For Api Test
- };
- var result = await HttpHelper.PostRequestAsync<PosResDto>(url, dto);
- if (result.code != 200)
- {
- Log($"{result.msg}");
- return;
- }
- Thread.Sleep(1000);
- Log($"已向[{txtAddr1.Text}]发送第{idx++}条仿真结果");
- }
- }
- if (tskType == "X2D1NoXL")//两星一地定位无星历
- {
- var lines = File.ReadAllLines("Simulation_Data2023.dat");
- int idx = 1;
- url += "PosX2D1NoXlAsync";
- foreach (var line in lines)
- {
- if (cts1.IsCancellationRequested) break;
- if (string.IsNullOrWhiteSpace(line)) continue;
- var items = line.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
- X2D1NoXlPosDto X2D1NoXlPosDto = new X2D1NoXlPosDto()
- {
- SigTime = DateTime.Now,
- MainCode = 23467,
- AdjaCode = 39206,
- SxDto = Convert.ToDouble(items[0]) * 1e6,
- XdDto = Convert.ToDouble(items[1]) * 1e6,
- MainYbDto = Convert.ToDouble(items[2]) * 1e6,
- AdjaYbDto = Convert.ToDouble(items[3]) * 1e6,
- SatTxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "卫星接收天线", "Lon"),
- SatTxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "卫星接收天线", "Lat"),
- CdbTxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "超短波接收天线", "Lon"),
- CdbTxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "超短波接收天线", "Lat"),
- RefLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lon"),
- RefLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lat"),
- FreqDown = 295.425e6,//For Api Test
- FreqUp = 260.425e6,//For Api Test
- XdDfo = 1529,//For Api Test
- XdSnr = 25,//For Api Test
- SxDfo = 1024,//For Api Test
- SxSnr = 25,//For Api Test
- };
- var result = await HttpHelper.PostRequestAsync<PosResDto>(url, X2D1NoXlPosDto);
- if (result.code != 200)
- {
- Log($"{result.msg}");
- return;
- }
- Thread.Sleep(1000);
- Log($"已向[{txtAddr1.Text}]发送第{idx++}条仿真结果");
- }
- }
- if (tskType == "X2D1NoParNoXL")//两星一地无参定位无星历
- {
- url += "PosX2D1NoXlNoParAsync";
- var res = X2D1NoParNoXL();
- var result = await HttpHelper.PostRequestAsync<PosResDto>(url, res);
- if (result.code != 200)
- {
- Log($"{result.msg}");
- return;
- }
- Log($"已向[{txtAddr1.Text}]发送两星一地无参定位仿真结果");
- }
- if (tskType == "RHNoXL")//融合定位无星历
- {
- var lines = File.ReadAllLines("Simulation_Data2023.dat");
- int idx = 1;
- url += "PosRhNoXlAsync";
- foreach (var line in lines)
- {
- if (cts1.IsCancellationRequested) break;
- if (string.IsNullOrWhiteSpace(line)) continue;
- var items = line.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
- RHNoXlPosDto RHNoXlPosDto = new RHNoXlPosDto()
- {
- SigTime = DateTime.Now,
- MainCode = 23467,
- AdjaCode = 39206,
- SxDto = Convert.ToDouble(items[0]) * 1e6,
- XdDto = Convert.ToDouble(items[1]) * 1e6,
- MainYbDto = Convert.ToDouble(items[2]) * 1e6,
- AdjaYbDto = Convert.ToDouble(items[3]) * 1e6,
- CxRes = Convert.ToDouble(items[4]),
- SatTxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "卫星接收天线", "Lon"),
- SatTxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "卫星接收天线", "Lat"),
- CdbTxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "超短波接收天线", "Lon"),
- CdbTxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "超短波接收天线", "Lat"),
- CxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "侧向站", "Lon"),
- CxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "侧向站", "Lat"),
- RefLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lon"),
- RefLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lat"),
- FreqDown = 295.425e6,//For Api Test
- FreqUp = 260.425e6,//For Api Test
- XdDfo = 1529,//For Api Test
- XdSnr = 25,//For Api Test
- SxDfo = 1024,//For Api Test
- SxSnr = 25,//For Api Test
- };
- var result = await HttpHelper.PostRequestAsync<PosResDto>(url, RHNoXlPosDto);
- if (result.code != 200)
- {
- Log($"{result.msg}");
- return;
- }
- Thread.Sleep(1000);
- Log($"已向[{txtAddr1.Text}]发送第{idx++}条仿真结果");
- }
- }
- if (tskType == "X3TwoDtoNoXL")//三星双时差定位无星历
- {
- url += "PosX3TwoDtoNoXlAsync";
- var res = X3TwoDtoNoXL();
- var result = await HttpHelper.PostRequestAsync<PosResDto>(url, res);
- if (result.code != 200)
- {
- Log($"{result.msg}");
- return;
- }
- Log($"已向[{txtAddr1.Text}]发送三星双时差定位仿真结果");
- }
- if (tskType == "X3TwoDtoNoParNoXL")//三星双时差无参定位无星历
- {
- url += "PosX3TwoDtoNoXlNoParAsync";
- var res = X3TwoDtoNoParNoXL();
- var result = await HttpHelper.PostRequestAsync<PosResDto>(url, res);
- if (result.code != 200)
- {
- Log($"{result.msg}");
- return;
- }
- Log($"已向[{txtAddr1.Text}]发送三星双时差定位仿真结果");
- }
- if (tskType == "X3TwoDfoNoXL")//三星双频差定位无星历
- {
- url += "PosX3TwoDfoNoXlAsync";
- var res = X3TwoDfoNoXL();
- var result = await HttpHelper.PostRequestAsync<PosResDto>(url, res);
- if (result.code != 200)
- {
- Log($"{result.msg}");
- return;
- }
- Log($"已向[{txtAddr1.Text}]发送三星双频差定位仿真结果");
- }
- if (tskType == "X2DfoNoXL")//双星时频差定位无星历
- {
- url += "PosX2DtoDfoNoXlAsync";
- var res = X2DfoNoXL();
- var result = await HttpHelper.PostRequestAsync<PosResDto>(url, res);
- if (result.code != 200)
- {
- Log($"{result.msg}");
- return;
- }
- Log($"已向[{txtAddr1.Text}]发送双星时频差定位仿真结果");
- }
- }
- catch (Exception ex)
- {
- Log($"向[{txtAddr1.Text}]发送结果失败.{ex.Message}");
- }
- }
- // await Task.Delay(1000);
- //}
- });
- }
- catch (Exception ex)
- {
- Log(ex);
- }
- finally
- {
- btn1.Text = "推送";
- layoutControlItem1.Enabled = true;
- layoutControlItem7.Enabled = true;
- }
- }
- else
- {
- cts1?.Cancel();
- }
- }
- /// <summary>
- /// 两星一地定位
- /// </summary>
- /// <returns></returns>
- private X2D1PosDto X2D1()
- {
- X2D1PosDto X2D1PosDto = new X2D1PosDto();
- X2D1PosDto.SigTime = DateTime.Now;
- X2D1PosDto.MainCode = 23467;
- X2D1PosDto.AdjaCode = 39206;
- X2D1PosDto.SxDto = 5507.5653;
- X2D1PosDto.XdDto = 240292.558;
- X2D1PosDto.MainYbDto = 0;
- X2D1PosDto.AdjaYbDto = 0;
- X2D1PosDto.MainX = 0;
- X2D1PosDto.MainY = 0;
- X2D1PosDto.MainZ = 0;
- X2D1PosDto.AdjaX = 0;
- X2D1PosDto.AdjaY = 0;
- X2D1PosDto.AdjaZ = 0;
- X2D1PosDto.SatTxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "卫星接收天线", "Lon");
- X2D1PosDto.SatTxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "卫星接收天线", "Lat");
- X2D1PosDto.CdbTxLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "超短波接收天线", "Lon");
- X2D1PosDto.CdbTxLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "超短波接收天线", "Lat");
- X2D1PosDto.RefLon = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lon");
- X2D1PosDto.RefLat = IniFiles.ReadValue<double>("Station_Data2023.ini", "参考站", "Lat");
- return X2D1PosDto;
- }
- /// <summary>
- /// 两星一地定位无参
- /// </summary>
- private X2D1NoParPosDto X2D1NoPar()
- {
- X2D1NoParPosDto X2D1PosDto = new X2D1NoParPosDto()
- {
- SigTime = DateTime.Now,
- MainCode = 25630,
- AdjaCode = 33276,
- SxDto = -0.002198485309353 * 1e6,
- XdDto = 0.245961726007262 * 1e6,
- MainX = -38209016,
- MainY = 17858458,
- MainZ = 13250,
- AdjaX = 4750323,
- AdjaY = 41902879,
- AdjaZ = 50515,
- SatTxLon = 118.8833,
- SatTxLat = 32.0667,
- CdbTxLon = 109.4082,
- CdbTxLat = 18.3878,
- FreqDown = 295.425e6,//For Api Test
- FreqUp = 260.425e6,//For Api Test
- XdDfo = 1529,//For Api Test
- XdSnr = 25,//For Api Test
- SxDfo = 1024,//For Api Test
- SxSnr = 25,//For Api Test
- MainVX = 1,//For Api Test
- MainVY = 1,//For Api Test
- MainVZ = 1,//For Api Test
- AdjaVX = 1,//For Api Test
- AdjaVY = 1,//For Api Test
- AdjaVZ = 1,//For Api Test
- };
- return X2D1PosDto;
- }
- /// <summary>
- /// 三星双时差定位
- /// </summary>
- private X3TwoDtoPosDto X3TwoDto()
- {
- X3TwoDtoPosDto X3TwoDtoPosDto = new X3TwoDtoPosDto()
- {
- SigTime = DateTime.Now,
- MainCode = 23467,
- Adja1Code = 39206,
- Adja2Code = 40892,
- Dto1 = -0.0037683828 * 1e6,
- Dto2 = 0.00411476 * 1e6,
- YbMainDto = 0.253339246 * 1e6,
- YbAdja1Dto = 0.254082015 * 1e6,
- YbAdja2Dto = 0.247747625 * 1e6,
- MainX = -38209016,
- MainY = 17858458,
- MainZ = 13250,
- Adja1X = 4750323,
- Adja1Y = 41902879,
- Adja1Z = 50515,
- Adja2X = -30932433,
- Adja2Y = 28638701,
- Adja2Z = -582065,
- SatTxLon = 118.8833,
- SatTxLat = 32.0667,
- RefLon = 121.538,
- RefLat = 30.8385,
- FreqDown = 295.425e6,//For Api Test
- FreqUp = 260.425e6,//For Api Test
- Dfo1 = 1629,//For Api Test
- Snr1 = 27.1,//For Api Test
- Dfo2 = 1025,//For Api Test
- Snr2 = 27.4,//For Api Test
- };
- return X3TwoDtoPosDto;
- }
- /// <summary>
- /// 三星双时差无参定位
- /// </summary>
- private X3TwoDtoNoParPosDto X3TwoDtoNoPar()
- {
- X3TwoDtoNoParPosDto X3TwoDtoNoParPosDto = new X3TwoDtoNoParPosDto()
- {
- SigTime = DateTime.Now,
- MainCode = 23467,
- Adja1Code = 39206,
- Adja2Code = 40892,
- Dto1 = -0.008361002956792 * 1e6,
- Dto2 = 0.004191941221694 * 1e6,
- MainX = -38214804,
- MainY = 17780164,
- MainZ = -6857,
- Adja1X = 4824458,
- Adja1Y = 41896265,
- Adja1Z = -55899,
- Adja2X = -27105105,
- Adja2Y = 32302912,
- Adja2Z = 11952,
- SatTxLon = 121.3555,
- SatTxLat = 31.3667,
- FreqDown = 295.425e6,//For Api Test
- FreqUp = 260.425e6,//For Api Test
- Dfo1 = 1629,//For Api Test
- Snr1 = 27.1,//For Api Test
- Dfo2 = 1025,//For Api Test
- Snr2 = 27.4,//For Api Test
- MainVX = 1,//For Api Test
- MainVY = 1,//For Api Test
- MainVZ = 1,//For Api Test
- Adja1VX = 1,//For Api Test
- Adja1VY = 1,//For Api Test
- Adja1VZ = 1,//For Api Test
- Adja2VX = 1,//For Api Test
- Adja2VY = 1,//For Api Test
- Adja2VZ = 1,//For Api Test
- };
- return X3TwoDtoNoParPosDto;
- }
- /// <summary>
- /// 三星双频差定位
- /// </summary>
- private X3TwoDfoPosDto X3TwoDfo()
- {
- X3TwoDfoPosDto X3TwoDfoPosDto = new X3TwoDfoPosDto()
- {
- SigTime = DateTime.Now,
- MainCode = 23467,
- Adja1Code = 39206,
- Adja2Code = 40892,
- Dfo1 = -17.601977254734404,
- Dfo2 = -36.885840020369514,
- YbMainDfo = 0,
- YbAdja1Dfo = 17.453698229247941,
- YbAdja2Dfo = 37.022577554138941,
- TarFreqUp = 3808 * 1e6 + 2225 * 1e6,
- TarFreqDown = 3808 * 1e6,
- RefFreqUp = 3796 * 1e6 + 2225 * 1e6,
- RefFreqDown = 3796 * 1e6,
- MainX = -18149981.873274,
- MainY = 38039767.675679,
- MainZ = -5662.335149,
- MainVx = -2.006064,
- MainVy = -1.4693,
- MainVz = 1.62569,
- Adja1X = -14770224.082665,
- Adja1Y = 39479299.786862,
- Adja1Z = -53188.063002,
- Adja1Vx = -1.764989,
- Adja1Vy = -0.528101,
- Adja1Vz = 1.808949,
- Adja2X = -33231255.13,
- Adja2Y = 25948042.76,
- Adja2Z = 27091.80,
- Adja2Vx = -0.607289,
- Adja2Vy = 0.089864,
- Adja2Vz = -0.069086,
- SatTxLon = 116.254567,
- SatTxLat = 39.65955,
- RefLon = 106.698,
- RefLat = 26.567,
- Dto1 = 829.2,//For Api Test
- Snr1 = 27.7,//For Api Test
- Dto2 = 1928.3,//For Api Test
- Snr2 = 27.9,//For Api Test
- };
- return X3TwoDfoPosDto;
- }
- /// <summary>
- /// 双星时频差定位
- /// </summary>
- private X2DtoDfoPosDto X2Dfo()
- {
- X2DtoDfoPosDto X2DtoDfoPosDto = new X2DtoDfoPosDto()
- {
- SigTime = DateTime.Now,
- MainCode = 23467,
- AdjaCode = 39206,
- Dto = -3.587980198938979e-06 * 1e6,
- Dfo = -17.601977254734404,
- YbMainDto = 0.26 * 1e6,
- YbAdjaDto = 0.25993647195 * 1e6,
- YbMainDfo = 0,
- YbAdjaDfo = 17.453698229247941,
- TarFreqUp = 3808 * 1e6 + 2225 * 1e6,
- TarFreqDown = 3808 * 1e6,
- RefFreqUp = 3796 * 1e6 + 2225 * 1e6,
- RefFreqDown = 3796 * 1e6,
- MainX = -18149981.873274,
- MainY = 38039767.675679,
- MainZ = -5662.335149,
- MainVx = -2.006064,
- MainVy = -1.4693,
- MainVz = 1.62569,
- AdjaX = -14770224.082665,
- AdjaY = 39479299.786862,
- AdjaZ = -53188.063002,
- AdjaVx = -1.764989,
- AdjaVy = -0.528101,
- AdjaVz = 1.808949,
- SatTxLon = 116.254567,
- SatTxLat = 39.65955,
- RefLon = 106.698,
- RefLat = 26.567,
- Snr = 19.27,//For Api Test
- };
- return X2DtoDfoPosDto;
- }
- /// <summary>
- /// 两星一地定位无参无星历
- /// </summary>
- private X2D1NoXlNoParlPosDto X2D1NoParNoXL()
- {
- X2D1NoXlNoParlPosDto X2D1NoXlNoParlPosDto = new X2D1NoXlNoParlPosDto();
- X2D1NoXlNoParlPosDto.SigTime = DateTime.Now;
- X2D1NoXlNoParlPosDto.MainCode = 25630;
- X2D1NoXlNoParlPosDto.AdjaCode = 33276;
- X2D1NoXlNoParlPosDto.SxDto = -0.002198485309353 * 1e6;
- X2D1NoXlNoParlPosDto.XdDto = 0.245961726007262 * 1e6;
- X2D1NoXlNoParlPosDto.SatTxLon = 118.8833;
- X2D1NoXlNoParlPosDto.SatTxLat = 32.0667;
- X2D1NoXlNoParlPosDto.CdbTxLon = 109.4082;
- X2D1NoXlNoParlPosDto.CdbTxLat = 18.3878;
- return X2D1NoXlNoParlPosDto;
- }
- /// <summary>
- /// 三星双时差定位无星历
- /// </summary>
- private X3TwoDtoNoXlPosDto X3TwoDtoNoXL()
- {
- X3TwoDtoNoXlPosDto X3TwoDtoNoXlPosDto = new X3TwoDtoNoXlPosDto();
- X3TwoDtoNoXlPosDto.SigTime = DateTime.Now;
- X3TwoDtoNoXlPosDto.MainCode = 23467;
- X3TwoDtoNoXlPosDto.Adja1Code = 39206;
- X3TwoDtoNoXlPosDto.Adja2Code = 40892;
- X3TwoDtoNoXlPosDto.Dto1 = -0.0037683828 * 1e6;
- X3TwoDtoNoXlPosDto.Dto2 = 0.00411476 * 1e6;
- X3TwoDtoNoXlPosDto.YbMainDto = 0.253339246 * 1e6;
- X3TwoDtoNoXlPosDto.YbAdja1Dto = 0.254082015 * 1e6;
- X3TwoDtoNoXlPosDto.YbAdja2Dto = 0.247747625 * 1e6;
- X3TwoDtoNoXlPosDto.SatTxLon = 118.8833;
- X3TwoDtoNoXlPosDto.SatTxLat = 32.0667;
- X3TwoDtoNoXlPosDto.RefLon = 121.538;
- X3TwoDtoNoXlPosDto.RefLat = 30.8385;
- return X3TwoDtoNoXlPosDto;
- }
- /// <summary>
- /// 三星双时差无参定位无星历
- /// </summary>
- private X3TwoDtoNoXlNoParPosDto X3TwoDtoNoParNoXL()
- {
- X3TwoDtoNoXlNoParPosDto X3TwoDtoNoParPosDto = new X3TwoDtoNoXlNoParPosDto()
- {
- SigTime = DateTime.Now,
- MainCode = 23467,
- Adja1Code = 39206,
- Adja2Code = 40892,
- Dto1 = -0.008361002956792 * 1e6,
- Dto2 = 0.004191941221694 * 1e6,
- SatTxLon = 121.3555,
- SatTxLat = 31.3667,
- };
- return X3TwoDtoNoParPosDto;
- }
- /// <summary>
- /// 三星双频差定位无星历
- /// </summary>
- private X3TwoDfoNoXlPosDto X3TwoDfoNoXL()
- {
- X3TwoDfoNoXlPosDto X3TwoDfoNoXlPosDto = new X3TwoDfoNoXlPosDto()
- {
- SigTime = DateTime.Now,
- MainCode = 23467,
- Adja1Code = 39206,
- Adja2Code = 40892,
- Dfo1 = -17.601977254734404,
- Dfo2 = -36.885840020369514,
- YbMainDfo = 0,
- YbAdja1Dfo = 17.453698229247941,
- YbAdja2Dfo = 37.022577554138941,
- TarFreqUp = 3808 * 1e6 + 2225 * 1e6,
- TarFreqDown = 3808 * 1e6,
- RefFreqUp = 3796 * 1e6 + 2225 * 1e6,
- RefFreqDown = 3796 * 1e6,
- SatTxLon = 116.254567,
- SatTxLat = 39.65955,
- RefLon = 106.698,
- RefLat = 26.567,
- };
- return X3TwoDfoNoXlPosDto;
- }
- /// <summary>
- /// 双星时频差定位无星历
- /// </summary>
- private X2DtoDfoNoXlPosDto X2DfoNoXL()
- {
- X2DtoDfoNoXlPosDto X2DtoDfoNoXlPosDto = new X2DtoDfoNoXlPosDto()
- {
- SigTime = DateTime.Now,
- MainCode = 23467,
- AdjaCode = 39206,
- Dto = -3.587980198938979e-06 * 1e6,
- Dfo = -17.601977254734404,
- YbMainDto = 0.26 * 1e6,
- YbAdjaDto = 0.25993647195 * 1e6,
- YbMainDfo = 0,
- YbAdjaDfo = 17.453698229247941,
- TarFreqUp = 3808 * 1e6 + 2225 * 1e6,
- TarFreqDown = 3808 * 1e6,
- RefFreqUp = 3796 * 1e6 + 2225 * 1e6,
- RefFreqDown = 3796 * 1e6,
- SatTxLon = 116.254567,
- SatTxLat = 39.65955,
- RefLon = 106.698,
- RefLat = 26.567,
- Snr = 20 + new Random().Next(-5, 15)
- };
- return X2DtoDfoNoXlPosDto;
- }
- private void Log(string msg)
- {
- try
- {
- if (this.InvokeRequired)
- {
- this.Invoke(new Action(() =>
- {
- if (listBoxControl1.ItemCount > 5000)
- listBoxControl1.Items.Clear();
- listBoxControl1.Items.Insert(0, $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}--{msg}");
- listBoxControl1.SelectedIndex = 0;
- }));
- }
- else
- {
- if (listBoxControl1.ItemCount > 5000)
- listBoxControl1.Items.Clear();
- listBoxControl1.Items.Insert(0, $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}--{msg}");
- listBoxControl1.SelectedIndex = 0;
- }
- }
- catch
- { }
- }
- private void Log(Exception ex)
- {
- try
- {
- if (this.InvokeRequired)
- {
- this.Invoke(new Action(() =>
- {
- if (listBoxControl1.ItemCount > 5000)
- listBoxControl1.Items.Clear();
- listBoxControl1.Items.Insert(0, $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}--{ex.Message}");
- listBoxControl1.SelectedIndex = 0;
- }));
- }
- else
- {
- if (listBoxControl1.ItemCount > 5000)
- listBoxControl1.Items.Clear();
- listBoxControl1.Items.Insert(0, $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}--{ex.Message}");
- listBoxControl1.SelectedIndex = 0;
- }
- }
- catch
- { }
- }
- private void listBoxControl1_MouseClick(object sender, MouseEventArgs e)
- {
- if (e.Button == MouseButtons.Right)
- {
- popupMenu1.ShowPopup(MousePosition);
- }
- }
- private void btnClear_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
- {
- listBoxControl1.Items.Clear();
- }
- private void btnCopyAll_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
- {
- StringBuilder sb = new StringBuilder();
- foreach (var item in listBoxControl1.Items)
- {
- sb.AppendLine(item.ToString());
- }
- var data = sb.ToString();
- if (string.IsNullOrWhiteSpace(data)) return;
- Clipboard.SetText(sb.ToString());
- }
- }
- }
|