# 2024.04.15 Psuedo Code written for a "Simulation Loop Presentation" # This modular design is based on a Northrop-Grumman project # completed in 2019. # # This simulation loop passes state data by reference. # The subsystems operate on the state data and return. # All of the subsystems have the following characteristics: # # * stand-alone model design # * unit testable # * independent ( no reliance on global data ) # #include "stateData.h"; #include "propulsion.h"; #include "seeker.h"; #include "guidance.h"; #include "kinematics.h"; #include "autoPilot.h"; #include "navigation.h"; int main() { // call constructors CStateData state; CPropulsion propulsion; CSeeker seeker; CGuidance guidance; CKinematics kinematics; CAutoPilot autoPilot; CNavigation navigation; // loop til HIT or MISS while (state.hitOrFailureFlag == 0) { propulsion.update( state.ThrustNewtons&, state.MassKg& ); seeker.update ( state.Target&, state.Active&, state.Gimbal& ); guidance.update ( state.PropNav&, state.Collision& ); kinematics.update( state.Forces& ); autoPilot.update ( state.Steering&, state.YawRads&, state.PitchRads& ); navigation.update( state.IMU&, state.DataFusion&, state.hitOrFailureFlag& ); #ifdef DEBUG state.SerializeStateData(stream); #endif } return 0; }