- 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.
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 );
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();
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]);
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);
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]);
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);
}
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" );
}
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]);
}
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]);
}
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] );
}
# 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
// 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
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];
bool gear_handle; // true=gear handle down; false= gear handle up
// Switches
- bool master_bat;
- bool master_alt;
bool master_avionics;
// wind and turbulance
#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
// 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