From: Bertrand <bco...@us...> - 2016-04-16 12:24:42
|
Update of /cvsroot/jsbsim/JSBSim/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25940/src Modified Files: FGFDMExec.cpp FGFDMExec.h Log Message: The forces/hold-down feature now zeroes the velocities to make sure that the aircraft is motionless once the property is enabled. To get this result the property is now managed by FGFDMExec that coordinates FGAccelerations and FGPropagate so that they remain in a consistent state. Index: FGFDMExec.cpp =================================================================== RCS file: /cvsroot/jsbsim/JSBSim/src/FGFDMExec.cpp,v retrieving revision 1.188 retrieving revision 1.189 diff -C2 -r1.188 -r1.189 *** FGFDMExec.cpp 16 Apr 2016 12:01:51 -0000 1.188 --- FGFDMExec.cpp 16 Apr 2016 12:24:39 -0000 1.189 *************** *** 101,104 **** --- 101,105 ---- ResetMode = 0; RandomSeed = 0; + HoldDown = false; IncrementThenHolding = false; // increment then hold is off by default *************** *** 174,177 **** --- 175,179 ---- instance->Tie("simulation/frame", (int *)&Frame, false); instance->Tie("simulation/trim-completed", (int *)&trim_completed, false); + instance->Tie("forces/hold-down", this, &FGFDMExec::GetHoldDown, &FGFDMExec::SetHoldDown); Constructing = false; *************** *** 621,624 **** --- 623,639 ---- //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + void FGFDMExec::SetHoldDown(bool hd) + { + HoldDown = hd; + Accelerations->SetHoldDown(hd); + if (hd) { + Propagate->in.vPQRidot = Accelerations->GetPQRidot(); + Propagate->in.vUVWidot = Accelerations->GetUVWidot(); + } + Propagate->SetHoldDown(hd); + } + + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + vector <string> FGFDMExec::EnumerateFDMs(void) { Index: FGFDMExec.h =================================================================== RCS file: /cvsroot/jsbsim/JSBSim/src/FGFDMExec.h,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -r1.104 -r1.105 *** FGFDMExec.h 13 Dec 2015 07:54:48 -0000 1.104 --- FGFDMExec.h 16 Apr 2016 12:24:39 -0000 1.105 *************** *** 579,582 **** --- 579,593 ---- void Initialize(FGInitialCondition *FGIC); + /** Sets the property forces/hold-down. This allows to do hard 'hold-down' + such as for rockets on a launch pad with engines ignited. + @param hd enables the 'hold-down' function if non-zero + */ + void SetHoldDown(bool hd); + + /** Gets the value of the property forces/hold-down. + @result zero if the 'hold-down' function is disabled, non-zero otherwise. + */ + bool GetHoldDown(void) const {return HoldDown;} + private: int Error; *************** *** 633,637 **** bool StandAlone; FGPropertyManager* instance; ! // The FDM counter is used to give each child FDM an unique ID. The root FDM has the ID 0 unsigned int* FDMctr; --- 644,650 ---- bool StandAlone; FGPropertyManager* instance; ! ! bool HoldDown; ! // The FDM counter is used to give each child FDM an unique ID. The root FDM has the ID 0 unsigned int* FDMctr; |