1423 lines
46 KiB
C++
Executable File
1423 lines
46 KiB
C++
Executable File
#include "XNATA04DataProcessor.h"
|
||
#include "XNATA04DataProcessor_p.h"
|
||
#include <XNCore/XNModelManager.h>
|
||
#include <XNCore/XNDDSManager.h>
|
||
#include <QMutexLocker>
|
||
|
||
XN_DLL_INITIALIZE(XNATA04DataProcessor)
|
||
XN_REGISTER_PARTICIPANT_BEGIN(XNATA04DataProcessor)
|
||
XN_PUBLISHTOPIC(XNSim::ATA04::Aerodynamics_input)
|
||
XN_PUBLISHTOPIC(XNSim::ATA04::WeightBalance_input)
|
||
XN_PUBLISHTOPIC(XNSim::ATA04::GroundHandling_input)
|
||
XN_SUBSCRIBETOPIC(XNSim::ATA04::WeightBalance_output, &XNATA04DataProcessor::OnWbOutput)
|
||
XN_SUBSCRIBETOPIC(XNSim::ATA04::GroundHandling_output, &XNATA04DataProcessor::OnGhOutput)
|
||
XN_SUBSCRIBETOPIC(XNSim::ATA04::Aerodynamics_output, &XNATA04DataProcessor::OnAeroOutput)
|
||
XN_SUBSCRIBETOPIC(XNSim::ATA04::Aerodynamics_heartbeat, &XNATA04DataProcessor::OnAeroHeartbeat)
|
||
XN_SUBSCRIBETOPIC(XNSim::ATA04::WeightBalance_heartbeat, &XNATA04DataProcessor::OnWbHeartbeat)
|
||
XN_SUBSCRIBETOPIC(XNSim::ATA04::GroundHandling_heartbeat, &XNATA04DataProcessor::OnGhHeartbeat)
|
||
XN_REGISTER_PARTICIPANT_END(XNATA04DataProcessor)
|
||
|
||
XNATA04DataProcessor::XNATA04DataProcessor(QObject *parent)
|
||
: XNModelObject(*new XNATA04DataProcessorPrivate(this), parent)
|
||
{
|
||
}
|
||
|
||
XNATA04DataProcessor::~XNATA04DataProcessor()
|
||
{
|
||
}
|
||
|
||
XNATA04DataProcessor::XNATA04DataProcessor(XNATA04DataProcessorPrivate &dd, QObject *parent)
|
||
: XNModelObject(dd, parent)
|
||
{
|
||
}
|
||
|
||
void XNATA04DataProcessor::OnInitialize()
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
XNModelObject::OnInitialize();
|
||
}
|
||
|
||
void XNATA04DataProcessor::OnPrepareForExecute()
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
XNModelObject::OnPrepareForExecute();
|
||
RegisterRTEventHandler("ATA04AeroInput", std::bind(&XNATA04DataProcessor::OnAeroInput, this,
|
||
std::placeholders::_1));
|
||
RegisterRTEventHandler(
|
||
"ATA04WbInput", std::bind(&XNATA04DataProcessor::OnWbInput, this, std::placeholders::_1));
|
||
RegisterRTEventHandler(
|
||
"ATA04GhInput", std::bind(&XNATA04DataProcessor::OnGhInput, this, std::placeholders::_1));
|
||
}
|
||
|
||
void XNATA04DataProcessor::StepUpdate()
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
XNModelObject::StepUpdate();
|
||
SendUdpData();
|
||
SendUdpTestData();
|
||
}
|
||
|
||
void XNATA04DataProcessor::SendUdpData()
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
SendAeroOutput();
|
||
SendWbOutput();
|
||
SendGhOutput();
|
||
SendAeroHeartbeat();
|
||
SendWbHeartbeat();
|
||
SendGhHeartbeat();
|
||
}
|
||
|
||
void XNATA04DataProcessor::SendAeroOutput()
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
QMutexLocker locker(&d->_aeroOutputMutex);
|
||
QByteArray outputData;
|
||
QDataStream outputStream(&outputData, QIODevice::WriteOnly);
|
||
outputStream.setByteOrder(QDataStream::LittleEndian);
|
||
quint8 header[5] = {0x0a, 0x04, 0x00, 0x01, 0x00};
|
||
outputStream << header[0]; //报头1,表示由系统发出
|
||
outputStream << header[1]; //报头2,表示气动,0x04表示ATA04
|
||
outputStream << header[2]; //报头3,表示模型,0x00表示气动
|
||
outputStream << header[3]; //报头4,表示数据类型,0x01表示输出
|
||
outputStream << header[4]; //报头5,表示数据长度
|
||
//outputData.append(getQByteArray(d->_aeroOutput.l_04_o_aerocomac_fxb_f8()));
|
||
if (d->_aeroOutput.l_04_o_aerocomac_fxb_f8()) {
|
||
outputStream << d->_aeroOutput.l_04_o_aerocomac_fxb_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_aeroOutput.l_04_o_aerocomac_fyb_f8()) {
|
||
outputStream << d->_aeroOutput.l_04_o_aerocomac_fyb_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_aeroOutput.l_04_o_aerocomac_fzb_f8()) {
|
||
outputStream << d->_aeroOutput.l_04_o_aerocomac_fzb_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_aeroOutput.l_04_o_aerocomac_mxb_f8()) {
|
||
outputStream << d->_aeroOutput.l_04_o_aerocomac_mxb_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_aeroOutput.l_04_o_aerocomac_myb_f8()) {
|
||
outputStream << d->_aeroOutput.l_04_o_aerocomac_myb_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_aeroOutput.l_04_o_aerocomac_mzb_f8()) {
|
||
outputStream << d->_aeroOutput.l_04_o_aerocomac_mzb_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_aeroOutput.l_04_o_aerocomac_cls_f8()) {
|
||
outputStream << d->_aeroOutput.l_04_o_aerocomac_cls_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_aeroOutput.l_04_o_aerocomac_cl_f8()) {
|
||
outputStream << d->_aeroOutput.l_04_o_aerocomac_cl_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_aeroOutput.l_04_o_aerocomac_cd_f8()) {
|
||
outputStream << d->_aeroOutput.l_04_o_aerocomac_cd_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_aeroOutput.l_04_o_aerocomac_cm_f8()) {
|
||
outputStream << d->_aeroOutput.l_04_o_aerocomac_cm_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_aeroOutput.l_04_o_aerocomac_cr_f8()) {
|
||
outputStream << d->_aeroOutput.l_04_o_aerocomac_cr_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_aeroOutput.l_04_o_aerocomac_cy_f8()) {
|
||
outputStream << d->_aeroOutput.l_04_o_aerocomac_cy_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
|
||
if (d->_aeroOutput.l_04_o_aerocomac_cn_f8()) {
|
||
outputStream << d->_aeroOutput.l_04_o_aerocomac_cn_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
outputData[4] = outputData.size();
|
||
TriggerRTEvent("SendUDPData", QVariant::fromValue(outputData));
|
||
}
|
||
|
||
void XNATA04DataProcessor::SendGhOutput()
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
QMutexLocker locker(&d->_ghOutputMutex);
|
||
QByteArray outputData;
|
||
QDataStream outputStream(&outputData, QIODevice::WriteOnly);
|
||
outputStream.setByteOrder(QDataStream::LittleEndian);
|
||
quint8 header[5] = {0x0a, 0x04, 0x01, 0x01, 0x00};
|
||
outputStream << header[0]; //报头1,表示由系统发出
|
||
outputStream << header[1]; //报头2,表示气动,0x04表示ATA04
|
||
outputStream << header[2]; //报头3,表示模型,0x01表示地操模型
|
||
outputStream << header[3]; //报头4,表示数据类型,0x01表示输出
|
||
outputStream << header[4]; //报头5,表示数据长度
|
||
if (d->_ghOutput.l_04_o_gdcomac_frz_l1()) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_frz_l1().value();
|
||
} else {
|
||
outputStream << (quint8)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_ac_on_ground_l1()) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_ac_on_ground_l1().value();
|
||
} else {
|
||
outputStream << (quint8)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_ac_stationary_f8()) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_ac_stationary_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_alt_tire_f8()) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_alt_tire_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_zcg_to_tire_f8()) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_zcg_to_tire_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_fxb_f8()) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_fxb_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_fyb_f8()) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_fyb_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_fzb_f8()) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_fzb_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_mxb_f8()) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_mxb_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_myb_f8()) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_myb_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_mzb_f8()) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_mzb_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_fygs_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_fygs_f8().value()[i];
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_mzgs_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_mzgs_f8().value()[i];
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_mu_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_mu_f8().value()[i];
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_dstroke_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_dstroke_f8().value()[i];
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_sr_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_sr_f8().value()[i][j];
|
||
}
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_sy_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_sy_f8().value()[i][j];
|
||
}
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_sx_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_sx_f8().value()[i][j];
|
||
}
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_xft_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_xft_f8().value()[i];
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_yft_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_yft_f8().value()[i];
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_zft_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_zft_f8().value()[i];
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_distngrxcg_f8()) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_distngrxcg_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_distmgrxcg_f8()) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_distmgrxcg_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_distmgrzcg_f8()) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_distmgrzcg_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_tire_vel_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_tire_vel_f8().value()[i][j];
|
||
}
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_tire_temp_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_tire_temp_f8().value()[i][j];
|
||
}
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_tire_burst_l1()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_tire_burst_l1().value()[i][j];
|
||
}
|
||
}
|
||
} else {
|
||
outputStream << (quint8)0 << (quint8)0 << (quint8)0 << (quint8)0 << (quint8)0 << (quint8)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_wow_l1()) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_wow_l1().value();
|
||
} else {
|
||
outputStream << (quint8)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_utirew_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_utirew_f8().value()[i][j];
|
||
}
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_vtirew_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_vtirew_f8().value()[i][j];
|
||
}
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_whl_omega_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_whl_omega_f8().value()[i][j];
|
||
}
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_dstruc_f8()) {
|
||
for (int i = 0; i < 6; i++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_dstruc_f8().value()[i];
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_nd_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_nd_f8().value()[i];
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_wor_par_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_wor_par_f8().value()[i];
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_ghOutput.l_04_o_gdcomac_vczt_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
outputStream << d->_ghOutput.l_04_o_gdcomac_vczt_f8().value()[i][j];
|
||
}
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0 << (double)0 << (double)0 << (double)0;
|
||
}
|
||
outputData[4] = outputData.size();
|
||
TriggerRTEvent("SendUDPData", QVariant::fromValue(outputData));
|
||
}
|
||
|
||
void XNATA04DataProcessor::SendWbOutput()
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
QMutexLocker locker(&d->_wbOutputMutex);
|
||
QByteArray outputData;
|
||
QDataStream outputStream(&outputData, QIODevice::WriteOnly);
|
||
outputStream.setByteOrder(QDataStream::LittleEndian);
|
||
quint8 header[5] = {0x0a, 0x04, 0x02, 0x01, 0x00};
|
||
outputStream << header[0]; //报头1,表示由系统发出
|
||
outputStream << header[1]; //报头2,表示气动,0x04表示ATA04
|
||
outputStream << header[2]; //报头3,表示模型,0x02表示质量模型
|
||
outputStream << header[3]; //报头4,表示数据类型,0x01表示输出
|
||
outputStream << header[4]; //报头5,表示数据长度
|
||
if (d->_wbOutput.l_04_o_wbcomac_gw_f4()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_gw_f4().value();
|
||
} else {
|
||
outputStream << (float)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_cg_f4()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_cg_f4().value();
|
||
} else {
|
||
outputStream << (float)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_xcg_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_xcg_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_blcg_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_blcg_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_bscg_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_bscg_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_wlcg_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_wlcg_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_ixx_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_ixx_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_iyy_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_iyy_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_izz_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_izz_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_ixy_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_ixy_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_ixz_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_ixz_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_iyz_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_iyz_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_zfw_f4()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_zfw_f4().value();
|
||
} else {
|
||
outputStream << (float)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_zfwcg_f4()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_zfwcg_f4().value();
|
||
} else {
|
||
outputStream << (float)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_zfw_blcg_f4()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_zfw_blcg_f4().value();
|
||
} else {
|
||
outputStream << (float)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_zfw_wlcg_f4()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_zfw_wlcg_f4().value();
|
||
} else {
|
||
outputStream << (float)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_fuel_cmd_f8()) {
|
||
for (int i = 0; i < 3; i++) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_fuel_cmd_f8().value()[i];
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0 << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_fuel_mode_i4()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_fuel_mode_i4().value();
|
||
} else {
|
||
outputStream << (int)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_fuel_ixx_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_fuel_ixx_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_fuel_ixy_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_fuel_ixy_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_fuel_ixz_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_fuel_ixz_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_fuel_iyy_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_fuel_iyy_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_fuel_iyz_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_fuel_iyz_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_fuel_izz_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_fuel_izz_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_l_wt_fuel_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_l_wt_fuel_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_ice_airframe_total_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_airframe_total_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_ice_eng_f8()) {
|
||
for (int i = 0; i < 2; i++) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_eng_f8().value()[i];
|
||
}
|
||
} else {
|
||
outputStream << (double)0 << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_ice_eng_total_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_eng_total_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_ice_fuselage_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_fuselage_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_ice_stab_left_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_stab_left_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_ice_stab_right_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_stab_right_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_ice_stab_total_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_stab_total_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_ice_total_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_total_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_ice_total_frac_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_total_frac_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_ice_vert_tail_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_vert_tail_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_ice_wing_left_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_wing_left_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_ice_wing_right_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_wing_right_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_ice_wing_total_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_ice_wing_total_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_frz_l1()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_frz_l1().value();
|
||
} else {
|
||
outputStream << (quint8)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_zcgfrz_l1()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_zcgfrz_l1().value();
|
||
} else {
|
||
outputStream << (quint8)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_zcgfrz_grfx_l1()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_zcgfrz_grfx_l1().value();
|
||
} else {
|
||
outputStream << (quint8)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_ycgfrz_l1()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_ycgfrz_l1().value();
|
||
} else {
|
||
outputStream << (quint8)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_inertfrz_l1()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_inertfrz_l1().value();
|
||
} else {
|
||
outputStream << (quint8)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_init_l1()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_init_l1().value();
|
||
} else {
|
||
outputStream << (quint8)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_min_gw_f4()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_min_gw_f4().value();
|
||
} else {
|
||
outputStream << (float)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_max_gw_f4()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_max_gw_f4().value();
|
||
} else {
|
||
outputStream << (float)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_min_cg_f4()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_min_cg_f4().value();
|
||
} else {
|
||
outputStream << (float)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_max_cg_f4()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_max_cg_f4().value();
|
||
} else {
|
||
outputStream << (float)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_min_zfw_f4()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_min_zfw_f4().value();
|
||
} else {
|
||
outputStream << (float)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_max_zfw_f4()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_max_zfw_f4().value();
|
||
} else {
|
||
outputStream << (float)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_min_zfwcg_f4()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_min_zfwcg_f4().value();
|
||
} else {
|
||
outputStream << (float)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_max_zfwcg_f4()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_max_zfwcg_f4().value();
|
||
} else {
|
||
outputStream << (float)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_potmin_gw_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_potmin_gw_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_potmax_gw_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_potmax_gw_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_potmin_gwcg_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_potmin_gwcg_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
if (d->_wbOutput.l_04_o_wbcomac_potmax_gwcg_f8()) {
|
||
outputStream << d->_wbOutput.l_04_o_wbcomac_potmax_gwcg_f8().value();
|
||
} else {
|
||
outputStream << (double)0;
|
||
}
|
||
outputData[4] = outputData.size();
|
||
TriggerRTEvent("SendUDPData", QVariant::fromValue(outputData));
|
||
}
|
||
|
||
void XNATA04DataProcessor::SendAeroHeartbeat()
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
QMutexLocker locker(&d->_aeroHeartbeatMutex);
|
||
QByteArray heartbeatData;
|
||
QDataStream heartbeatStream(&heartbeatData, QIODevice::WriteOnly);
|
||
heartbeatStream.setByteOrder(QDataStream::LittleEndian);
|
||
quint8 header[5] = {0x0a, 0x04, 0x00, 0x02, 0x00};
|
||
heartbeatStream << header[0]; //报头1,表示由系统发出
|
||
heartbeatStream << header[1]; //报头2,表示气动,0x04表示ATA04
|
||
heartbeatStream << header[2]; //报头3,表示模型,0x00表示气动
|
||
heartbeatStream << header[3]; //报头4,表示数据类型,0x02表示心跳
|
||
heartbeatStream << header[4]; //报头5,表示数据长度
|
||
heartbeatStream << d->_aeroHeartbeat.aero_model_heartbeat();
|
||
heartbeatData[4] = heartbeatData.size();
|
||
TriggerRTEvent("SendUDPData", QVariant::fromValue(heartbeatData));
|
||
}
|
||
|
||
void XNATA04DataProcessor::SendGhHeartbeat()
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
QMutexLocker locker(&d->_ghHeartbeatMutex);
|
||
QByteArray heartbeatData;
|
||
QDataStream heartbeatStream(&heartbeatData, QIODevice::WriteOnly);
|
||
heartbeatStream.setByteOrder(QDataStream::LittleEndian);
|
||
quint8 header[5] = {0x0a, 0x04, 0x01, 0x02, 0x00};
|
||
heartbeatStream << header[0]; //报头1,表示由系统发出
|
||
heartbeatStream << header[1]; //报头2,表示气动,0x04表示ATA04
|
||
heartbeatStream << header[2]; //报头3,表示模型,0x01表示地操
|
||
heartbeatStream << header[3]; //报头4,表示数据类型,0x02表示心跳
|
||
heartbeatStream << header[4]; //报头5,表示数据长度
|
||
heartbeatStream << d->_ghHeartbeat.groundhandling_model_heartbeat();
|
||
heartbeatData[4] = heartbeatData.size();
|
||
TriggerRTEvent("SendUDPData", QVariant::fromValue(heartbeatData));
|
||
}
|
||
|
||
void XNATA04DataProcessor::SendWbHeartbeat()
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
QMutexLocker locker(&d->_wbHeartbeatMutex);
|
||
QByteArray heartbeatData;
|
||
QDataStream heartbeatStream(&heartbeatData, QIODevice::WriteOnly);
|
||
heartbeatStream.setByteOrder(QDataStream::LittleEndian);
|
||
quint8 header[5] = {0x0a, 0x04, 0x02, 0x02, 0x00};
|
||
heartbeatStream << header[0]; //报头1,表示由系统发出
|
||
heartbeatStream << header[1]; //报头2,表示气动,0x04表示ATA04
|
||
heartbeatStream << header[2]; //报头3,表示模型,0x02表示质量
|
||
heartbeatStream << header[3]; //报头4,表示数据类型,0x02表示心跳
|
||
heartbeatStream << header[4]; //报头5,表示数据长度
|
||
heartbeatStream << d->_wbHeartbeat.weightbody_model_heartbeat();
|
||
heartbeatData[4] = heartbeatData.size();
|
||
TriggerRTEvent("SendUDPData", QVariant::fromValue(heartbeatData));
|
||
}
|
||
|
||
void XNATA04DataProcessor::OnWbInput(const QVariant &data)
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
QByteArray inputData = data.toByteArray();
|
||
if (inputData.size() <= 5 || inputData[0] != 0x0b || inputData[1] != 0x04
|
||
|| inputData[2] != 0x02 || inputData[3] != 0x00 || inputData[4] != inputData.size()) {
|
||
LOG_WARNING("ATA04DataProcessor::OnWbInput: invalid input data");
|
||
return;
|
||
}
|
||
QDataStream inputStream(&inputData, QIODevice::ReadOnly);
|
||
inputStream.setByteOrder(QDataStream::LittleEndian);
|
||
for (int i = 0; i < 5; i++) {
|
||
char tmp;
|
||
inputStream >> tmp;
|
||
}
|
||
QMutexLocker locker(&d->_wbInputMutex);
|
||
double dTmp;
|
||
inputStream >> dTmp;
|
||
d->_wbInput.l_04_i_wbcomac_theta_deg_f8(dTmp);
|
||
inputStream >> dTmp;
|
||
d->_wbInput.l_04_i_wbcomac_phi_deg_f8(dTmp);
|
||
inputStream >> dTmp;
|
||
d->_wbInput.l_04_i_wbcomac_psi_deg_f8(dTmp);
|
||
quint8 ucTmp;
|
||
inputStream >> ucTmp;
|
||
d->_wbInput.l_04_i_wbcomac_gear_mode_l1(ucTmp);
|
||
inputStream >> dTmp;
|
||
d->_wbInput.l_04_i_wbcomac_acset_gw_f8(dTmp);
|
||
inputStream >> dTmp;
|
||
d->_wbInput.l_04_i_wbcomac_acset_cg_f8(dTmp);
|
||
std::array<float, 20> farray20;
|
||
for (int i = 0; i < 20; i++) {
|
||
inputStream >> farray20[i];
|
||
}
|
||
d->_wbInput.l_04_i_wbcomac_acset_tankfuel_f4(farray20);
|
||
inputStream >> dTmp;
|
||
d->_wbInput.l_04_i_wbcomac_acset_totfuel_f8(dTmp);
|
||
inputStream >> dTmp;
|
||
d->_wbInput.l_04_i_wbcomac_acset_zfw_f8(dTmp);
|
||
inputStream >> dTmp;
|
||
d->_wbInput.l_04_i_wbcomac_acset_zfwcg_f8(dTmp);
|
||
std::array<char, 4> ucarray4;
|
||
for (int i = 0; i < 4; i++) {
|
||
inputStream >> ucarray4[i];
|
||
}
|
||
d->_wbInput.l_04_i_wbcomac_eng_efsep_l1(ucarray4);
|
||
std::array<double, 20> darray20;
|
||
for (int i = 0; i < 20; i++) {
|
||
inputStream >> darray20[i];
|
||
}
|
||
d->_wbInput.l_04_i_wbcomac_fuel_f8(darray20);
|
||
inputStream >> dTmp;
|
||
d->_wbInput.l_04_i_wbcomac_gear_avg_f8(dTmp);
|
||
for (int i = 0; i < 20; i++) {
|
||
inputStream >> darray20[i];
|
||
}
|
||
d->_wbInput.l_04_i_wbcomac_kice_f8(darray20);
|
||
inputStream >> ucTmp;
|
||
d->_wbInput.l_04_i_wbcomac_bycglim_l1(ucTmp);
|
||
inputStream >> ucTmp;
|
||
d->_wbInput.l_04_i_wbcomac_bygwlim_l1(ucTmp);
|
||
inputStream >> ucTmp;
|
||
d->_wbInput.l_04_i_wbcomac_frz_l1(ucTmp);
|
||
inputStream >> ucTmp;
|
||
d->_wbInput.l_04_i_wbcomac_zcgfrz_l1(ucTmp);
|
||
inputStream >> ucTmp;
|
||
d->_wbInput.l_04_i_wbcomac_zcgfrz_grfx_l1(ucTmp);
|
||
inputStream >> ucTmp;
|
||
d->_wbInput.l_04_i_wbcomac_ycgfrz_l1(ucTmp);
|
||
inputStream >> ucTmp;
|
||
d->_wbInput.l_04_i_wbcomac_inertfrz_l1(ucTmp);
|
||
inputStream >> dTmp;
|
||
d->_wbInput.l_04_i_wbcomac_potreq_gw_f8(dTmp);
|
||
inputStream >> dTmp;
|
||
d->_wbInput.l_04_i_wbcomac_potreq_gwcg_f8(dTmp);
|
||
d->_dataWriters["XNSim::ATA04::WeightBalance_input"]->write(&d->_wbInput);
|
||
}
|
||
|
||
void XNATA04DataProcessor::OnGhInput(const QVariant &data)
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
QByteArray inputData = data.toByteArray();
|
||
if (inputData.size() <= 5 || inputData[0] != 0x0b || inputData[1] != 0x04
|
||
|| inputData[2] != 0x01 || inputData[3] != 0x00 || inputData[4] != inputData.size()) {
|
||
LOG_WARNING("ATA04DataProcessor::OnGhInput: invalid input data");
|
||
return;
|
||
}
|
||
QDataStream inputStream(&inputData, QIODevice::ReadOnly);
|
||
inputStream.setByteOrder(QDataStream::LittleEndian);
|
||
for (int i = 0; i < 5; i++) {
|
||
char tmp;
|
||
inputStream >> tmp;
|
||
}
|
||
QMutexLocker locker(&d->_ghInputMutex);
|
||
quint8 uchartmp;
|
||
inputStream >> uchartmp;
|
||
d->_ghInput.l_04_i_gdcomac_frz_l1(uchartmp);
|
||
inputStream >> uchartmp;
|
||
d->_ghInput.l_04_i_gdcomac_chocks_l1(uchartmp);
|
||
double doubleTmp;
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_alt_agl_f8(doubleTmp);
|
||
inputStream >> uchartmp;
|
||
d->_ghInput.l_04_i_gdcomac_frzflt_l1(uchartmp);
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_p_f8(doubleTmp);
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_q_f8(doubleTmp);
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_r_f8(doubleTmp);
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_ug_f8(doubleTmp);
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_vg_f8(doubleTmp);
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_wg_f8(doubleTmp);
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_blcg_f8(doubleTmp);
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_bscg_f8(doubleTmp);
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_wlcg_f8(doubleTmp);
|
||
inputStream >> uchartmp;
|
||
d->_ghInput.l_04_i_gdcomac_pb_active_l1(uchartmp);
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_pb_towforce_f8(doubleTmp);
|
||
std::array<std::array<double, 2>, 3> tmpArray32;
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
inputStream >> tmpArray32[i][j];
|
||
}
|
||
}
|
||
d->_ghInput.l_04_i_gdcomac_brake_torq_f8(tmpArray32);
|
||
std::array<double, 3> tmpArray3;
|
||
for (int i = 0; i < 3; i++) {
|
||
inputStream >> tmpArray3[i];
|
||
}
|
||
d->_ghInput.l_04_i_gdcomac_gear_f8(tmpArray3);
|
||
for (int i = 0; i < 3; i++) {
|
||
inputStream >> tmpArray3[i];
|
||
}
|
||
std::array<double, 10> tmpArray10;
|
||
for (int i = 0; i < 10; i++) {
|
||
inputStream >> tmpArray10[i];
|
||
}
|
||
d->_ghInput.l_04_i_gdcomac_gsteer_f8(tmpArray10);
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
inputStream >> tmpArray32[i][j];
|
||
}
|
||
}
|
||
d->_ghInput.l_04_i_gdcomac_tire_pres_f8(tmpArray32);
|
||
std::array<double, 4> tmpArray4;
|
||
for (int i = 0; i < 4; i++) {
|
||
inputStream >> tmpArray4[i];
|
||
}
|
||
inputStream >> uchartmp;
|
||
d->_ghInput.l_04_i_gdcomac_onjax_l1(uchartmp);
|
||
std::array<double, 7> tmpArray7;
|
||
for (int i = 0; i < 7; i++) {
|
||
inputStream >> tmpArray7[i];
|
||
}
|
||
d->_ghInput.l_04_i_gdcomac_contdep_f8(tmpArray7);
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_thetag_f8(doubleTmp);
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_phig_f8(doubleTmp);
|
||
qint32 intTmp;
|
||
inputStream >> intTmp;
|
||
d->_ghInput.l_04_i_gdcomac_rwyrgh_i2(intTmp);
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_rwyhdg_f8(doubleTmp);
|
||
inputStream >> uchartmp;
|
||
d->_ghInput.l_04_i_gdcomac_reset_braketemp_l1(uchartmp);
|
||
inputStream >> uchartmp;
|
||
d->_ghInput.l_04_i_gdcomac_reset_tirepress_l1(uchartmp);
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_temp_c_f8(doubleTmp);
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
inputStream >> tmpArray32[i][j];
|
||
}
|
||
}
|
||
d->_ghInput.l_04_i_gdcomac_brake_temp_f8(tmpArray32);
|
||
std::array<std::array<char, 2>, 3> tmpArray322;
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
inputStream >> tmpArray322[i][j];
|
||
}
|
||
}
|
||
d->_ghInput.l_04_i_gdcomac_tire_tburst_l1(tmpArray322);
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
inputStream >> tmpArray322[i][j];
|
||
}
|
||
}
|
||
d->_ghInput.l_04_i_gdcomac_tire_tflat_l1(tmpArray322);
|
||
inputStream >> uchartmp;
|
||
d->_ghInput.l_04_i_gdcomac_brk_reset_tpres_l1(uchartmp);
|
||
std::array<double, 14> tmpArray14;
|
||
for (int i = 0; i < 14; i++) {
|
||
inputStream >> tmpArray14[i];
|
||
}
|
||
d->_ghInput.l_04_i_gdcomac_rcon_ci_f8(tmpArray14);
|
||
inputStream >> intTmp;
|
||
d->_ghInput.l_04_i_gdcomac_gsteer_state_i4(intTmp);
|
||
inputStream >> uchartmp;
|
||
d->_ghInput.l_04_i_gdcomac_trim_active_l1(uchartmp);
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_phi_deg_f8(doubleTmp);
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_theta_deg_f8(doubleTmp);
|
||
inputStream >> doubleTmp;
|
||
d->_ghInput.l_04_i_gdcomac_psi_deg_f8(doubleTmp);
|
||
inputStream >> uchartmp;
|
||
d->_ghInput.l_04_i_gdcomac_resetint_l1(uchartmp);
|
||
d->_dataWriters["XNSim::ATA04::GroundHandling_input"]->write(&d->_ghInput);
|
||
}
|
||
|
||
void XNATA04DataProcessor::OnAeroInput(const QVariant &data)
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
QByteArray inputData = data.toByteArray();
|
||
|
||
// 基本验证:长度和包头前四个字节
|
||
if (inputData.size() <= 5) {
|
||
LOG_WARNING("ATA04DataProcessor::OnAeroInput: data too short, size=%d", inputData.size());
|
||
return;
|
||
}
|
||
|
||
// 现在我们知道数据包确实以0b 04 00 00开头
|
||
if (inputData[0] != 0x0b || inputData[1] != 0x04 || inputData[2] != 0x00
|
||
|| inputData[3] != 0x00) {
|
||
LOG_WARNING("ATA04DataProcessor::OnAeroInput: invalid header, expected 0b 04 00 00, got "
|
||
"%02x %02x %02x %02x",
|
||
(quint8)inputData[0], (quint8)inputData[1], (quint8)inputData[2],
|
||
(quint8)inputData[3]);
|
||
return;
|
||
}
|
||
|
||
// 使用与发送方相同版本的QDataStream读取数据
|
||
QDataStream inputStream(&inputData, QIODevice::ReadOnly);
|
||
inputStream.setByteOrder(QDataStream::LittleEndian);
|
||
inputStream.setVersion(QDataStream::Qt_6_0);
|
||
|
||
// 跳过5字节的头
|
||
for (int i = 0; i < 5; i++) {
|
||
char tmp;
|
||
inputStream >> tmp;
|
||
}
|
||
|
||
QMutexLocker locker(&d->_aeroInputMutex);
|
||
|
||
// 尝试读取数据,并添加异常处理
|
||
try {
|
||
double tmp;
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_alpha_f8(tmp);
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_alpdot_f8(tmp);
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_beta_f8(tmp);
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_press_alt_f8(tmp);
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_tas_f8(tmp);
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_mach_f8(tmp);
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_nx_f8(tmp);
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_ny_f8(tmp);
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_nz_f8(tmp);
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_p_f8(tmp);
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_q_f8(tmp);
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_r_f8(tmp);
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_qbar_f8(tmp);
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_blcg_f8(tmp);
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_bscg_f8(tmp);
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_wlcg_f8(tmp);
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_stab_f8(tmp);
|
||
std::array<double, 10> tmpArray;
|
||
for (int i = 0; i < 10; i++) {
|
||
inputStream >> tmpArray[i];
|
||
}
|
||
d->_aeroInput.l_04_i_aerocomac_ail_f8(tmpArray);
|
||
std::array<double, 4> tmpArray2;
|
||
for (int i = 0; i < 4; i++) {
|
||
inputStream >> tmpArray2[i];
|
||
}
|
||
d->_aeroInput.l_04_i_aerocomac_elv_f8(tmpArray2);
|
||
std::array<double, 2> tmpArray3;
|
||
for (int i = 0; i < 2; i++) {
|
||
inputStream >> tmpArray3[i];
|
||
}
|
||
d->_aeroInput.l_04_i_aerocomac_rud_f8(tmpArray3);
|
||
std::array<double, 7> tmpArray4;
|
||
for (int i = 0; i < 7; i++) {
|
||
inputStream >> tmpArray4[i];
|
||
}
|
||
d->_aeroInput.l_04_i_aerocomac_gear_f8(tmpArray4);
|
||
for (int i = 0; i < 10; i++) {
|
||
inputStream >> tmpArray[i];
|
||
}
|
||
d->_aeroInput.l_04_i_aerocomac_flap_f8(tmpArray);
|
||
std::array<double, 20> tmpArray5;
|
||
for (int i = 0; i < 20; i++) {
|
||
inputStream >> tmpArray5[i];
|
||
}
|
||
d->_aeroInput.l_04_i_aerocomac_slat_f8(tmpArray5);
|
||
for (int i = 0; i < 20; i++) {
|
||
inputStream >> tmpArray5[i];
|
||
}
|
||
d->_aeroInput.l_04_i_aerocomac_spl_f8(tmpArray5);
|
||
for (int i = 0; i < 4; i++) {
|
||
inputStream >> tmpArray2[i];
|
||
}
|
||
d->_aeroInput.l_04_i_aerocomac_tnet_f8(tmpArray2);
|
||
for (int i = 0; i < 20; i++) {
|
||
inputStream >> tmpArray5[i];
|
||
}
|
||
d->_aeroInput.l_04_i_aerocomac_kice_f8(tmpArray5);
|
||
inputStream >> tmp;
|
||
d->_aeroInput.l_04_i_aerocomac_alt_agl_f8(tmp);
|
||
d->_dataWriters["XNSim::ATA04::Aerodynamics_input"]->write(&d->_aeroInput);
|
||
} catch (const std::exception &e) {
|
||
LOG_WARNING("ATA04DataProcessor::OnAeroInput: exception during data parsing: %s", e.what());
|
||
return;
|
||
} catch (...) {
|
||
LOG_WARNING("ATA04DataProcessor::OnAeroInput: unknown exception during data parsing");
|
||
return;
|
||
}
|
||
}
|
||
|
||
void XNATA04DataProcessor::OnWbOutput(const XNSim::ATA04::WeightBalance_output &input)
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
QMutexLocker locker(&d->_wbOutputMutex);
|
||
d->_wbOutput = input;
|
||
}
|
||
|
||
void XNATA04DataProcessor::OnGhOutput(const XNSim::ATA04::GroundHandling_output &input)
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
QMutexLocker locker(&d->_ghOutputMutex);
|
||
d->_ghOutput = input;
|
||
}
|
||
|
||
void XNATA04DataProcessor::OnAeroOutput(const XNSim::ATA04::Aerodynamics_output &input)
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
QMutexLocker locker(&d->_aeroOutputMutex);
|
||
d->_aeroOutput = input;
|
||
}
|
||
|
||
void XNATA04DataProcessor::OnAeroHeartbeat(const XNSim::ATA04::Aerodynamics_heartbeat &input)
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
QMutexLocker locker(&d->_aeroHeartbeatMutex);
|
||
d->_aeroHeartbeat = input;
|
||
}
|
||
|
||
void XNATA04DataProcessor::OnWbHeartbeat(const XNSim::ATA04::WeightBalance_heartbeat &input)
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
QMutexLocker locker(&d->_wbHeartbeatMutex);
|
||
d->_wbHeartbeat = input;
|
||
}
|
||
|
||
void XNATA04DataProcessor::OnGhHeartbeat(const XNSim::ATA04::GroundHandling_heartbeat &input)
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
QMutexLocker locker(&d->_ghHeartbeatMutex);
|
||
d->_ghHeartbeat = input;
|
||
}
|
||
|
||
void XNATA04DataProcessor::SendUdpTestData()
|
||
{
|
||
Q_D(XNATA04DataProcessor);
|
||
|
||
// 创建气动输入(AeroInput)数据包
|
||
QByteArray aeroData;
|
||
QDataStream aeroStream(&aeroData, QIODevice::WriteOnly);
|
||
aeroStream.setByteOrder(QDataStream::LittleEndian);
|
||
aeroStream.setVersion(QDataStream::Qt_6_0);
|
||
|
||
// 气动输入数据包头 (0x0b=从外部输入, 0x04=ATA04, 0x00=气动模型, 0x00=输入数据)
|
||
quint8 aeroHeader[5] = {0x0b, 0x04, 0x00, 0x00, 0x00};
|
||
aeroStream << aeroHeader[0] << aeroHeader[1] << aeroHeader[2] << aeroHeader[3] << aeroHeader[4];
|
||
|
||
// 气动数据字段
|
||
aeroStream << (double)5.0; // alpha
|
||
aeroStream << (double)0.5; // alpdot
|
||
aeroStream << (double)1.0; // beta
|
||
aeroStream << (double)10000.0; // press_alt
|
||
aeroStream << (double)250.0; // tas
|
||
aeroStream << (double)0.8; // mach
|
||
aeroStream << (double)0.2; // nx
|
||
aeroStream << (double)0.0; // ny
|
||
aeroStream << (double)1.0; // nz
|
||
aeroStream << (double)0.0; // p
|
||
aeroStream << (double)0.0; // q
|
||
aeroStream << (double)0.0; // r
|
||
aeroStream << (double)12000.0; // qbar
|
||
aeroStream << (double)0.0; // blcg
|
||
aeroStream << (double)0.0; // bscg
|
||
aeroStream << (double)0.0; // wlcg
|
||
aeroStream << (double)0.0; // stab
|
||
|
||
// ail_f8 数组,需要10个double
|
||
for (int i = 0; i < 10; i++) {
|
||
aeroStream << (double)0.0;
|
||
}
|
||
|
||
// elv_f8 数组,需要4个double
|
||
for (int i = 0; i < 4; i++) {
|
||
aeroStream << (double)0.0;
|
||
}
|
||
|
||
// rud_f8 数组,需要2个double
|
||
for (int i = 0; i < 2; i++) {
|
||
aeroStream << (double)0.0;
|
||
}
|
||
|
||
// gear_f8 数组,需要7个double
|
||
for (int i = 0; i < 7; i++) {
|
||
aeroStream << (double)0.0;
|
||
}
|
||
|
||
// flap_f8 数组,需要10个double
|
||
for (int i = 0; i < 10; i++) {
|
||
aeroStream << (double)0.0;
|
||
}
|
||
|
||
// slat_f8 数组,需要20个double
|
||
for (int i = 0; i < 20; i++) {
|
||
aeroStream << (double)0.0;
|
||
}
|
||
|
||
// spl_f8 数组,需要20个double
|
||
for (int i = 0; i < 20; i++) {
|
||
aeroStream << (double)0.0;
|
||
}
|
||
|
||
// tnet_f8 数组,需要4个double
|
||
for (int i = 0; i < 4; i++) {
|
||
aeroStream << (double)20000.0;
|
||
}
|
||
|
||
// kice_f8 数组,需要20个double
|
||
for (int i = 0; i < 20; i++) {
|
||
aeroStream << (double)0.0;
|
||
}
|
||
|
||
// alt_agl
|
||
aeroStream << (double)1000.0;
|
||
|
||
// 更新数据包大小,确保不会溢出
|
||
if (aeroData.size() <= 255) {
|
||
aeroData[4] = aeroData.size();
|
||
} else {
|
||
LOG_WARNING("ATA04DataProcessor::SendUdpTestData: aeroData size exceeds byte limit: %d",
|
||
aeroData.size());
|
||
aeroData[4] = 255; // 设置为最大值
|
||
}
|
||
|
||
// 创建地面操作输入(GhInput)数据包
|
||
QByteArray ghData;
|
||
QDataStream ghStream(&ghData, QIODevice::WriteOnly);
|
||
ghStream.setByteOrder(QDataStream::LittleEndian);
|
||
ghStream.setVersion(QDataStream::Qt_6_0);
|
||
// 地面操作输入数据包头 (0x0b=从外部输入, 0x04=ATA04, 0x01=地面操作模型, 0x00=输入数据)
|
||
quint8 ghHeader[5] = {0x0b, 0x04, 0x01, 0x00, 0x00};
|
||
ghStream << ghHeader[0] << ghHeader[1] << ghHeader[2] << ghHeader[3] << ghHeader[4];
|
||
|
||
// 地面操作数据字段
|
||
ghStream << (quint8)0; // frz_l1
|
||
ghStream << (quint8)0; // chocks_l1
|
||
ghStream << (double)100.0; // alt_agl_f8
|
||
ghStream << (quint8)0; // frzflt_l1
|
||
ghStream << (double)0.0; // p_f8
|
||
ghStream << (double)0.0; // q_f8
|
||
ghStream << (double)0.0; // r_f8
|
||
ghStream << (double)0.0; // ug_f8
|
||
ghStream << (double)0.0; // vg_f8
|
||
ghStream << (double)0.0; // wg_f8
|
||
ghStream << (double)0.0; // blcg_f8
|
||
ghStream << (double)0.0; // bscg_f8
|
||
ghStream << (double)0.0; // wlcg_f8
|
||
ghStream << (quint8)0; // pb_active_l1
|
||
ghStream << (double)0.0; // pb_towforce_f8
|
||
|
||
// brake_torq_f8 数组 3x2
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
ghStream << (double)0.0;
|
||
}
|
||
}
|
||
|
||
// gear_f8 数组,需要3个double
|
||
for (int i = 0; i < 3; i++) {
|
||
ghStream << (double)0.0;
|
||
}
|
||
|
||
// 另一个3个double的数组
|
||
for (int i = 0; i < 3; i++) {
|
||
ghStream << (double)0.0;
|
||
}
|
||
|
||
// gsteer_f8 数组,需要10个double
|
||
for (int i = 0; i < 10; i++) {
|
||
ghStream << (double)0.0;
|
||
}
|
||
|
||
// tire_pres_f8 数组 3x2
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
ghStream << (double)30.0; // 30 psi的胎压
|
||
}
|
||
}
|
||
|
||
// 4个double数组
|
||
for (int i = 0; i < 4; i++) {
|
||
ghStream << (double)0.0;
|
||
}
|
||
|
||
ghStream << (quint8)0; // onjax_l1
|
||
|
||
// contdep_f8 数组,需要7个double
|
||
for (int i = 0; i < 7; i++) {
|
||
ghStream << (double)0.0;
|
||
}
|
||
|
||
ghStream << (double)0.0; // thetag_f8
|
||
ghStream << (double)0.0; // phig_f8
|
||
ghStream << (qint32)0; // rwyrgh_i2
|
||
ghStream << (double)0.0; // rwyhdg_f8
|
||
ghStream << (quint8)0; // reset_braketemp_l1
|
||
ghStream << (quint8)0; // reset_tirepress_l1
|
||
ghStream << (double)20.0; // temp_c_f8
|
||
|
||
// brake_temp_f8 数组 3x2
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
ghStream << (double)50.0; // 50度的刹车温度
|
||
}
|
||
}
|
||
|
||
// tire_tburst_l1 数组 3x2
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
ghStream << (char)0;
|
||
}
|
||
}
|
||
|
||
// tire_tflat_l1 数组 3x2
|
||
for (int i = 0; i < 3; i++) {
|
||
for (int j = 0; j < 2; j++) {
|
||
ghStream << (char)0;
|
||
}
|
||
}
|
||
|
||
ghStream << (quint8)0; // brk_reset_tpres_l1
|
||
|
||
// rcon_ci_f8 数组,需要14个double
|
||
for (int i = 0; i < 14; i++) {
|
||
ghStream << (double)0.0;
|
||
}
|
||
|
||
ghStream << (qint32)0; // gsteer_state_i4
|
||
ghStream << (quint8)0; // trim_active_l1
|
||
ghStream << (double)0.0; // phi_deg_f8
|
||
ghStream << (double)0.0; // theta_deg_f8
|
||
ghStream << (double)0.0; // psi_deg_f8
|
||
ghStream << (quint8)0; // resetint_l1
|
||
|
||
// 更新数据包大小,确保不会溢出
|
||
if (ghData.size() <= 255) {
|
||
ghData[4] = ghData.size();
|
||
} else {
|
||
LOG_WARNING("ATA04DataProcessor::SendUdpTestData: ghData size exceeds byte limit: %d",
|
||
ghData.size());
|
||
ghData[4] = 255; // 设置为最大值
|
||
}
|
||
|
||
// 创建重量平衡输入(WbInput)数据包
|
||
QByteArray wbData;
|
||
QDataStream wbStream(&wbData, QIODevice::WriteOnly);
|
||
wbStream.setByteOrder(QDataStream::LittleEndian);
|
||
wbStream.setVersion(QDataStream::Qt_6_0);
|
||
// 重量平衡输入数据包头 (0x0b=从外部输入, 0x04=ATA04, 0x02=重量平衡模型, 0x00=输入数据)
|
||
quint8 wbHeader[5] = {0x0b, 0x04, 0x02, 0x00, 0x00};
|
||
wbStream << wbHeader[0] << wbHeader[1] << wbHeader[2] << wbHeader[3] << wbHeader[4];
|
||
|
||
// 重量平衡数据字段
|
||
wbStream << (double)0.0; // theta_deg_f8
|
||
wbStream << (double)0.0; // phi_deg_f8
|
||
wbStream << (double)0.0; // psi_deg_f8
|
||
wbStream << (quint8)0; // gear_mode_l1
|
||
wbStream << (double)60000.0; // acset_gw_f8 (60000kg飞机重量)
|
||
wbStream << (double)25.0; // acset_cg_f8 (25%MAC重心位置)
|
||
|
||
// acset_tankfuel_f4 数组,需要20个float
|
||
for (int i = 0; i < 20; i++) {
|
||
wbStream << (float)(i < 10 ? 1000.0 : 0.0); // 前10个油箱各1000kg
|
||
}
|
||
|
||
wbStream << (double)10000.0; // acset_totfuel_f8 (总油量10000kg)
|
||
wbStream << (double)50000.0; // acset_zfw_f8 (零油重50000kg)
|
||
wbStream << (double)24.0; // acset_zfwcg_f8 (零油重重心24%MAC)
|
||
|
||
// eng_efsep_l1 数组,需要4个char
|
||
for (int i = 0; i < 4; i++) {
|
||
wbStream << (char)0;
|
||
}
|
||
|
||
// fuel_f8 数组,需要20个double
|
||
for (int i = 0; i < 20; i++) {
|
||
wbStream << (double)(i < 10 ? 1000.0 : 0.0); // 前10个油箱各1000kg
|
||
}
|
||
|
||
wbStream << (double)0.0; // gear_avg_f8
|
||
|
||
// kice_f8 数组,需要20个double
|
||
for (int i = 0; i < 20; i++) {
|
||
wbStream << (double)0.0;
|
||
}
|
||
|
||
wbStream << (quint8)0; // bycglim_l1
|
||
wbStream << (quint8)0; // bygwlim_l1
|
||
wbStream << (quint8)0; // frz_l1
|
||
wbStream << (quint8)0; // zcgfrz_l1
|
||
wbStream << (quint8)0; // zcgfrz_grfx_l1
|
||
wbStream << (quint8)0; // ycgfrz_l1
|
||
wbStream << (quint8)0; // inertfrz_l1
|
||
wbStream << (double)60000.0; // potreq_gw_f8
|
||
wbStream << (double)25.0; // potreq_gwcg_f8
|
||
|
||
// 更新数据包大小,确保不会溢出
|
||
if (wbData.size() <= 255) {
|
||
wbData[4] = wbData.size();
|
||
} else {
|
||
LOG_WARNING("ATA04DataProcessor::SendUdpTestData: wbData size exceeds byte limit: %d",
|
||
wbData.size());
|
||
wbData[4] = 255; // 设置为最大值
|
||
}
|
||
|
||
// 发送测试数据包
|
||
TriggerRTEvent("SendTestUDPData", QVariant::fromValue(aeroData));
|
||
TriggerRTEvent("SendTestUDPData", QVariant::fromValue(ghData));
|
||
TriggerRTEvent("SendTestUDPData", QVariant::fromValue(wbData));
|
||
}
|