A.3.2.6: Simulator Design A.3.2.6: Simulator Design We simulate the attitude and translational dynamics and control of the launch vehicle by implementing a complex MATLAB SIMULINK model. This model inputs the nominal trajectory and steering law, the initial conditions, and the physical parameters of the launch vehicle. The model maintains the ability to output numerous parameters inside many stages of calculation through SIMULINK scopes. However, we only need certain outputs to understand the motion of the system. For the nominal cases, enough data was recorded to graph the position and steering angles of the launch vehicle. For the Monte Carlo simulation, only periapsis altitude, orbit eccentricity, specific impulses, and mass data were recorded for each run. We consider the simulator to be the final proof-ofconcept for project Bellerophon, since all of the other groups supplied inputs for the simulator. The success or failure of this project largely depends on the simulator’s results. Ve(m/s) Position Desired Sim Position Position Xe(m) Sim Position Desired Position Velocity Nominal Trajectory Sim Velocity Euler Angles v des Vb Sim Angles Desired Angles v sim Angular Velocity Sim Angles Thruster Angles Control Angles Velocity In Body coords . Angular Velocity Angular Acceleration Desired Angles Angular Acceleration Body Acceleration Desired Angles Desired_w mu l h Desired Velocity Body Accelleration Sim_w Inertia Tensor Desired Angular Velocity Inertia Tensor q Controller Attitude Requirements Dynamics /EOMs mu l h q Scopes and Output Figure A.3.2.6.1: Main Dynamics and Control Simulator. (Mike Walker, Alfred Lynam, and Adam Waite) We partition the simulator into the following five interdependent subsystems: The “Nominal Trajectory” subsystem, the “Attitude Requirements” subsystem, the “Controller” subsystem, the “Dynamics/EOMs”, and the “Scopes and Output” subsystem. Figure A.3.2.6.1 illustrates the general program flow of the simulator. Author: Alfred Lynam A.3.2.6: Simulator Design The “Nominal Trajectory” and “Attitude Requirements” subsystems extract the steering law and ephemeris data from MATLAB, and supply the data to the “Controller” subsystem. The “Nominal Trajectory” subsystem interpolates the position and velocity data from an ephemeris file for each of the integrator’s time steps. The interpolated data is fed into “Controller” subsystem and the “Scopes and Outputs” subsystem. x 1 Position y z Clock vx 2 Velocity vy vz Figure A.3.2.6.2: Nominal Trajectory subsystem. (Mike Walker and Adam Waite) The “Attitude Requirements” subsystem uses a lookup table to interpolate the steering law for any time step. The steering law determines the desired steering angles for the “Controller” subsystem. We multiplex the desired steering law with two other Euler angles that represent spin and out of orbit plane rotation. These desired Euler angles are set to zero because there is no spin control and an out of plane component of thrust would only waste propellant. A derivative block was used on the multiplexed desired angle vector to calculate the Euler angle change rates. We next converted the Euler angles and the Euler angle change rates into desired angular velocity via kinematic equations. The desired angles and the desired angular velocity are output to the “Controller” subsystem. Author: Alfred Lynam A.3.2.6: Simulator Design Time _of _flight _init Constant 3 Clock z 1 Desired Angles 0 zero Derivative du /dt angles w angle rate 2 Desired Angular Velocity xform angle rates to w Figure A.3.2.6.3: Attitude Requirements subsystem. (Alfred Lynam and Mike Walker) The “Controller” subsystem determines the proper thrust vector angles used to control the launch vehicle into orbit. The “Controller” subsystem inputs the feedback and desired position, velocity, Euler angles, and angular velocity variables, along with the inertia tensor. We split the “Controller” subsystem into two major portions, the guidance and the autopilot. The purpose of the guidance system is to ensure that the launch vehicle remains on course. The guidance system relies on extra position correction thrusters that are controlled independently of the autopilot. The guidance system theory is explained in the A.3.2.2 section of the report and by Yeh, Cheng, and Fu2. Since Project Bellerophon does not use added thrusters, we determined that a navigation system was not feasible. Author: Alfred Lynam A.3.2.6: Simulator Design 1 Position Desired 2 v des Sim Position 3 Position Desired Sim Position v sim at v des Angles1 a 4 v sim convert a to angles Sim Angles Guidance rd err mag rs 5 Sim Angles WE NEVER USE THIS GUIDANCE SECTION Fail Mode 2 q error quaternion Need another degree of controllability to use it !!!! (ie extra thrusters ) Euler Angles to Quaternions q Desired Angles 6 q Euler Angles to Quaternions 1 Desired _w 9 Inertia Tensor J 8 Sim _w w Mu Moment Angles 1 Thruster Angles Mv Convert from M to angles wd 7 Switch Autopilot Figure A.3.2.6.4: Controller subsystem. (Adam Waite and Mike Walker) The autopilot completely controls the launch vehicle. The autopilot ensures that the thrust vector angles stay as close as possible to the steering law. We convert the feedback and desired Euler angles to quaternions and we use a non-linear quaternion error feedback controller to determine the required thruster moments to follow the steering law. The autopilot control theory is also described in the A.3.2.2 section of the report and by Yeh, Cheng, and Fu2. 3 w wd 4 wd we q<> t1 q4 s surface 2 J 1 q J term 1 <qx>1 J qbar w q q4 M t3 1 Moment wx develop q 's term 3 J t2 w we So term 2 qe Develop Sliding Surface S surface Ta gen _Ta wx w wx Figure A.3.2.6.5: Autopilot subsystem. (Adam Waite and Mike Walker) Author: Alfred Lynam A.3.2.6: Simulator Design The autopilot system outputs the thruster moments to the “Convert from M to angles” subsystem. This subsystem inputs the two moment terms from the “Autopilot” subsystem, the constant center of thrust position, and the constant nominal thrust. We decompose the moments into their requisite transverse forces via the body center of thrust position. We find the “precession” angle “κ” by taking the inverse tangent of the quotient of the two transverse thrust components. The “nutation” angle “δ” is found, next. We determine the axial component of the thrust from the total thrust magnitude and the two transverse components via vector normalization theory. We determine the normalized transverse component by taking the square root of the sum of the squares of the transverse components. The “nutation” angle “δ” is found by taking the inverse tangent of the quotient of the transverse component and the axial component. We output the “precession” angle “κ” and the “nutation” angle “δ” from the “Controller” section to the “Dynamics/EOMs” section. 1 Mu Saturation 2 -1 Constant square 4 Product Constant 1 |u| Saturation 1 1 2 2 |u| square Fu 2 |u| |u| square 2 Thrust |u| 2 delta Saturation sqrt sqrt Thrust Figure A.3.2.6.6: Convert from M to angles subsystem. (Adam Waite and Mike Walker) Author: Alfred Lynam Fz sqrt 2 Constant 2 atan Add sqrt1 square 3 Product 1 1 Angles square 1MATLAB Fcn Fv Ct _Body (3) 2 Mv MATLAB Function To Thrust Vector Product 5 A.3.2.6: Simulator Design We designed the “Dynamics/EOMs” section of the simulator around a built-in simulink block named “Custom Variable Mass 6DoF ECEF (Quaternion)2,” as illustrated in Fig. A.3.2.6.1. This block integrates the full six degree of freedom non-linear equations of motion for a rigid body system. This block requires the following continuous time inputs: The body-fixed forces in Newtons, the body-fixed moments in Newton-meters, the mass flow rate in kilograms per second, the mass in kilograms, the change in moment of inertia over time in kilogram-meters squared per second, and the moment of inertia in kilometermeters squared. The block also requires the initial geodetic latitude, longitude, and altitude in degrees, degrees, and meters, respectively. In addition, the initial velocity in body axes with units of meters per second is required. The initial Euler angle orientation using roll, pitch, and yaw in radians is also required. Finally, the body angular velocity in radians per second with respect to the North-East-Down(NED) frame is required. V F xyz (N) ecef (m/s) Xecef (m) lh M xyz (N-m) ECEF Quaternion (rad ) DCM bi dm /dt (kg/s) DCM be DCM m (kg) 2 Custom Variable Mass dI /dt (kg-m /s) ef Vb (m/s) rel (rad /s) (rad /s) d /dt I (kg-m 2) 2 A (m/s ) b Custom Variable Mass 6DoF ECEF (Quaternion ) Figure A.3.2.6.7: Custom Variable Mass 6DoF ECEF (Quaternion). (Aerospace Toolbox2.) Author: Alfred Lynam A.3.2.6: Simulator Design The block outputs the following data continuously: velocity in the Earth-Centered, EarthFixed(ECEF) frame in meters per second; position in the ECEF frame in meters; geodetic latitude, longitude, and altitude in degrees, degrees, and meters, respectively; the Euler angle orientation using roll, pitch, and yaw in radians; the direction cosine matrix of the coordinate transformation from the Earth-Centered Inertial(ECI) frame to the body-fixed axes; the direction cosine matrix of the coordinate transformation from the geodetic frame to the body-fixed axes; the direction cosine matrix of the coordinate transformation from the ECEF frame to the geodetic frame; velocity in body axes with units of meters per second; the body angular velocity in radians per second with respect to the NorthEast-Down(NED) frame; the body angular velocity in radians per second with respect to the ECI frame; the body angular acceleration in radians per second squared with respect to the ECI frame; and the rectilinear acceleration in body axes with units of meters per second squared. We sent the time histories of most of these variables to scopes in the “Scopes and Outputs” section of the simulator. We fed some of these variables back to other parts of the “Dynamics/EOMs” section or the “Controller” section so that the required continuous time inputs to the solver could be calculated. The first continuous time input is the resultant body-fixed force. We calculate the total body-fixed force by taking the vector sum of the gravity force and the thrust force. The gravity force vector was determined in the “Gravity Force Vector” subsystem by applying the inverse square law. F m / r 2 (A.3.2.6.1) where the force “F” is in Newtons. The radius “r” in meters is found by feeding back the altitude and adding it to the radius of the Earth (assumed to be constant at 6356750 meters). The Earth’s gravitational parameter “ ” is also assumed to be constant at 3.986 x 1014 meters squared per second. Author: Alfred Lynam A.3.2.6: Simulator Design The instantaneous mass in kilograms is fed from the “Mass Calculator” subsystem described later. We multiply or divide these inputs together to calculate the magnitude of the gravity force. We determine the direction of the gravity force, next. We first determine the direction cosine matrix that transforms the gravity matrix from the NED frame to the body frame. The direction cosine matrix is found using the instantaneous Euler angles. We multiply the direction cosine matrix by a column vector with two zeros as the first two terms and the magnitude of the gravity force as the third term. The result of that multiplication is the final gravity force vector. Gravity Force Vector calculator TX 1 TX 2 mass 0 Constant 1 Matrix Multiply Product 1 1 Position G mu l h Product 1 Constant Subsystem 3 Euler Angles DCM be Euler Angles to Direction Cosine Matrix 1 Fxyz grav _flag Product 2 Constant 2 Figure A.3.2.6.8: Gravity Force Vector Calculator Subsystem. (Mike Walker.) We calculate the center of mass position for each time step using the simulink block from the Aerospace toolbox called “Estimate Center of Gravity.” 2 This block inputs the initial and final values of the center of mass, the instantaneous mass, and the instantaneous mass flow rate. The block outputs the instantaneous center of gravity and the instantaneous change rate of the center of gravity. Author: Alfred Lynam A.3.2.6: Simulator Design Drift off 3 h Thrust h Product 1 Thruster Body Forces Thrust Magnitude Calculator Thrust Thrust_Vector F Angles 1 Control Angles Spherical to Rectangular 2 Cg CG M CP 2 Thruster Body Moments Ct_Body CtBody in Vector Moments about CG due to Thrust Figure A.3.2.6.9: Thruster Subsystem. (Mike Walker and Alfred Lynam) The “thruster” subsystem requires the input of the thrust vector angles from the controller, the instantaneous altitude, and the instantaneous center of mass position. The magnitude of the vacuum thrust at any given time is determined by multiplying the average specific impulse (Isp) of the engine by the effective mass flow rate of the engine. We determine the actual thrust by subtracting the ambient pressure at that particular altitude multiplied by the exit area from the vacuum thrust. The ambient pressure was determined using the altitude by the simulink block in the Aerospace toolbox named “COESA Atmosphere Model.” 2 Author: Alfred Lynam A.3.2.6: Simulator Design Thrust (N) ISP Isp AV ISP 1 Thrust eff _md mdot Product Terminator T (K ) a (m/s) 1 h h (m) Saturation COESA P (Pa ) Thrust (N) 3 (kg/m ) COESA Atmosphere Model Switch 0 zero Ae Product 1 Exit Area Figure A.3.2.6.10: Thrust Magnitude Calculator Subsystem. (Mike Walker.) We determine the thrust vector by implementing the thrust vector angles as spherical coordinates. We note that the thrust vector angles that the controller gives are saturated such that the maximum thrust vector angle is 10 degrees. The conversion equations implemented into our simulator are as follows: Tx T sin cos (A.3.2.6.2) Ty T sin sin (A.3.2.6.3) Tz T cos (A.3.2.6.4) where Tx, Ty, and Tz are the body thrust vector elements in Newtons, T is the force magnitude, δ is the thrust vector “nutation” angle, and κ is the thrust vector “precession” angle. The values of Tx, Ty, and Tz were multiplexed into the final thrust vector and output. We added the thrust force and the gravity force together and inputted the result into the “Custom Variable Mass 6DoF ECEF (Quaternion)” block. Author: Alfred Lynam A.3.2.6: Simulator Design The second continuous time input is the body fixed moments. The gravity moment is assumed to be negligible, since the center of mass and the center of gravity are assumed to be approximately coincident. Thus, the thruster moments and the aerodynamic moments are the only moments taken into account. We calculate the thrust moment using another simulink block from the Aerospace toolbox called “Moments about CG due to Forces.” 2 This block inputs the thrust vector, the center of mass, and the position of the thruster (named center of thrust), and outputs the thruster body moment vector. The aerodynamic moment is calculated using the aerodynamic force, the center of pressure, and the center of mass using the same block. We calculated the aerodynamic force using a constant coefficient of drag for the x direction, and curve fits based on Mach number for the y and z directions. We multiplied each coefficient of drag by the dynamic pressure determined from the velocity of the rocket and the density of the atmosphere determined by the “COESA Atmosphere Model” to calculate the drag force. The lift was assumed to be negligible. Unfortunately, due to an oversight, the aerodynamic forces were not output to the main program for the simulations, so they only affected the calculation of aerodynamic moments. We added together the aerodynamic and thruster moments to form the body-fixed moments inputted into the “Custom Variable Mass 6DoF ECEF (Quaternion)” block. Mass Calculator Step 1 Mass Flow Rate -dmdt Constant Product 1 s Integrator Saturation Figure A.3.2.6.11: Mass Calculator Subsystem. (Mike Walker) Author: Alfred Lynam 2 Mass A.3.2.6: Simulator Design The third continuous time input is mass flow rate, but it is not input because it adds an additional thrust force inside the “Custom Variable Mass 6DoF ECEF (Quaternion)” block that is redundant with the thrust force. The fourth continuous time input is the mass. The mass is determined by integrating the mass flow rate for each individual time step from an empty tank to a full tank. This value is output to the gravity force calculator and the center of mass calculator in addition to the “Custom Variable Mass 6DoF ECEF (Quaternion).” The fifth and sixth continuous time inputs are the moment of inertia change rate and the moment of inertia. We calculated both of these values using the simulink block in the Aerospace toolbox named “Estimate Inertia Tensor.” This block inputs the instantaneous mass flow rate, the instantaneous mass, and the initial and final inertia tensors. All of the previously described subsystems are connected together to form the “Dynamics/EOM” subsystem of the simulator. h Vwind h Euler Angles dm /dt Mxyz Vwind Cg Calculate Wind mass Aero Forces Vxyz V Free qz Sum Moments V free CG Aerodynamic forces /moments F xyz M 2 Ve(m/s) Xe (m) lh 8 3 mu l h (rad ) DCM Euler Angles X ecef (m) Control Angles Thruster Body Forces Cg Thruster Body Moments h Mass Thruster Mass Calculator mass I dm /dt dI /dt Fxyz Euler Angles Gravity Force Vector (N-m) Sum Forces Mass Flow Rate Position xyz Estimate Inertia Tensor 9 Inertia Tensor 1 Vecef (m/s) (N) dCG /dt Estimate Center of Gravity 1 Control Angles mass 10 q dm /dt (kg/s) ECEF Quaternion Custom Variable Mass bi DCM be C DCM ef To Workspace m (kg) 4 V b (m/s) Vb rel (rad /s) 5 dI /dt (kg-m 2/s) (rad /s)Angular Velocity d /dt 6 I (kg-m 2) A (m/s2) Angular Acceleration b 7 Custom Variable Mass 6DoF Body Acceleration ECEF (Quaternion ) Figure A.3.2.6.12: Dynamics/EOM subsystem (Most connectors disconnected). (Mike Walker, Alfred Lynam, and Adam Waite) The “Scopes and Outputs” subsystem merely outputs values of interest to the user or to the workspace using scopes. The most important outputs from this section are the ideal and actual steering law angle “Xi”, the altitude “h”, the final velocity, and the final position. The steering law output allows the fidelity of the simulated trajectory to be analyzed. The altitude output allows the user to qualitatively determine if the rocket catastrophically crashes into the Earth or incinerates in the atmosphere. The final velocity and position provide sufficient conditions for orbit determination. Author: Alfred Lynam A.3.2.6: Simulator Design 9 Desired Velocity Vx w1 7 Angular Velocity w2 1 Sim Velocity 2 Sim Position X_Pos 3 Desired Position Y_Pos Vy w3 sqrt Dot Product 6 Velocity In Body coords . 4 Sim Angles angle r angle Math Function Vz1 Vz 8 Terminator 3 Angular Acceleration Z_Pos l 11 mu l h Vbx Vby du /dt Vbz Xi Derivative du /dt Resolve Angle 2 Xidot Fail Mode 2 q Psi Fail Mode 1 10 du /dt Derivative 2 eta h q 12 Derivative 1 psidot 5 angle r angle Desired Angles Resolve Angle 1 mu h Body Accelleration Body Accelleration 1 Eta Figure A.3.2.6.13: Scopes and Output subsystem. (Mike Walker, Alfred Lynam, and Adam Waite) References: 1 Fu-Kuang Yeh, Kai-Yuan Cheng, and Li-Chen Fu “Rocket Controller Design with TVC and DCS” National Taiwan University, Taipei, Taiwan 2003 2 Aerospace Toolkit and Aerospace Blockset are part of MATLAB and SIMULINK. Both registered trademarks: 1984-2007 by The MathWorks, Inc. Author: Alfred Lynam