1118 lines
37 KiB
C++
Executable File
1118 lines
37 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();
|
||
}
|
||
|
||
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 || inputData[0] != 0x0b || inputData[1] != 0x04
|
||
|| inputData[2] != 0x00 || inputData[3] != 0x00 || inputData[4] != inputData.size()) {
|
||
LOG_WARNING("ATA04DataProcessor::OnAeroInput: 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->_aeroInputMutex);
|
||
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);
|
||
}
|
||
|
||
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;
|
||
}
|