|
@@ -0,0 +1,934 @@
|
|
|
+#include "simulationcontrol.h"
|
|
|
+
|
|
|
+SimulationControl::SimulationControl(QObject *parent) : QObject(parent)
|
|
|
+{
|
|
|
+ // 添加场景平台
|
|
|
+ allyplane.push_back(new Platform(this, 1001, QString::fromLocal8Bit("干扰机_1"),120,27,8000,-200,200,-300));
|
|
|
+ allyplane.push_back(new Platform(this, 1002, QString::fromLocal8Bit("干扰机_2"),120.3,27,8000,-200,200,-300));
|
|
|
+ allyplane.push_back(new Platform(this, 1003, QString::fromLocal8Bit("干扰机_3"),120,27.3,8000,-200,200,-300));
|
|
|
+ allyplane.push_back(new Platform(this, 1004, QString::fromLocal8Bit("干扰机_4"),120.3,27.3,8000,-200,200,-300));
|
|
|
+
|
|
|
+ allymissile.push_back(new Platform(this, 2001, QString::fromLocal8Bit("弹道导弹1"),117,33,0));
|
|
|
+ allymissile.push_back(new Platform(this, 2001, QString::fromLocal8Bit("弹道导弹2"),117,33,0));
|
|
|
+ allymissile.push_back(new Platform(this, 2001, QString::fromLocal8Bit("弹道导弹3"),117,33,0));
|
|
|
+ allymissile.push_back(new Platform(this, 2001, QString::fromLocal8Bit("弹道导弹4"),117,33,0));
|
|
|
+
|
|
|
+ ally.push_back(allyplane);
|
|
|
+ ally.push_back(allymissile);
|
|
|
+
|
|
|
+ enemyradar.push_back(new Platform(this,6001,QString::fromLocal8Bit("Thaad系统1"),120,20,0));
|
|
|
+ enemyradar.push_back(new Platform(this,6002,QString::fromLocal8Bit("Thaad系统2"),122,20,0));
|
|
|
+
|
|
|
+ enemy.push_back(enemyradar);
|
|
|
+ enemy.push_back(enemysat);
|
|
|
+
|
|
|
+ // 添加雷达模拟器
|
|
|
+ Radar *radar1 = new Radar(this, 6001, 12, true, QString::fromLocal8Bit("AN-TPY/2雷达-1"),
|
|
|
+ QStringLiteral("ws://localhost:1235"));
|
|
|
+ Radar *radar2 = new Radar(this, 6002, 13, false, QString::fromLocal8Bit("AN-TPY/2雷达-2"),
|
|
|
+ QStringLiteral("ws://localhost:1236"));
|
|
|
+// connect(this,&SimulationControl::SigRadarStyleUpdate,
|
|
|
+// radar1,&Radar::StyleUpdate);
|
|
|
+// connect(this,&SimulationControl::SigRadarStyleUpdate,
|
|
|
+// radar2,&Radar::StyleUpdate);
|
|
|
+ enemyThaadRadarSim.insert(std::pair<int, Radar*>(12, radar1));
|
|
|
+ enemyThaadRadarSim.insert(std::pair<int, Radar*>(13, radar2));
|
|
|
+
|
|
|
+
|
|
|
+ // 添加干扰机
|
|
|
+ allyJammingSim.insert(std::pair<int, Jamming*>
|
|
|
+ (20, new Jamming(this, 1001, 20, true, QString::fromLocal8Bit("干扰器1"))));
|
|
|
+ allyJammingSim.insert(std::pair<int, Jamming*>
|
|
|
+ (21, new Jamming(this, 1002, 21, true, QString::fromLocal8Bit("干扰器1"))));
|
|
|
+ allyJammingSim.insert(std::pair<int, Jamming*>
|
|
|
+ (22, new Jamming(this, 1003, 22, true, QString::fromLocal8Bit("干扰器1"))));
|
|
|
+ allyJammingSim.insert(std::pair<int, Jamming*>
|
|
|
+ (23, new Jamming(this, 1004, 23, true, QString::fromLocal8Bit("干扰器1"))));
|
|
|
+}
|
|
|
+
|
|
|
+void SimulationControl::SlotGetInit(QWebSocket *pSender, QJsonObject obj)
|
|
|
+{
|
|
|
+ qDebug() << "Build with Slot";
|
|
|
+ QJsonObject *InitState = new QJsonObject();
|
|
|
+ InitState->insert("InitState", 100);
|
|
|
+
|
|
|
+ QJsonObject *ret = new QJsonObject();
|
|
|
+ ret->insert("url", obj.value("url"));
|
|
|
+ ret->insert("data", *InitState);
|
|
|
+ delete InitState;
|
|
|
+
|
|
|
+ emit SigReturnData(pSender, ret);
|
|
|
+}
|
|
|
+
|
|
|
+void SimulationControl::SlotGetLeadPost(QWebSocket *pSender, QJsonObject obj)
|
|
|
+{
|
|
|
+ QJsonArray *LeadPost = new QJsonArray();
|
|
|
+
|
|
|
+ QJsonObject *CurrentLeadPost;
|
|
|
+
|
|
|
+ CurrentLeadPost = new QJsonObject();
|
|
|
+ CurrentLeadPost->insert("time", "20:20:01");
|
|
|
+ CurrentLeadPost->insert("GroupID", "0001");
|
|
|
+ CurrentLeadPost->insert("LeaderID", "8013");
|
|
|
+ CurrentLeadPost->insert("Abstract", QString::fromLocal8Bit("发现雷达"));
|
|
|
+ LeadPost->append(*CurrentLeadPost);
|
|
|
+ delete CurrentLeadPost;
|
|
|
+ CurrentLeadPost = new QJsonObject();
|
|
|
+ CurrentLeadPost->insert("time", "20:20:30");
|
|
|
+ CurrentLeadPost->insert("GroupID", "0001");
|
|
|
+ CurrentLeadPost->insert("LeaderID", "8013");
|
|
|
+ CurrentLeadPost->insert("Abstract", QString::fromLocal8Bit("请求施加干扰"));
|
|
|
+ LeadPost->append(*CurrentLeadPost);
|
|
|
+ delete CurrentLeadPost;
|
|
|
+ CurrentLeadPost = new QJsonObject();
|
|
|
+ CurrentLeadPost->insert("time", "20:20:40");
|
|
|
+ CurrentLeadPost->insert("GroupID", "0003");
|
|
|
+ CurrentLeadPost->insert("LeaderID", "8014");
|
|
|
+ CurrentLeadPost->insert("Abstract", QString::fromLocal8Bit("干扰样式生成"));
|
|
|
+ LeadPost->append(*CurrentLeadPost);
|
|
|
+ delete CurrentLeadPost;
|
|
|
+ CurrentLeadPost = new QJsonObject();
|
|
|
+ CurrentLeadPost->insert("time", "20:21:00");
|
|
|
+ CurrentLeadPost->insert("GroupID", "0002");
|
|
|
+ CurrentLeadPost->insert("LeaderID", "8015");
|
|
|
+ CurrentLeadPost->insert("Abstract", QString::fromLocal8Bit("干扰信号发射"));
|
|
|
+ LeadPost->append(*CurrentLeadPost);
|
|
|
+ delete CurrentLeadPost;
|
|
|
+
|
|
|
+ QJsonObject *ret = new QJsonObject();
|
|
|
+ ret->insert("url", obj.value("url"));
|
|
|
+ ret->insert("PlatformID", obj.value("PlatformID"));
|
|
|
+ ret->insert("data", *LeadPost);
|
|
|
+
|
|
|
+ delete LeadPost;
|
|
|
+ emit SigReturnData(pSender, ret);
|
|
|
+}
|
|
|
+
|
|
|
+void SimulationControl::SlotGetTaskPlan(QWebSocket *pSender, QJsonObject obj)
|
|
|
+{
|
|
|
+ QJsonObject *TaskPlan = new QJsonObject();
|
|
|
+
|
|
|
+ QJsonObject *CurrentAirLine;
|
|
|
+ QJsonObject *CurrentTaskPlan;
|
|
|
+
|
|
|
+ CurrentAirLine = new QJsonObject;
|
|
|
+ CurrentAirLine->insert("TargetArea", 3);
|
|
|
+ CurrentAirLine->insert("Longitude", 123);
|
|
|
+ CurrentAirLine->insert("Longitude", 27);
|
|
|
+ CurrentAirLine->insert("Radius", 300000);
|
|
|
+
|
|
|
+ CurrentTaskPlan = new QJsonObject;
|
|
|
+ CurrentTaskPlan->insert("TargetArea", 2);
|
|
|
+ CurrentTaskPlan->insert("ThrowGas", 2);
|
|
|
+ CurrentTaskPlan->insert("ThrowBT", 2);
|
|
|
+
|
|
|
+ TaskPlan->insert("Airline", *CurrentAirLine);
|
|
|
+ TaskPlan->insert("TaskPlan", *CurrentTaskPlan);
|
|
|
+
|
|
|
+ QJsonObject *ret = new QJsonObject();
|
|
|
+ ret->insert("url", obj.value("url"));
|
|
|
+ ret->insert("PlatformID", obj.value("PlatformID"));
|
|
|
+ ret->insert("data", *TaskPlan);
|
|
|
+
|
|
|
+ delete TaskPlan;
|
|
|
+ delete CurrentAirLine;
|
|
|
+ delete CurrentTaskPlan;
|
|
|
+ emit SigReturnData(pSender, ret);
|
|
|
+}
|
|
|
+void SimulationControl::SlotGetGlobalMap(QWebSocket *pSender, QJsonObject obj)
|
|
|
+{
|
|
|
+ QJsonObject GlobalMap;
|
|
|
+
|
|
|
+// QJsonObject *alies = new QJsonObject();
|
|
|
+// QJsonObject *enemys = new QJsonObject();
|
|
|
+ QJsonObject allies;
|
|
|
+ QJsonObject enemys;
|
|
|
+
|
|
|
+ for (int i=0; i < ally.size(); i++)
|
|
|
+ {
|
|
|
+ QJsonArray allyNow;
|
|
|
+ for (auto j: ally.at(i))
|
|
|
+ {
|
|
|
+ QJsonArray temparray = {j->lon, j->lat, j->h};
|
|
|
+
|
|
|
+ QJsonObject tempObject
|
|
|
+ {
|
|
|
+ {"name", j->Name},
|
|
|
+ {"value", temparray}
|
|
|
+ };
|
|
|
+
|
|
|
+ allyNow.append(tempObject);
|
|
|
+ }
|
|
|
+ if (i == 0)
|
|
|
+ {
|
|
|
+ allies.insert("Planes", allyNow);
|
|
|
+ }
|
|
|
+ else if (i == 1)
|
|
|
+ {
|
|
|
+ allies.insert("Missiles",allyNow);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i=0; i < enemy.size(); i++)
|
|
|
+ {
|
|
|
+ QJsonArray enemyNow;
|
|
|
+ for (auto j: enemy.at(i))
|
|
|
+ {
|
|
|
+ QJsonArray temparray = {j->lon, j->lat, j->h};
|
|
|
+
|
|
|
+ QJsonObject tempObject
|
|
|
+ {
|
|
|
+ {"name", j->Name},
|
|
|
+ {"value", temparray}
|
|
|
+ };
|
|
|
+ enemyNow.append(tempObject);
|
|
|
+ }
|
|
|
+ if (i == 0)
|
|
|
+ {
|
|
|
+ enemys.insert("Radars", enemyNow);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ GlobalMap.insert("friend", QJsonValue(allies));
|
|
|
+ GlobalMap.insert("enemy", QJsonValue(enemys));
|
|
|
+ QJsonObject *ret = new QJsonObject();
|
|
|
+ ret->insert("url", obj.value("url"));
|
|
|
+ ret->insert("PlatformID", obj.value("PlatformID"));
|
|
|
+ ret->insert("data",QJsonValue(GlobalMap));
|
|
|
+ emit SigReturnData(pSender, ret);
|
|
|
+}
|
|
|
+
|
|
|
+void SimulationControl::SlotGetPlatformTable(QWebSocket *pSender, QJsonObject obj)
|
|
|
+{
|
|
|
+ QJsonArray Platforms;
|
|
|
+
|
|
|
+ for (int i = 0; i < ally.size(); i++)
|
|
|
+ {
|
|
|
+ std::vector<Platform *> allyplatforms = ally.at(i);
|
|
|
+ if (i == 0)
|
|
|
+ {
|
|
|
+ for (auto j : allyplatforms)
|
|
|
+ {
|
|
|
+ QJsonObject SinglePlatform
|
|
|
+ {
|
|
|
+ {"platformID", QString::number(j->ID)},
|
|
|
+ {"platformName", j->Name}
|
|
|
+ };
|
|
|
+
|
|
|
+ Platforms.append(SinglePlatform);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ QJsonObject *ret = new QJsonObject();
|
|
|
+ ret->insert("url", obj.value("url"));
|
|
|
+ ret->insert("data",QJsonValue(Platforms));
|
|
|
+
|
|
|
+ emit SigReturnData(pSender, ret);
|
|
|
+}
|
|
|
+void SimulationControl::SlotGetInstanceTable(QWebSocket *pSender, QJsonObject obj)
|
|
|
+{
|
|
|
+ QJsonArray *Instances = new QJsonArray();
|
|
|
+ QJsonObject *SingleInstance;
|
|
|
+ if (true)
|
|
|
+ {
|
|
|
+ SingleInstance = new QJsonObject();
|
|
|
+ SingleInstance->insert("instanceID", 22);
|
|
|
+ SingleInstance->insert("instanceName", QString::fromLocal8Bit("侦察机_1"));
|
|
|
+ Instances->append(*SingleInstance);
|
|
|
+ delete SingleInstance;
|
|
|
+
|
|
|
+ SingleInstance = new QJsonObject();
|
|
|
+ SingleInstance->insert("instanceID", 62);
|
|
|
+ SingleInstance->insert("instanceName", QString::fromLocal8Bit("信号侦察_1"));
|
|
|
+ Instances->append(*SingleInstance);
|
|
|
+ delete SingleInstance;
|
|
|
+
|
|
|
+ SingleInstance = new QJsonObject();
|
|
|
+ SingleInstance->insert("instanceID", 96);
|
|
|
+ SingleInstance->insert("instanceName", QString::fromLocal8Bit("体系增量_1"));
|
|
|
+ Instances->append(*SingleInstance);
|
|
|
+ delete SingleInstance;
|
|
|
+
|
|
|
+ SingleInstance = new QJsonObject();
|
|
|
+ SingleInstance->insert("instanceID", 111);
|
|
|
+ SingleInstance->insert("instanceName", QString::fromLocal8Bit("侦察平台任务系统_1"));
|
|
|
+ Instances->append(*SingleInstance);
|
|
|
+ delete SingleInstance;
|
|
|
+
|
|
|
+ SingleInstance = new QJsonObject();
|
|
|
+ SingleInstance->insert("instanceID", 171);
|
|
|
+ SingleInstance->insert("instanceName", QString::fromLocal8Bit("导航_1"));
|
|
|
+ Instances->append(*SingleInstance);
|
|
|
+ delete SingleInstance;
|
|
|
+ }
|
|
|
+ QJsonObject *ret = new QJsonObject();
|
|
|
+ ret->insert("url", obj.value("url"));
|
|
|
+ ret->insert("PlatformID", obj.value("PlatformID"));
|
|
|
+ ret->insert("data",QJsonValue(*Instances));
|
|
|
+ delete Instances;
|
|
|
+ emit SigReturnData(pSender, ret);
|
|
|
+}
|
|
|
+
|
|
|
+void SimulationControl::SlotGetRadarInstances(QWebSocket *pSender, QJsonObject obj)
|
|
|
+{
|
|
|
+ int nowPlatform = obj.value("PlatformID").toInt();
|
|
|
+
|
|
|
+ QJsonArray RadarInstances;
|
|
|
+
|
|
|
+ for (auto i : enemyThaadRadarSim)
|
|
|
+ {
|
|
|
+ QJsonObject tempThaad;
|
|
|
+
|
|
|
+ if (1 || nowPlatform == i.second->PlatformID)
|
|
|
+ {
|
|
|
+ tempThaad.insert("instanceID", QString::number(i.first));
|
|
|
+ tempThaad.insert("instanceName",i.second->Name);
|
|
|
+ if (i.second->SwitchMode)
|
|
|
+ {
|
|
|
+ tempThaad.insert("instanceState", QString::fromLocal8Bit("开机"));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempThaad.insert("instanceState", QString::fromLocal8Bit("关机"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ RadarInstances.append(tempThaad);
|
|
|
+ }
|
|
|
+
|
|
|
+ QJsonObject *ret = new QJsonObject();
|
|
|
+ ret->insert("url", obj.value("url"));
|
|
|
+ ret->insert("PlatformID", obj.value("PlatformID"));
|
|
|
+ ret->insert("data",QJsonValue(RadarInstances));
|
|
|
+
|
|
|
+ emit SigReturnData(pSender, ret);
|
|
|
+}
|
|
|
+
|
|
|
+void SimulationControl::SlotGetRadarParams(QWebSocket *pSender, QJsonObject obj)
|
|
|
+{
|
|
|
+
|
|
|
+ int nowInstance = obj.value("InstanceID").toString().toInt();
|
|
|
+
|
|
|
+ Radar *nowRadar = enemyThaadRadarSim.at(nowInstance);
|
|
|
+
|
|
|
+ if (nowRadar == nullptr)
|
|
|
+ {
|
|
|
+ QJsonObject *ret = new QJsonObject();
|
|
|
+ ret->insert("url", obj.value("url"));
|
|
|
+ ret->insert("PlatformID", obj.value("PlatformID"));
|
|
|
+ ret->insert("InstanceID", obj.value("InstanceID"));
|
|
|
+ ret->insert("data",QJsonValue());
|
|
|
+
|
|
|
+ emit SigReturnData(pSender, ret);
|
|
|
+ }
|
|
|
+ else if (true || nowRadar->PlatformID == obj.value("PlatformID").toInt())
|
|
|
+ {
|
|
|
+ int styleIdx = nowRadar->style;
|
|
|
+ qDebug() << styleIdx;
|
|
|
+ Style nowStyle = nowRadar->RadarStyleList.at(styleIdx);
|
|
|
+
|
|
|
+ QJsonObject nowfs {
|
|
|
+ {"key", QString::fromLocal8Bit("采样频率")},
|
|
|
+ {"value", nowStyle.fs}
|
|
|
+ };
|
|
|
+ QJsonObject nowfc {
|
|
|
+ {"key", QString::fromLocal8Bit("载波频率")},
|
|
|
+ {"value", nowStyle.fc}
|
|
|
+ };
|
|
|
+ QJsonObject nowModuType {
|
|
|
+ {"key", QString::fromLocal8Bit("调制类型")},
|
|
|
+ {"value", nowStyle.moduType}
|
|
|
+ };
|
|
|
+ QJsonObject nowPRFMode {
|
|
|
+ {"key", QString::fromLocal8Bit("PRF模式")},
|
|
|
+ {"value", nowStyle.PRFMode}
|
|
|
+ };
|
|
|
+ QJsonArray PRFarray;
|
|
|
+ for (auto i : nowStyle.PRFs)
|
|
|
+ {
|
|
|
+ PRFarray.push_back(i);
|
|
|
+ }
|
|
|
+ QJsonObject nowPRF
|
|
|
+ {
|
|
|
+ {"key", QString::fromLocal8Bit("PRF")},
|
|
|
+ {"value", PRFarray}
|
|
|
+ };
|
|
|
+ QJsonObject nowPW
|
|
|
+ {
|
|
|
+ {"key", QString::fromLocal8Bit("脉冲宽度")},
|
|
|
+ {"value", nowStyle.PulseWidth}
|
|
|
+ };
|
|
|
+ QJsonObject nowBW
|
|
|
+ {
|
|
|
+ {"key", QString::fromLocal8Bit("带宽")},
|
|
|
+ {"value", nowStyle.BandWidth}
|
|
|
+ };
|
|
|
+
|
|
|
+ QJsonArray nowParams = {nowfs, nowfc, nowModuType, nowPRFMode, nowPRF, nowPW, nowBW};
|
|
|
+
|
|
|
+ QJsonObject initMaxDis {
|
|
|
+ {"key", QString::fromLocal8Bit("最大量程")},
|
|
|
+ {"value", 800000}
|
|
|
+ };
|
|
|
+ QJsonObject initMinDis {
|
|
|
+ {"key", QString::fromLocal8Bit("最小量程")},
|
|
|
+ {"value", 1000}
|
|
|
+ };
|
|
|
+ QJsonObject initMaxFre {
|
|
|
+ {"key", QString::fromLocal8Bit("最大频率")},
|
|
|
+ {"value", 12e9}
|
|
|
+ };
|
|
|
+ QJsonObject initMinFre {
|
|
|
+ {"key", QString::fromLocal8Bit("最大频率")},
|
|
|
+ {"value", 8e9}
|
|
|
+ };
|
|
|
+ QJsonObject initNumArrayElement {
|
|
|
+ {"key", QString::fromLocal8Bit("阵元数")},
|
|
|
+ {"value", 25344}
|
|
|
+ };
|
|
|
+ QJsonObject initGain {
|
|
|
+ {"key", QString::fromLocal8Bit("天线增益")},
|
|
|
+ {"value", 48.77}
|
|
|
+ };
|
|
|
+ QJsonObject initPt {
|
|
|
+ {"key", QString::fromLocal8Bit("发射机功率")},
|
|
|
+ {"value", 405e3}
|
|
|
+ };
|
|
|
+ QJsonArray initParams = {initMaxDis, initMinDis, initMaxFre, initMinFre, initNumArrayElement, initGain, initPt};
|
|
|
+ QJsonObject retParams {
|
|
|
+ {"InitParams", initParams},
|
|
|
+ {"CtrlParams", nowParams}
|
|
|
+ };
|
|
|
+
|
|
|
+ QJsonObject *ret = new QJsonObject({
|
|
|
+ {"url", obj.value("url")},
|
|
|
+ {"PlatformID", obj.value("PlatformID")},
|
|
|
+ {"InstanceID", obj.value("InstanceID")},
|
|
|
+ {"data",QJsonValue(retParams)}
|
|
|
+ });
|
|
|
+
|
|
|
+ emit SigReturnData(pSender, ret);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void SimulationControl::SlotGetThaadInstances(QWebSocket *pSender, QJsonObject obj)
|
|
|
+{
|
|
|
+ QJsonArray RadarInstances;
|
|
|
+
|
|
|
+ for (auto i : enemyThaadRadarSim)
|
|
|
+ {
|
|
|
+ QJsonObject tempThaad;
|
|
|
+
|
|
|
+ if (1)
|
|
|
+ {
|
|
|
+ tempThaad.insert("instanceID", QString::number(i.first));
|
|
|
+ tempThaad.insert("instanceName",i.second->Name);
|
|
|
+ if (i.second->SwitchMode)
|
|
|
+ {
|
|
|
+ tempThaad.insert("instanceState", QString::fromLocal8Bit("开机"));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempThaad.insert("instanceState", QString::fromLocal8Bit("关机"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ RadarInstances.append(tempThaad);
|
|
|
+ }
|
|
|
+
|
|
|
+ QJsonObject *ret = new QJsonObject();
|
|
|
+ ret->insert("url", obj.value("url"));
|
|
|
+ ret->insert("PlatformID", obj.value("PlatformID"));
|
|
|
+ ret->insert("data",QJsonValue(RadarInstances));
|
|
|
+
|
|
|
+ emit SigReturnData(pSender, ret);
|
|
|
+}
|
|
|
+
|
|
|
+void SimulationControl::SlotGetThaadParams(QWebSocket *pSender, QJsonObject obj)
|
|
|
+{
|
|
|
+
|
|
|
+ int nowInstance = obj.value("InstanceID").toString().toInt();
|
|
|
+
|
|
|
+ Radar *nowRadar = enemyThaadRadarSim.at(nowInstance);
|
|
|
+
|
|
|
+ if (nowRadar == nullptr)
|
|
|
+ {
|
|
|
+ QJsonObject *ret = new QJsonObject();
|
|
|
+ ret->insert("url", obj.value("url"));
|
|
|
+ ret->insert("PlatformID", obj.value("PlatformID"));
|
|
|
+ ret->insert("InstanceID", obj.value("InstanceID"));
|
|
|
+ ret->insert("data",QJsonValue());
|
|
|
+
|
|
|
+ emit SigReturnData(pSender, ret);
|
|
|
+ }
|
|
|
+ else if (true || nowRadar->PlatformID == obj.value("PlatformID").toInt())
|
|
|
+ {
|
|
|
+ int styleIdx = nowRadar->style;
|
|
|
+ qDebug() << styleIdx;
|
|
|
+ Style nowStyle = nowRadar->RadarStyleList.at(styleIdx);
|
|
|
+
|
|
|
+ QJsonObject nowfs {
|
|
|
+ {"key", QString::fromLocal8Bit("采样频率")},
|
|
|
+ {"value", nowStyle.fs}
|
|
|
+ };
|
|
|
+ QJsonObject nowfc {
|
|
|
+ {"key", QString::fromLocal8Bit("载波频率")},
|
|
|
+ {"value", nowStyle.fc}
|
|
|
+ };
|
|
|
+ QJsonObject nowModuType {
|
|
|
+ {"key", QString::fromLocal8Bit("调制类型")},
|
|
|
+ {"value", nowStyle.moduType}
|
|
|
+ };
|
|
|
+ QJsonObject nowPRFMode {
|
|
|
+ {"key", QString::fromLocal8Bit("PRF模式")},
|
|
|
+ {"value", nowStyle.PRFMode}
|
|
|
+ };
|
|
|
+ QJsonArray PRFarray;
|
|
|
+ for (auto i : nowStyle.PRFs)
|
|
|
+ {
|
|
|
+ PRFarray.push_back(i);
|
|
|
+ }
|
|
|
+ QJsonObject nowPRF
|
|
|
+ {
|
|
|
+ {"key", QString::fromLocal8Bit("PRF")},
|
|
|
+ {"value", PRFarray}
|
|
|
+ };
|
|
|
+ QJsonObject nowPW
|
|
|
+ {
|
|
|
+ {"key", QString::fromLocal8Bit("脉冲宽度")},
|
|
|
+ {"value", nowStyle.PulseWidth}
|
|
|
+ };
|
|
|
+ QJsonObject nowBW
|
|
|
+ {
|
|
|
+ {"key", QString::fromLocal8Bit("带宽")},
|
|
|
+ {"value", nowStyle.BandWidth}
|
|
|
+ };
|
|
|
+
|
|
|
+ QJsonArray nowParams = {nowfs, nowfc, nowModuType, nowPRFMode, nowPRF, nowPW, nowBW};
|
|
|
+
|
|
|
+ QJsonObject initMaxDis {
|
|
|
+ {"key", QString::fromLocal8Bit("最大量程")},
|
|
|
+ {"value", 800000}
|
|
|
+ };
|
|
|
+ QJsonObject initMinDis {
|
|
|
+ {"key", QString::fromLocal8Bit("最小量程")},
|
|
|
+ {"value", 1000}
|
|
|
+ };
|
|
|
+ QJsonObject initMaxFre {
|
|
|
+ {"key", QString::fromLocal8Bit("最大频率")},
|
|
|
+ {"value", 12e9}
|
|
|
+ };
|
|
|
+ QJsonObject initMinFre {
|
|
|
+ {"key", QString::fromLocal8Bit("最大频率")},
|
|
|
+ {"value", 8e9}
|
|
|
+ };
|
|
|
+ QJsonObject initNumArrayElement {
|
|
|
+ {"key", QString::fromLocal8Bit("阵元数")},
|
|
|
+ {"value", 25344}
|
|
|
+ };
|
|
|
+ QJsonObject initGain {
|
|
|
+ {"key", QString::fromLocal8Bit("天线增益")},
|
|
|
+ {"value", 48.77}
|
|
|
+ };
|
|
|
+ QJsonObject initPt {
|
|
|
+ {"key", QString::fromLocal8Bit("发射机功率")},
|
|
|
+ {"value", 405e3}
|
|
|
+ };
|
|
|
+ QJsonArray initParams = {initMaxDis, initMinDis, initMaxFre, initMinFre, initNumArrayElement, initGain, initPt};
|
|
|
+ QJsonObject retParams {
|
|
|
+ {"InitParams", initParams},
|
|
|
+ {"CtrlParams", nowParams}
|
|
|
+ };
|
|
|
+
|
|
|
+ QJsonObject *ret = new QJsonObject({
|
|
|
+ {"url", obj.value("url")},
|
|
|
+ {"PlatformID", obj.value("PlatformID")},
|
|
|
+ {"InstanceID", obj.value("InstanceID")},
|
|
|
+ {"data",QJsonValue(retParams)}
|
|
|
+ });
|
|
|
+
|
|
|
+ emit SigReturnData(pSender, ret);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void SimulationControl::SlotSetThaadStyle(QWebSocket *pSender, QJsonObject obj)
|
|
|
+{
|
|
|
+ // PlatformID和InstanceID是字符串
|
|
|
+ int nowPlatform = obj.value("PlatformID").toString().toInt();
|
|
|
+ int nowInstance = obj.value("InstanceID").toString().toInt();
|
|
|
+ QJsonObject nowdata = obj.value("data").toObject();
|
|
|
+ if (nowdata.contains("Style"))
|
|
|
+ {
|
|
|
+ // Style索引是整型
|
|
|
+ int nowStyle = nowdata.value("Style").toInt();
|
|
|
+// qDebug() << nowPlatform <<" "<< nowInstance << " " << nowStyle;
|
|
|
+
|
|
|
+ Radar *nowRadar = enemyThaadRadarSim.at(nowInstance);
|
|
|
+ if (nowRadar == nullptr)
|
|
|
+ {
|
|
|
+ QJsonObject *ret = new QJsonObject();
|
|
|
+ ret->insert("url", obj.value("url"));
|
|
|
+ ret->insert("PlatformID", obj.value("PlatformID"));
|
|
|
+ ret->insert("InstanceID", obj.value("InstanceID"));
|
|
|
+ ret->insert("data", QJsonValue(""));
|
|
|
+
|
|
|
+ emit SigReturnData(pSender, ret);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ nowRadar->StyleUpdate(nowStyle);
|
|
|
+
|
|
|
+ int styleIdx = nowRadar->style;
|
|
|
+ qDebug() << styleIdx;
|
|
|
+ Style nowStyle = nowRadar->RadarStyleList.at(styleIdx);
|
|
|
+
|
|
|
+ QJsonObject nowfs {
|
|
|
+ {"key", QString::fromLocal8Bit("采样频率")},
|
|
|
+ {"value", nowStyle.fs}
|
|
|
+ };
|
|
|
+ QJsonObject nowfc {
|
|
|
+ {"key", QString::fromLocal8Bit("载波频率")},
|
|
|
+ {"value", nowStyle.fc}
|
|
|
+ };
|
|
|
+ QJsonObject nowModuType {
|
|
|
+ {"key", QString::fromLocal8Bit("调制类型")},
|
|
|
+ {"value", nowStyle.moduType}
|
|
|
+ };
|
|
|
+ QJsonObject nowPRFMode {
|
|
|
+ {"key", QString::fromLocal8Bit("PRF模式")},
|
|
|
+ {"value", nowStyle.PRFMode}
|
|
|
+ };
|
|
|
+ QJsonArray PRFarray;
|
|
|
+ for (auto i : nowStyle.PRFs)
|
|
|
+ {
|
|
|
+ PRFarray.push_back(i);
|
|
|
+ }
|
|
|
+ QJsonObject nowPRF
|
|
|
+ {
|
|
|
+ {"key", QString::fromLocal8Bit("PRF")},
|
|
|
+ {"value", PRFarray}
|
|
|
+ };
|
|
|
+ QJsonObject nowPW
|
|
|
+ {
|
|
|
+ {"key", QString::fromLocal8Bit("脉冲宽度")},
|
|
|
+ {"value", nowStyle.PulseWidth}
|
|
|
+ };
|
|
|
+ QJsonObject nowBW
|
|
|
+ {
|
|
|
+ {"key", QString::fromLocal8Bit("带宽")},
|
|
|
+ {"value", nowStyle.BandWidth}
|
|
|
+ };
|
|
|
+
|
|
|
+ QJsonArray nowParams = {nowfs, nowfc, nowModuType, nowPRFMode, nowPRF, nowPW, nowBW};
|
|
|
+
|
|
|
+ QJsonObject initMaxDis {
|
|
|
+ {"key", QString::fromLocal8Bit("最大量程")},
|
|
|
+ {"value", 800000}
|
|
|
+ };
|
|
|
+ QJsonObject initMinDis {
|
|
|
+ {"key", QString::fromLocal8Bit("最小量程")},
|
|
|
+ {"value", 1000}
|
|
|
+ };
|
|
|
+ QJsonObject initMaxFre {
|
|
|
+ {"key", QString::fromLocal8Bit("最大频率")},
|
|
|
+ {"value", 12e9}
|
|
|
+ };
|
|
|
+ QJsonObject initMinFre {
|
|
|
+ {"key", QString::fromLocal8Bit("最大频率")},
|
|
|
+ {"value", 8e9}
|
|
|
+ };
|
|
|
+ QJsonObject initNumArrayElement {
|
|
|
+ {"key", QString::fromLocal8Bit("阵元数")},
|
|
|
+ {"value", 25344}
|
|
|
+ };
|
|
|
+ QJsonObject initGain {
|
|
|
+ {"key", QString::fromLocal8Bit("天线增益")},
|
|
|
+ {"value", 48.77}
|
|
|
+ };
|
|
|
+ QJsonObject initPt {
|
|
|
+ {"key", QString::fromLocal8Bit("发射机功率")},
|
|
|
+ {"value", 405e3}
|
|
|
+ };
|
|
|
+ QJsonArray initParams = {initMaxDis, initMinDis, initMaxFre, initMinFre, initNumArrayElement, initGain, initPt};
|
|
|
+ QJsonObject retParams {
|
|
|
+ {"InitParams", initParams},
|
|
|
+ {"CtrlParams", nowParams}
|
|
|
+ };
|
|
|
+
|
|
|
+ QJsonObject *ret = new QJsonObject({
|
|
|
+ {"url", obj.value("url")},
|
|
|
+ {"PlatformID", obj.value("PlatformID")},
|
|
|
+ {"InstanceID", obj.value("InstanceID")},
|
|
|
+ {"data",QJsonValue(retParams)}
|
|
|
+ });
|
|
|
+
|
|
|
+ emit SigReturnData(pSender, ret);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void SimulationControl::SlotGetJammingInstances(QWebSocket *pSender, QJsonObject obj)
|
|
|
+{
|
|
|
+ int nowPlatform = obj.value("PlatformID").toInt();
|
|
|
+
|
|
|
+ QJsonArray JammingInstances;
|
|
|
+
|
|
|
+ for (auto i : allyJammingSim)
|
|
|
+ {
|
|
|
+ QJsonObject tempJamming;
|
|
|
+
|
|
|
+ if (true || nowPlatform == i.second->PlatformID)
|
|
|
+ {
|
|
|
+ tempJamming.insert("instanceID", QString::number(i.first));
|
|
|
+ tempJamming.insert("instanceName",i.second->Name);
|
|
|
+ if (i.second->SwitchMode)
|
|
|
+ {
|
|
|
+ tempJamming.insert("instanceState", QString::fromLocal8Bit("开机"));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempJamming.insert("instanceState", QString::fromLocal8Bit("关机"));
|
|
|
+ }
|
|
|
+
|
|
|
+ JammingInstances.append(tempJamming);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ QJsonObject *ret = new QJsonObject();
|
|
|
+ ret->insert("url", obj.value("url"));
|
|
|
+ ret->insert("PlatformID", obj.value("PlatformID"));
|
|
|
+ ret->insert("data",QJsonValue(JammingInstances));
|
|
|
+
|
|
|
+ emit SigReturnData(pSender, ret);
|
|
|
+}
|
|
|
+
|
|
|
+void SimulationControl::SlotGetJammingParams(QWebSocket *pSender, QJsonObject obj)
|
|
|
+{
|
|
|
+ int nowInstance = obj.value("InstanceID").toInt();
|
|
|
+
|
|
|
+ Radar *nowRadar = enemyThaadRadarSim.at(nowInstance);
|
|
|
+
|
|
|
+ if (true || nowRadar->PlatformID == obj.value("PlatformID").toInt())
|
|
|
+ {
|
|
|
+ int styleIdx = nowRadar->style;
|
|
|
+ Style nowStyle = nowRadar->RadarStyleList.at(styleIdx);
|
|
|
+
|
|
|
+ QJsonObject nowfs
|
|
|
+ {
|
|
|
+ {"key", QString::fromLocal8Bit("采样频率")},
|
|
|
+ {"value", nowStyle.fs}
|
|
|
+ };
|
|
|
+ QJsonObject nowfc
|
|
|
+ {
|
|
|
+ {"key", QString::fromLocal8Bit("载波频率")},
|
|
|
+ {"value", nowStyle.fc}
|
|
|
+ };
|
|
|
+ QJsonObject nowModuType
|
|
|
+ {
|
|
|
+ {"key", QString::fromLocal8Bit("调制类型")},
|
|
|
+ {"value", nowStyle.moduType}
|
|
|
+ };
|
|
|
+ QJsonObject nowPRFMode
|
|
|
+ {
|
|
|
+ {"key", QString::fromLocal8Bit("PRF模式")},
|
|
|
+ {"value", nowStyle.PRFMode}
|
|
|
+ };
|
|
|
+ QJsonArray PRFarray;
|
|
|
+ for (auto i : nowStyle.PRFs)
|
|
|
+ {
|
|
|
+ PRFarray.push_back(i);
|
|
|
+ }
|
|
|
+ QJsonObject nowPRF
|
|
|
+ {
|
|
|
+ {"key", QString::fromLocal8Bit("PRF")},
|
|
|
+ {"value", PRFarray}
|
|
|
+ };
|
|
|
+ QJsonObject nowPW
|
|
|
+ {
|
|
|
+ {"key", QString::fromLocal8Bit("脉冲宽度")},
|
|
|
+ {"value", nowStyle.PulseWidth}
|
|
|
+ };
|
|
|
+ QJsonObject nowBW
|
|
|
+ {
|
|
|
+ {"key", QString::fromLocal8Bit("带宽")},
|
|
|
+ {"value", nowStyle.BandWidth}
|
|
|
+ };
|
|
|
+
|
|
|
+ QJsonArray nowParams = {nowfs, nowfc, nowModuType, nowPRFMode, nowPRF, nowPW, nowBW};
|
|
|
+
|
|
|
+ QJsonObject *ret = new QJsonObject();
|
|
|
+ ret->insert("url", obj.value("url"));
|
|
|
+ ret->insert("PlatformID", obj.value("PlatformID"));
|
|
|
+ ret->insert("InstanceID", obj.value("InstanceID"));
|
|
|
+ ret->insert("data",QJsonValue(nowParams));
|
|
|
+
|
|
|
+ emit SigReturnData(pSender, ret);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+void SimulationControl::SlotGetESMParams(QWebSocket *pSender, QJsonObject obj)
|
|
|
+{
|
|
|
+ int InstanceID = obj.value("InstanceID").toInt();
|
|
|
+
|
|
|
+ QJsonArray *ESMInitParams;
|
|
|
+ QJsonArray *ESMCtrlParams;
|
|
|
+ QJsonObject *ESMPropTemp;
|
|
|
+
|
|
|
+ if (true)
|
|
|
+ {
|
|
|
+ ESMInitParams = new QJsonArray();
|
|
|
+ ESMCtrlParams = new QJsonArray();
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","fBeamAzWidth");
|
|
|
+ ESMPropTemp->insert("value",2);
|
|
|
+ ESMInitParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","fBeamElWidth");
|
|
|
+ ESMPropTemp->insert("value",2);
|
|
|
+ ESMInitParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","fTecMinFreqMhz");
|
|
|
+ ESMPropTemp->insert("value",2e3);
|
|
|
+ ESMInitParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","fTecMaxFreqMhz");
|
|
|
+ ESMPropTemp->insert("value",18e3);
|
|
|
+ ESMInitParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","fInstantPageWidMhz");
|
|
|
+ ESMPropTemp->insert("value",500);
|
|
|
+ ESMInitParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","ulChanNum");
|
|
|
+ ESMPropTemp->insert("value",64);
|
|
|
+ ESMInitParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","fTecMinPW");
|
|
|
+ ESMPropTemp->insert("value",0.5);
|
|
|
+ ESMInitParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","fTecMaxPW");
|
|
|
+ ESMPropTemp->insert("value",10);
|
|
|
+ ESMInitParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","fTecPriMean");
|
|
|
+ ESMPropTemp->insert("value",40);
|
|
|
+ ESMInitParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","ulTecTrNumMean");
|
|
|
+ ESMPropTemp->insert("value",5);
|
|
|
+ ESMInitParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","fMinSnrdB");
|
|
|
+ ESMPropTemp->insert("value",0.5);
|
|
|
+ ESMInitParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","fSysRcvLoss");
|
|
|
+ ESMPropTemp->insert("value",5);
|
|
|
+ ESMInitParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","fFreqAccuracyReq");
|
|
|
+ ESMPropTemp->insert("value",100);
|
|
|
+ ESMInitParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","uRrPowerOn");
|
|
|
+ ESMPropTemp->insert("value",0);
|
|
|
+ ESMCtrlParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","uRrWorkMode");
|
|
|
+ ESMPropTemp->insert("value",0);
|
|
|
+ ESMCtrlParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","dScanAzCentDeg");
|
|
|
+ ESMPropTemp->insert("value",0);
|
|
|
+ ESMCtrlParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","dScanAzWidthDeg");
|
|
|
+ ESMPropTemp->insert("value",5);
|
|
|
+ ESMCtrlParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","dScanElCentDeg");
|
|
|
+ ESMPropTemp->insert("value",0);
|
|
|
+ ESMCtrlParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","uLineNumPerFrame");
|
|
|
+ ESMPropTemp->insert("value",20);
|
|
|
+ ESMCtrlParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","fAntScanVel");
|
|
|
+ ESMPropTemp->insert("value",1);
|
|
|
+ ESMCtrlParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","fFreqScanVel");
|
|
|
+ ESMPropTemp->insert("value",100);
|
|
|
+ ESMCtrlParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","fTecBeginFreqMhz");
|
|
|
+ ESMPropTemp->insert("value",500);
|
|
|
+ ESMCtrlParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+
|
|
|
+ ESMPropTemp = new QJsonObject();
|
|
|
+ ESMPropTemp->insert("key","fTecEndFreqMhz");
|
|
|
+ ESMPropTemp->insert("value",10000);
|
|
|
+ ESMCtrlParams->append(*ESMPropTemp);
|
|
|
+ delete ESMPropTemp;
|
|
|
+ }
|
|
|
+ QJsonObject *ESMParams = new QJsonObject();
|
|
|
+ ESMParams->insert("InitParams", *ESMInitParams);
|
|
|
+ ESMParams->insert("CtrlParams", *ESMCtrlParams);
|
|
|
+
|
|
|
+ QJsonObject *ret = new QJsonObject();
|
|
|
+ ret->insert("url", obj.value("url"));
|
|
|
+ ret->insert("PlatformID", obj.value("PlatformID"));
|
|
|
+ ret->insert("InstanceID", InstanceID);
|
|
|
+ ret->insert("data", *ESMParams);
|
|
|
+ emit SigReturnData(pSender, ret);
|
|
|
+
|
|
|
+ delete ESMInitParams;
|
|
|
+ delete ESMCtrlParams;
|
|
|
+ delete ESMParams;
|
|
|
+}
|