/// <summary> /// Initializes the trimming class /// </summary> /// <param name="fdmexec">a JSBSim executive object</param> /// <param name="tm">trim mode</param> public Trim(FDMExecutive exec, TrimMode tm) { N = Nsub = 0; max_iterations = 60; max_sub_iterations = 100; Tolerance = 1E-3; A_Tolerance = Tolerance / 10; Debug = 0; DebugLevel = 0; fdmex = exec; fgic = fdmex.GetIC(); total_its = 0; trimudot = true; gamma_fallback = true; axis_count = 0; mode = tm; xlo = xhi = alo = ahi = 0.0; targetNlf = 1.0; debug_axis = StateType.All; SetMode(tm); if (log.IsDebugEnabled) { log.Debug("Instantiated: FGTrim"); } }
/// <summary> /// Constructor /// </summary> /// <param name="exec">the parent executive object</param> public State(FDMExecutive exec) { FDMExec = exec; sim_time = 0.0; dt = 1.0 / 120.0; Bind(); }
/// <summary> /// Constructor /// </summary> /// <param name="exec"></param> public Force(FDMExecutive exec) { FDMExec = exec; mT = Matrix3D.Identity; vSense = Vector3D.Zero; if (log.IsDebugEnabled) { log.Debug("Instantiated: Force."); } }
public TrimAxis(FDMExecutive exec, InitialCondition ic, StateType st, ControlType ctrl) { fdmex = exec; fgic = ic; state = st; control = ctrl; max_iterations = 10; control_value = 0; its_to_stable_value = 0; total_iterations = 0; total_stability_iterations = 0; state_convert = 1.0; control_convert = 1.0; state_value = 0; state_target = 0; switch (state) { case StateType.Udot: tolerance = DEFAULT_TOLERANCE; break; case StateType.Vdot: tolerance = DEFAULT_TOLERANCE; break; case StateType.Wdot: tolerance = DEFAULT_TOLERANCE; break; case StateType.Qdot: tolerance = DEFAULT_TOLERANCE / 10; break; case StateType.Pdot: tolerance = DEFAULT_TOLERANCE / 10; break; case StateType.Rdot: tolerance = DEFAULT_TOLERANCE / 10; break; case StateType.Hmgt: tolerance = 0.01; break; case StateType.Nlf: state_target = 1.0; tolerance = 1E-5; break; case StateType.All: break; } solver_eps = tolerance; switch (control) { case ControlType.Throttle: control_min = 0; control_max = 1; control_value = 0.5; break; case ControlType.Beta: control_min = -30 * Constants.degtorad; control_max = 30 * Constants.degtorad; control_convert = Constants.radtodeg; break; case ControlType.Alpha: control_min = fdmex.Aerodynamics.AlphaCLMin; control_max = fdmex.Aerodynamics.AlphaCLMax; if (control_max <= control_min) { control_max = 20 * Constants.degtorad; control_min = -5 * Constants.degtorad; } control_value = (control_min + control_max) / 2; control_convert = Constants.radtodeg; solver_eps = tolerance / 100; break; case ControlType.PitchTrim: case ControlType.Elevator: case ControlType.RollTrim: case ControlType.Aileron: case ControlType.YawTrim: case ControlType.Rudder: control_min = -1; control_max = 1; state_convert = Constants.radtodeg; solver_eps = tolerance / 100; break; case ControlType.AltAGL: control_min = 0; control_max = 30; control_value = fdmex.Propagate.DistanceAGL; solver_eps = tolerance / 100; break; case ControlType.Theta: control_min = fdmex.Propagate.GetEuler().Theta - 5 * Constants.degtorad; control_max = fdmex.Propagate.GetEuler().Theta + 5 * Constants.degtorad; state_convert = Constants.radtodeg; break; case ControlType.Phi: control_min = fdmex.Propagate.GetEuler().Phi - 30 * Constants.degtorad; control_max = fdmex.Propagate.GetEuler().Phi + 30 * Constants.degtorad; state_convert = Constants.radtodeg; control_convert = Constants.radtodeg; break; case ControlType.Gamma: solver_eps = tolerance / 100; control_min = -80 * Constants.degtorad; control_max = 80 * Constants.degtorad; control_convert = Constants.radtodeg; break; case ControlType.Heading: control_min = fdmex.Propagate.GetEuler().Psi - 30 * Constants.degtorad; control_max = fdmex.Propagate.GetEuler().Psi + 30 * Constants.degtorad; state_convert = Constants.radtodeg; break; } }