X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FJSBSim%2FJSBSim.cxx;h=e2d98b673d2fd2bf68b9c278eb2601b176ba7743;hb=e16f772e54216b0088ca9cb3f3b0fb062be8bfdb;hp=c986cbdd92c21a1ff10abaadbfb2fffcaaf392c0;hpb=5ec361ae061e0159273ec755b7abb6f3ab0114e1;p=flightgear.git diff --git a/src/FDM/JSBSim/JSBSim.cxx b/src/FDM/JSBSim/JSBSim.cxx index c986cbdd9..e2d98b673 100644 --- a/src/FDM/JSBSim/JSBSim.cxx +++ b/src/FDM/JSBSim/JSBSim.cxx @@ -570,6 +570,22 @@ void FGJSBsim::update( double dt ) /******************************************************************************/ +void FGJSBsim::suspend() +{ + fdmex->Hold(); + SGSubsystem::suspend(); +} + +/******************************************************************************/ + +void FGJSBsim::resume() +{ + fdmex->Resume(); + SGSubsystem::resume(); +} + +/******************************************************************************/ + // Convert from the FGInterface struct to the JSBsim generic_ struct bool FGJSBsim::copy_to_JSBsim() @@ -839,7 +855,7 @@ bool FGJSBsim::copy_from_JSBsim() node->setDoubleValue("egt-degf", 32 + eng->GetEGT()*9/5); node->setBoolValue("augmentation", eng->GetAugmentation()); node->setBoolValue("water-injection", eng->GetInjection()); - node->setBoolValue("ignition", eng->GetIgnition()); + node->setBoolValue("ignition", eng->GetIgnition() != 0); node->setDoubleValue("nozzle-pos-norm", eng->GetNozzle()); node->setDoubleValue("inlet-pos-norm", eng->GetInlet()); node->setDoubleValue("oil-pressure-psi", eng->getOilPressure_psi()); @@ -858,7 +874,7 @@ bool FGJSBsim::copy_from_JSBsim() node->setDoubleValue("n1", eng->GetN1()); //node->setDoubleValue("n2", eng->GetN2()); node->setDoubleValue("itt_degf", 32 + eng->GetITT()*9/5); - node->setBoolValue("ignition", eng->GetIgnition()); + node->setBoolValue("ignition", eng->GetIgnition() != 0); node->setDoubleValue("nozzle-pos-norm", eng->GetNozzle()); node->setDoubleValue("inlet-pos-norm", eng->GetInlet()); node->setDoubleValue("oil-pressure-psi", eng->getOilPressure_psi()); @@ -866,7 +882,7 @@ bool FGJSBsim::copy_from_JSBsim() node->setBoolValue("cutoff", eng->GetCutoff()); node->setBoolValue("starting", eng->GetEngStarting()); node->setBoolValue("generator-power", eng->GetGeneratorPower()); - node->setBoolValue("damaged", eng->GetCondition()); + node->setBoolValue("damaged", eng->GetCondition() != 0); node->setBoolValue("ielu-intervent", eng->GetIeluIntervent()); node->setDoubleValue("oil-temperature-degf", eng->getOilTemp_degF()); // node->setBoolValue("onfire", eng->GetFire()); @@ -1011,7 +1027,9 @@ void FGJSBsim::set_Latitude(double lat) _set_Sea_level_radius( sea_level_radius_meters * SG_METER_TO_FEET ); fgic->SetSeaLevelRadiusFtIC( sea_level_radius_meters * SG_METER_TO_FEET ); fgic->SetLatitudeRadIC( lat_geoc ); - needTrim=true; + + if (!fdmex->Holding()) + needTrim=true; } @@ -1024,7 +1042,9 @@ void FGJSBsim::set_Longitude(double lon) update_ic(); fgic->SetLongitudeRadIC( lon ); - needTrim=true; + + if (!fdmex->Holding()) + needTrim=true; } // Sets the altitude above sea level. @@ -1049,7 +1069,9 @@ void FGJSBsim::set_Altitude(double alt) "Terrain elevation: " << FGInterface::get_Runway_altitude() * SG_METER_TO_FEET ); fgic->SetLatitudeRadIC( lat_geoc ); fgic->SetAltitudeASLFtIC(alt); - needTrim=true; + + if (!fdmex->Holding()) + needTrim=true; } void FGJSBsim::set_V_calibrated_kts(double vc) @@ -1061,7 +1083,9 @@ void FGJSBsim::set_V_calibrated_kts(double vc) update_ic(); fgic->SetVcalibratedKtsIC(vc); - needTrim=true; + + if (!fdmex->Holding()) + needTrim=true; } void FGJSBsim::set_Mach_number(double mach) @@ -1073,7 +1097,9 @@ void FGJSBsim::set_Mach_number(double mach) update_ic(); fgic->SetMachIC(mach); - needTrim=true; + + if (!fdmex->Holding()) + needTrim=true; } void FGJSBsim::set_Velocities_Local( double north, double east, double down ) @@ -1088,7 +1114,9 @@ void FGJSBsim::set_Velocities_Local( double north, double east, double down ) fgic->SetVNorthFpsIC(north); fgic->SetVEastFpsIC(east); fgic->SetVDownFpsIC(down); - needTrim=true; + + if (!fdmex->Holding()) + needTrim=true; } void FGJSBsim::set_Velocities_Wind_Body( double u, double v, double w) @@ -1103,7 +1131,9 @@ void FGJSBsim::set_Velocities_Wind_Body( double u, double v, double w) fgic->SetUBodyFpsIC(u); fgic->SetVBodyFpsIC(v); fgic->SetWBodyFpsIC(w); - needTrim=true; + + if (!fdmex->Holding()) + needTrim=true; } //Euler angles @@ -1119,7 +1149,9 @@ void FGJSBsim::set_Euler_Angles( double phi, double theta, double psi ) fgic->SetThetaRadIC(theta); fgic->SetPhiRadIC(phi); fgic->SetPsiRadIC(psi); - needTrim=true; + + if (!fdmex->Holding()) + needTrim=true; } //Flight Path @@ -1137,7 +1169,9 @@ void FGJSBsim::set_Climb_Rate( double roc) if( !(fabs(roc) > 1 && fabs(fgic->GetFlightPathAngleRadIC()) < 0.01) ) { fgic->SetClimbRateFpsIC(roc); } - needTrim=true; + + if (!fdmex->Holding()) + needTrim=true; } void FGJSBsim::set_Gamma_vert_rad( double gamma) @@ -1148,7 +1182,9 @@ void FGJSBsim::set_Gamma_vert_rad( double gamma) if( !(fabs(gamma) < 0.01 && fabs(fgic->GetClimbRateFpsIC()) > 1) ) { fgic->SetFlightPathAngleRadIC(gamma); } - needTrim=true; + + if (!fdmex->Holding()) + needTrim=true; } void FGJSBsim::init_gear(void )