Generic Attitude and Orbit Control Simulator development supporting the AOCS software life cycle E. Mooij and Q.G.J. Wijnands 7th International Workshop on Simulation for European Space Programmes Noordwijk, November 12, 2002 Introduction w w w Extensive experience at Dutch Space has resulted in a generic approach for development, integration, verification and validation of onboard software for AOCS and Data/Handling systems Up to phase C/D there is a need for rapid-prototyping, mission and system definition, and control-law design Interconnected paths for: – – – – w w rapid prototyping control-algorithm design and verification on-board software development, and integration thereof with dedicated (flight) hardware in the control loop Pre-phase C/D development is characterised by an iterative design process with many iterations and verification runs, with no direct need for real-time simulations The development can be supported by the use of a MATLAB/Simulink based Generic AOCS facility 1 Simulator development w User Requirements w GAOCS Simulator elements – Matlab/Simulink Environment: – – – – – EuroSim Environment – – – w Physical modelling Simulator architecture Functional verification Example application Real-Time Workshop MOSAIC EuroSim Software in the loop Test Facility Conclusions and Recommendations 2 Matlab/Simulink Environment Physical modelling (1) w Equations of (translational and rotational) motion for a rigid satellite with up to 4 solar panels, with Earth as central body w Sun and Moon as perturbing third bodies w Tabulated atmosphere according to MSIS-86 w Gravitational field according to inverse-square law (+J2, J3 and J4) or GRIM-5C1 (spherical harmonics, n=m=99) w Geomagnetic field based on IGRF-95 (spherical harmonics, n=m=10) w Solar radiation according to inverse-square law 3 Matlab/Simulink Environment Physical modelling (2) 90 9.77 9.78 9.79 9.8 9.81 latitude (deg) 45 0 Gravitational acceleration in m/s2 at the Earth's surface (GRIM5-C1, n = m = 8) 9.81 9.8 9.79 9.78 -45 9.77 -90 -180 -120 -60 0 longitude (deg) 60 120 180 90 0 45 -150 latitude (deg) Difference in gravitational acceleration in mm/s2 (GRIM5-C1 versus central field including zonal harmonics up to J4) -150 150 0 -150 -300 0 300 -300 0 -300 0 -300 -150 150 500 -600 300 0 150 150 -150 -45 -1 150 300 150 -150 -3 -300 -90 -180 -150 -120 -60 0 longitude (deg) 60 120 180 4 Matlab/Simulink Environment Simulator architecture (1) w Graphical User Interface, for editing input data and plotting results w Generic core for flight dynamics and spacecraft environment w Additional sub-systems: – AOCS logic – – – – – – w Mission manager Orbit-control logic Attitude-control algorithm State estimator Actuators Sensors Dedicated Simulink library with sensors and actuators 5 Matlab/Simulink Environment Simulator architecture (2) Edit Window: Body Characteristics Edit Window: Dynamics 6 Matlab/Simulink Environment Simulator architecture (3) Facility to plot simulation results 7 Matlab/Simulink Environment Simulator architecture (4) User-defined sub-systems Generic core Main Simulink AOCS simulator window 8 Matlab/Simulink Environment Simulator architecture (5) Simulink AOCS logic sub-system 9 Matlab/Simulink Environment Simulator architecture (6) Main Library Simulink window Sensor Library Actuator Library 10 Matlab/Simulink Environment Simulator architecture (7) w Performance improvement by replacing Matlab scripts by C-coded S-functions (so-called CMEX S-functions) w Simulator porting to EuroSim – – Relatively easy due to use of CMEX functions Use Real-Time Workshop to autogenerate C-code of Simulink simulator structure 11 Matlab/Simulink Environment Functional verification (1) w Time propagation, both in relative and absolute sense, and frame and co-ordinate transformations w Environment, consisting of the Earth's gravitational and magnetic field, the Earth's atmosphere, the motion of Moon and Sun and the interplanetary environment w Equations of motion, focusing on both translational and rotational motion, and the numerical aspects due to the integration of the differential equations w Perturbations, of gravitational origin, due to third-bodies (Sun and Moon), the Earth-magnetic field, the Solar radiation and the working of the upper atmosphere 12 Matlab/Simulink Environment Functional verification (2) 90 60 60 latitude (deg) 45 50 45 55 35 40 40 0 25 55 60 -45 35 60 -90 -180 30 45 50 55 -120 -60 0 longitude (deg) 60 120 180 Total magnetic field intensity at the Earth's surface (in mT), matches with results (and extrapolation) in Wertz (1978) 13 Matlab/Simulink Environment Functional verification (3) Verification date and time, in combination with Earth’s orbit around the Sun 8 2 x 10 1.5 8 3D orbit x 10 Summer Solstice relative Sun orbit 1 1 0.5 Z-position [km] Y-position [km] Earth 0.5 Autumnal Equinox 0 Vernal Equinox 0 -0.5 Earth -0.5 -1 2 -1 1 -1.5 -2 -2 8 x 10 Winter Solstice -1.5 -1 -0.5 0 0.5 X-position [km] 1 1.5 2 2 1 0 0 -1 Y-position [km] -1 -2 -2 8 x 10 X-position [km] 8 x 10 Relative in-plane and 3D orbit of the Sun “around” the Earth 14 Matlab/Simulink Environment 90 Functional verification (4) Molniya-type orbit 0 -45 -90 -180 -120 -60 0 longitude (deg) 60 120 180 -120 -60 90 45 geostationary transfer orbit latitude (deg) latitude (deg) 45 0 -45 -90 -180 0 longitude (deg) 60 120 180 15 Matlab/Simulink Environment Functional verification (5) Test #1: Rotational motion due to magnetic perturbations; location above the equator, qv,0 = 10°, MM,x = 1000 Am2 Conservative rotational motion, mean values of about fV = -2.5°, qV = 17.5° and yV = -9° Test #2: Variation in magentic field vector: BV,0 = (1.354,-0.224,-0.430)×10-5 T (t = 1.9113°, d = 0° , R = 8000 km) Vector product of BB and MM will be zero, only BB,x ¹ 0 4 16 12 -2 8 10 12 14 16 18 thetav (deg) 20 22 24 26 5 0 8 6 -10 0 -15 -2 psiv (deg) 2 8 10 12 14 16 18 thetav (deg) 20 22 24 26 y-component z-component 4 -5 -20 x-component 10 -4 -6 -6 14 0 BB (Tesla) phiv (deg) 2 x 10 -4 0 200 400 600 time (sec) 800 1000 16 Matlab/Simulink Environment Example application (1) 1.4 1.2 Demand 1 0.02s+1 J.s 1 s Controller Torque to Rate Rate to Angle 1 1 Angle 2 pseudo angle (deg) 8s+3 1 0.8 0.6 0.4 Rate 0.2 0 0 5 10 15 20 25 time (sec) w Implement single-axis PD controller for all three axes w Add three-axes generic actuator and gyroscope sensor w Sample (and integrate) sensors at 10 Hz w Apply three different step functions (command signals) 17 Matlab/Simulink Environment Example application (2) Control algorithm State error 400z-397 z-0.006738 + Step_x X Controller 1 1 1 z-0.006738 state error mission profile Step_y 400z-397 em commanded actuator state Y Controller - 400z-397 z-0.006738 Step_z Z Controller Mission Manager 0 0 0 1 em commanded actuator state commanded X-moment actual X-moment commanded Y -moment actual Y -moment commanded Z-moment actual Z-moment 1 control forces and moments 3-axes generic actuator Actuators State estimator Tz 1 em measure attitude state z-1 Tz 1 Tz z-1 z z-1 1 Flight Dynamics estimated attitude state Sensors Bus selector Measured angular rate 1 Actual angular rate 1 1 measured state attitude control Measured angular rate 2 Actual angular rate 2 Measured angular rate 3 Actual angular rate 3 three-channel gyroscope em 1 actual_state 18 Matlab/Simulink Environment Example application (3) X angle (deg) 3 2 1 0 0 5 10 15 time (sec) 20 25 30 0 5 10 15 time (sec) 20 25 30 0 5 10 15 time (sec) 20 25 30 Y angle (deg) 3 2 1 0 -1 Z angle (deg) 3 2 1 0 -1 Step functions for X, Y and Z pseudo angles. 19 EuroSim Environment w Adapt Simulink sub-system models and use RTW to generate C-code w Use MOSAIC (NLR) to generate shell around RTW output for implementation in EuroSim w Re-connect sub-system models and create EuroSim schedule w Experiences: – – porting is a not straight-forward, cautious process identified problems (e.g., integration and output order) 20 EuroSim Environment X angle (deg) 3 2 1 0 0 5 10 15 time (sec) 20 25 30 0 5 10 15 time (sec) 20 25 30 0 5 10 15 time (sec) 20 25 30 5 10 15 time (sec) 20 25 30 5 10 15 time (sec) 20 25 30 5 10 15 time (sec) 20 25 30 3 Y angle (deg) Matlab RTW Code 2 1 0 -1 Z angle (deg) 3 Code generated from Simulink 2 1 0 -1 -16 x 10 0.5 0 -0.5 -1 0 -16 x 10 1 Y angle (rad) Code from C-mex Sfunctions X angle (rad) 1 0.5 0 -0.5 EuroSim Schedule Z angle (rad) -1 0 -17 x 10 5 0 -5 -10 -15 0 21 EuroSim Software in the Loop Test Facility bus 1 bus 2 bus 3 actuator sensor control MIL 1553 Data bus Coupler LAN LAN MIL Front End VME Step 2 Control Software AOCS Workstation Mil-1553 interface EuroSim Mil1553 Mil-1553 interface Step 1 MIL 1553 Data bus Coupler LAN PCI Bus Bridge Control Model Sensor Model 1 2 3 VME Bus Bridge Actuat Model PCI Bus Bridge EuroSim Workstation LAN SW Mil-1553 GAOCS Test Facility Gustavo. J. Ruwiel 06/02/2002 SW Mil-1553 LAN SW Mil-1553 SW Mil-1553 Mil-1553 interface VME Bus Bridge MIL Front End VME Testcase 1 1 Sensor Model Actuat Model EuroSim Workstation Testcase 2 22 Summary and conclusions w Generic simulator for rigid satellites in Earth environment has been designed and implemented in Matlab/Simulink w Each of the individual models as well as the combination of several models has been evaluated and judged to be correctly implemented w Performance improvement by factor of 20, by using C-coded Sfunctions w Basis for further development of Generic EuroSim AOCS simulation environment for SIL and HIL testing w (Potential) customers: HERSCHEL, ConeXpres, EarthCare, EXPERT re-entry vehicle, EsimSat, ... 23 Recommendations w Modelling: – – – – – w EuroSim: – w Additional satellite shapes, i.e., cone and sphere, which includes the adjustment of the solar-radiation pressure and atmospheric perturbation models Addition of tip masses to the appendages Flexible appendages Mass variation due to fuel consumption, including sloshing models Sun as central body for interplanetary missions Development of GUI, possibly combined with Matlab/Simulink GUI SILT/HILT: – – GAOCS simulator with MIL-1553 communication Dedicated (flight) hardware in loop 24