43 #include "FGFDMExec.h" 44 #include "FGJSBBase.h" 45 #include "FGInitialCondition.h" 51 #define ID_TRIMAXIS "$Id: FGTrimAxis.h,v 1.7 2013/11/24 16:53:15 bcoconni Exp $" 53 #define DEFAULT_TOLERANCE 0.001 61 const std::string StateNames[] = {
"all",
"udot",
"vdot",
"wdot",
"qdot",
"pdot",
64 const std::string ControlNames[] = {
"Throttle",
"Sideslip",
"Angle of Attack",
65 "Elevator",
"Ailerons",
"Rudder",
66 "Altitude AGL",
"Pitch Angle",
67 "Roll Angle",
"Flight Path Angle",
68 "Pitch Trim",
"Roll Trim",
"Yaw Trim",
72 class FGInitialCondition;
85 enum State { tAll,tUdot,tVdot,tWdot,tQdot,tPdot,tRdot,tHmgt,tNlf };
86 enum Control { tThrottle, tBeta, tAlpha, tElevator, tAileron, tRudder, tAltAGL,
87 tTheta, tPhi, tGamma, tPitchTrim, tRollTrim, tYawTrim, tHeading };
108 double GetState(
void) { getState();
return state_value; }
110 inline void SetControl(
double value ) { control_value=value; }
111 inline double GetControl(
void) {
return control_value; }
113 inline State GetStateType(
void) {
return state; }
114 inline Control GetControlType(
void) {
return control; }
116 inline std::string GetStateName(
void) {
return StateNames[state]; }
117 inline std::string GetControlName(
void) {
return ControlNames[control]; }
119 inline double GetControlMin(
void) {
return control_min; }
120 inline double GetControlMax(
void) {
return control_max; }
122 inline void SetControlToMin(
void) { control_value=control_min; }
123 inline void SetControlToMax(
void) { control_value=control_max; }
125 inline void SetControlLimits(
double min,
double max) {
130 inline void SetTolerance(
double ff) { tolerance=ff;}
131 inline double GetTolerance(
void) {
return tolerance; }
133 inline double GetSolverEps(
void) {
return solver_eps; }
134 inline void SetSolverEps(
double ff) { solver_eps=ff; }
136 inline int GetIterationLimit(
void) {
return max_iterations; }
137 inline void SetIterationLimit(
int ii) { max_iterations=ii; }
139 inline int GetStability(
void) {
return its_to_stable_value; }
140 inline int GetRunCount(
void) {
return total_stability_iterations; }
141 double GetAvgStability(
void );
143 inline void SetStateTarget(
double target) { state_target=target; }
144 inline double GetStateTarget(
void) {
return state_target; }
146 void AxisReport(
void);
148 bool InTolerance(
void) { getState();
return (fabs(state_value) <= tolerance); }
160 double control_value;
169 double state_convert;
170 double control_convert;
174 int its_to_stable_value;
175 int total_stability_iterations;
176 int total_iterations;
178 void setThrottlesPct(
void);
181 void getControl(
void);
182 void setControl(
void);
184 double computeHmgt(
void);
186 void Debug(
int from);
void Run(void)
This function iterates through a call to the FGFDMExec::RunIC() function until the desired trimming c...
Initializes the simulation run.
FGTrimAxis(FGFDMExec *fdmex, FGInitialCondition *IC, State state, Control control)
Constructor for Trim Axis class.
Encapsulates the JSBSim simulation executive.