107 lines
3.1 KiB
C++
Executable File
107 lines
3.1 KiB
C++
Executable File
#include "XNAerodynamics.h"
|
|
#include "XNAerodynamics_p.h"
|
|
#include <XNCore/XNModelManager.h>
|
|
|
|
XN_MODEL_INITIALIZE(XNAerodynamics)
|
|
|
|
XNAerodynamics::XNAerodynamics() : XNModelObject(new XNAerodynamicsPrivate())
|
|
{
|
|
}
|
|
|
|
XNAerodynamics::~XNAerodynamics()
|
|
{
|
|
ReleaseData();
|
|
}
|
|
|
|
XNAerodynamics::XNAerodynamics(PrivateType *p) : XNModelObject(p)
|
|
{
|
|
}
|
|
|
|
void XNAerodynamics::Initialize()
|
|
{
|
|
T_D();
|
|
XNModelObject::Initialize();
|
|
if (d->_dynamicLib) {
|
|
d->_fun = (FunctionType)dlsym(d->_dynamicLib, d->_entryPointName.c_str());
|
|
if (!d->_fun) {
|
|
LOG_WARNING("Failed to resolve SACSCAerodynamicsEntryPoint");
|
|
}
|
|
}
|
|
}
|
|
|
|
void XNAerodynamics::PrepareForExecute()
|
|
{
|
|
T_D();
|
|
XNModelObject::PrepareForExecute();
|
|
InitializeData();
|
|
d->_inputInterface.Initialize(GetFramework(), GetUniqueId(), 1);
|
|
d->_outputInterface.Initialize(GetFramework(), GetUniqueId(), 2);
|
|
d->_heartbeatInterface.Initialize(GetFramework(), GetUniqueId(), 2);
|
|
}
|
|
|
|
void XNAerodynamics::StepUpdate()
|
|
{
|
|
T_D();
|
|
XNModelObject::StepUpdate();
|
|
if (d->_fun) {
|
|
d->_inputInterface.getData(d->_data.input_aero);
|
|
d->_fun(&d->_data);
|
|
d->_outputInterface.setData(d->_data.output_aero);
|
|
d->_heartbeatInterface.setData(&d->_data);
|
|
}
|
|
}
|
|
|
|
void XNAerodynamics::InitializeData()
|
|
{
|
|
T_D();
|
|
d->_data.aero_model_heartbeat = 0;
|
|
d->_data.input_aero = new input_aero_S;
|
|
d->_data.input_aero->l_04_i_aerocomac_ail_f8 = new double[10];
|
|
d->_data.input_aero->l_04_i_aerocomac_elv_f8 = new double[4];
|
|
d->_data.input_aero->l_04_i_aerocomac_rud_f8 = new double[2];
|
|
d->_data.input_aero->l_04_i_aerocomac_gear_f8 = new double[7];
|
|
d->_data.input_aero->l_04_i_aerocomac_flap_f8 = new double[10];
|
|
d->_data.input_aero->l_04_i_aerocomac_slat_f8 = new double[20];
|
|
d->_data.input_aero->l_04_i_aerocomac_spl_f8 = new double[20];
|
|
d->_data.input_aero->l_04_i_aerocomac_tnet_f8 = new double[4];
|
|
d->_data.input_aero->l_04_i_aerocomac_kice_f8 = new double[20];
|
|
d->_data.output_aero = new output_aero_S;
|
|
}
|
|
|
|
void XNAerodynamics::ReleaseData()
|
|
{
|
|
T_D();
|
|
if (d->_data.input_aero) {
|
|
if (d->_data.input_aero->l_04_i_aerocomac_ail_f8) {
|
|
delete[] d->_data.input_aero->l_04_i_aerocomac_ail_f8;
|
|
}
|
|
if (d->_data.input_aero->l_04_i_aerocomac_elv_f8) {
|
|
delete[] d->_data.input_aero->l_04_i_aerocomac_elv_f8;
|
|
}
|
|
if (d->_data.input_aero->l_04_i_aerocomac_rud_f8) {
|
|
delete[] d->_data.input_aero->l_04_i_aerocomac_rud_f8;
|
|
}
|
|
if (d->_data.input_aero->l_04_i_aerocomac_gear_f8) {
|
|
delete[] d->_data.input_aero->l_04_i_aerocomac_gear_f8;
|
|
}
|
|
if (d->_data.input_aero->l_04_i_aerocomac_flap_f8) {
|
|
delete[] d->_data.input_aero->l_04_i_aerocomac_flap_f8;
|
|
}
|
|
if (d->_data.input_aero->l_04_i_aerocomac_slat_f8) {
|
|
delete[] d->_data.input_aero->l_04_i_aerocomac_slat_f8;
|
|
}
|
|
if (d->_data.input_aero->l_04_i_aerocomac_spl_f8) {
|
|
delete[] d->_data.input_aero->l_04_i_aerocomac_spl_f8;
|
|
}
|
|
if (d->_data.input_aero->l_04_i_aerocomac_tnet_f8) {
|
|
delete[] d->_data.input_aero->l_04_i_aerocomac_tnet_f8;
|
|
}
|
|
if (d->_data.input_aero->l_04_i_aerocomac_kice_f8) {
|
|
delete[] d->_data.input_aero->l_04_i_aerocomac_kice_f8;
|
|
}
|
|
delete d->_data.input_aero;
|
|
}
|
|
if (d->_data.output_aero) {
|
|
delete d->_data.output_aero;
|
|
}
|
|
} |