native_ctrls:
- We need to be able to support a per engine master bat/alt switch. - Forgot to write the gear level state into the network structure. native_fdm: - renamed EGT->egt for consistancy. - added manifold pressure to the structure.
This commit is contained in:
parent
b5c9a3c0e2
commit
ec036a7be8
4 changed files with 36 additions and 28 deletions
|
@ -125,6 +125,16 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
|
|||
node = fgGetNode("/controls/engines/engine", i );
|
||||
starter = fgGetNode("/systems/electrical/outputs/starter", i );
|
||||
fuelpump = fgGetNode("/systems/electrical/outputs/fuel-pump", i );
|
||||
|
||||
tempnode = node->getChild("master-bat");
|
||||
if ( tempnode != NULL ) {
|
||||
net->master_bat[i] = tempnode->getBoolValue();
|
||||
}
|
||||
tempnode = node->getChild("master-alt");
|
||||
if ( tempnode != NULL ) {
|
||||
net->master_alt[i] = tempnode->getBoolValue();
|
||||
}
|
||||
|
||||
net->throttle[i] = node->getDoubleValue( "throttle", 0.0 );
|
||||
net->mixture[i] = node->getDoubleValue( "mixture", 0.0 );
|
||||
net->prop_advance[i] = node->getDoubleValue( "propeller-pitch", 0.0 );
|
||||
|
@ -178,15 +188,8 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
|
|||
net->brake_right = node->getChild("brake-right")->getDoubleValue();
|
||||
net->brake_parking = node->getChild("brake-parking")->getDoubleValue();
|
||||
|
||||
node = fgGetNode("/controls/switches", true);
|
||||
tempnode = node->getChild("master-bat");
|
||||
if ( tempnode != NULL ) {
|
||||
net->master_bat = tempnode->getBoolValue();
|
||||
}
|
||||
tempnode = node->getChild("master-alt");
|
||||
if ( tempnode != NULL ) {
|
||||
net->master_alt = tempnode->getBoolValue();
|
||||
}
|
||||
net->gear_handle = fgGetBool( "controls/gear/gear-down" );
|
||||
|
||||
tempnode = node->getChild("master-avionics");
|
||||
if ( tempnode != NULL ) {
|
||||
net->master_avionics = tempnode->getBoolValue();
|
||||
|
@ -232,6 +235,8 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
|
|||
net->flaps_power = htonl(net->flaps_power);
|
||||
net->flap_motor_ok = htonl(net->flap_motor_ok);
|
||||
for ( i = 0; i < FGNetCtrls::FG_MAX_ENGINES; ++i ) {
|
||||
net->master_bat[i] = htonl(net->master_bat[i]);
|
||||
net->master_alt[i] = htonl(net->master_alt[i]);
|
||||
net->magnetos[i] = htonl(net->magnetos[i]);
|
||||
net->starter_power[i] = htonl(net->starter_power[i]);
|
||||
htond(net->throttle[i]);
|
||||
|
@ -254,8 +259,6 @@ void FGProps2NetCtrls( FGNetCtrls *net, bool honor_freezes,
|
|||
htond(net->brake_right);
|
||||
htond(net->brake_parking);
|
||||
net->gear_handle = htonl(net->gear_handle);
|
||||
net->master_bat = htonl(net->master_bat);
|
||||
net->master_alt = htonl(net->master_alt);
|
||||
net->master_avionics = htonl(net->master_avionics);
|
||||
htond(net->wind_speed_kt);
|
||||
htond(net->wind_dir_deg);
|
||||
|
@ -290,6 +293,8 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
|
|||
net->flap_motor_ok = htonl(net->flap_motor_ok);
|
||||
net->num_engines = htonl(net->num_engines);
|
||||
for ( i = 0; i < net->num_engines; ++i ) {
|
||||
net->master_bat[i] = htonl(net->master_bat[i]);
|
||||
net->master_alt[i] = htonl(net->master_alt[i]);
|
||||
net->magnetos[i] = htonl(net->magnetos[i]);
|
||||
net->starter_power[i] = htonl(net->starter_power[i]);
|
||||
htond(net->throttle[i]);
|
||||
|
@ -311,8 +316,6 @@ void FGNetCtrls2Props( FGNetCtrls *net, bool honor_freezes,
|
|||
htond(net->brake_right);
|
||||
htond(net->brake_parking);
|
||||
net->gear_handle = htonl(net->gear_handle);
|
||||
net->master_bat = htonl(net->master_bat);
|
||||
net->master_alt = htonl(net->master_alt);
|
||||
net->master_avionics = htonl(net->master_avionics);
|
||||
htond(net->wind_speed_kt);
|
||||
htond(net->wind_dir_deg);
|
||||
|
|
|
@ -171,8 +171,9 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
|
|||
}
|
||||
net->rpm[i] = node->getDoubleValue( "rpm" );
|
||||
net->fuel_flow[i] = node->getDoubleValue( "fuel-flow-gph" );
|
||||
net->EGT[i] = node->getDoubleValue( "egt-degf" );
|
||||
net->egt[i] = node->getDoubleValue( "egt-degf" );
|
||||
// cout << "egt = " << aero->EGT << endl;
|
||||
net->mp_osi[i] = node->getDoubleValue( "mp-osi" );
|
||||
net->oil_temp[i] = node->getDoubleValue( "oil-temperature-degf" );
|
||||
net->oil_px[i] = node->getDoubleValue( "oil-pressure-psi" );
|
||||
}
|
||||
|
@ -249,7 +250,8 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
|
|||
net->eng_state[i] = htonl(net->eng_state[i]);
|
||||
htonf(net->rpm[i]);
|
||||
htonf(net->fuel_flow[i]);
|
||||
htonf(net->EGT[i]);
|
||||
htonf(net->egt[i]);
|
||||
htonf(net->mp_osi[i]);
|
||||
htonf(net->oil_temp[i]);
|
||||
htonf(net->oil_px[i]);
|
||||
}
|
||||
|
@ -326,7 +328,8 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
|
|||
net->eng_state[i] = htonl(net->eng_state[i]);
|
||||
htonf(net->rpm[i]);
|
||||
htonf(net->fuel_flow[i]);
|
||||
htonf(net->EGT[i]);
|
||||
htonf(net->egt[i]);
|
||||
htonf(net->mp_osi[i]);
|
||||
htonf(net->oil_temp[i]);
|
||||
htonf(net->oil_px[i]);
|
||||
}
|
||||
|
@ -420,7 +423,8 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
|
|||
|
||||
node->setDoubleValue( "rpm", net->rpm[i] );
|
||||
node->setDoubleValue( "fuel-flow-gph", net->fuel_flow[i] );
|
||||
node->setDoubleValue( "egt-degf", net->EGT[i] );
|
||||
node->setDoubleValue( "egt-degf", net->egt[i] );
|
||||
node->setDoubleValue( "mp-osi", net->mp_osi[i] );
|
||||
node->setDoubleValue( "oil-temperature-degf", net->oil_temp[i] );
|
||||
node->setDoubleValue( "oil-pressure-psi", net->oil_px[i] );
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# error This library requires C++
|
||||
#endif
|
||||
|
||||
const int FG_NET_CTRLS_VERSION = 19;
|
||||
const int FG_NET_CTRLS_VERSION = 20;
|
||||
|
||||
|
||||
// Define a structure containing the control parameters
|
||||
|
@ -46,6 +46,8 @@ public:
|
|||
|
||||
// Engine controls
|
||||
int num_engines; // number of valid engines
|
||||
bool master_bat[FG_MAX_ENGINES];
|
||||
bool master_alt[FG_MAX_ENGINES];
|
||||
int magnetos[FG_MAX_ENGINES];
|
||||
bool starter_power[FG_MAX_ENGINES]; // true = starter power
|
||||
double throttle[FG_MAX_ENGINES]; // 0 ... 1
|
||||
|
@ -57,7 +59,7 @@ public:
|
|||
bool engine_ok[FG_MAX_ENGINES];
|
||||
bool mag_left_ok[FG_MAX_ENGINES];
|
||||
bool mag_right_ok[FG_MAX_ENGINES];
|
||||
bool spark_plugs_ok[FG_MAX_ENGINES]; // false = fouled plugs
|
||||
bool spark_plugs_ok[FG_MAX_ENGINES]; // false = fouled plugs
|
||||
int oil_press_status[FG_MAX_ENGINES]; // 0 = normal, 1 = low, 2 = full fail
|
||||
bool fuel_pump_ok[FG_MAX_ENGINES];
|
||||
|
||||
|
@ -74,8 +76,6 @@ public:
|
|||
bool gear_handle; // true=gear handle down; false= gear handle up
|
||||
|
||||
// Switches
|
||||
bool master_bat;
|
||||
bool master_alt;
|
||||
bool master_avionics;
|
||||
|
||||
// wind and turbulance
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include <time.h> // time_t
|
||||
|
||||
const int FG_NET_FDM_VERSION = 17;
|
||||
const int FG_NET_FDM_VERSION = 18;
|
||||
|
||||
|
||||
// Define a structure containing the top level flight dynamics model
|
||||
|
@ -79,13 +79,14 @@ public:
|
|||
// Pressure
|
||||
|
||||
// Engine status
|
||||
int num_engines; // Number of valid engines
|
||||
int eng_state[FG_MAX_ENGINES]; // Engine state (off, cranking, running)
|
||||
float rpm[FG_MAX_ENGINES]; // Engine RPM rev/min
|
||||
int num_engines; // Number of valid engines
|
||||
int eng_state[FG_MAX_ENGINES]; // Engine state (off, cranking, running)
|
||||
float rpm[FG_MAX_ENGINES]; // Engine RPM rev/min
|
||||
float fuel_flow[FG_MAX_ENGINES]; // Fuel flow gallons/hr
|
||||
float EGT[FG_MAX_ENGINES]; // Exhuast gas temp deg F
|
||||
float oil_temp[FG_MAX_ENGINES]; // Oil temp deg F
|
||||
float oil_px[FG_MAX_ENGINES]; // Oil pressure psi
|
||||
float egt[FG_MAX_ENGINES]; // Exhuast gas temp deg F
|
||||
float mp_osi[FG_MAX_ENGINES]; // Manifold pressure
|
||||
float oil_temp[FG_MAX_ENGINES]; // Oil temp deg F
|
||||
float oil_px[FG_MAX_ENGINES]; // Oil pressure psi
|
||||
|
||||
// Consumables
|
||||
int num_tanks; // Max number of fuel tanks
|
||||
|
|
Loading…
Reference in a new issue