This book offers a concise introduction to the art of building simulation software. It clearly demonstrates the five skills necessary for building simulations of complicated systems: abstractions for simulation dynamic systems; basic simulation algorithms for continuous and discrete event simulations; combining continuous and discrete event simulations into a coherent whole; strategies for testing a simulation; and theoretical foundations of the modeling constructs and simulation algorithms. This is indispensable reading for software programmers, developers, and engineers, and students in related courses.
PREFACE.1 INTRODUCTION.
1.1 Elements of a Software Architecture.
1.2 Systems Concepts as an Architectural Foundation.
1.3 Summary.
1.4 Organization of the Book.
2 FIRST EXAMPLE: SIMULATING A ROBOTIC TANK.
2.1 Functional Modeling.
2.2 A Robotic Tank.
2.2.1 Equations of Motion.
2.2.2 Motors, Gearbox, and Tracks.
2.2.3 Complete Model of the Tank?s Continuous Dynamics.
2.2.4 The Computer.
2.2.5 Complete Model of the Tank.
2.3 Design of the Tank Simulator.
2.4 Experiments.
2.5 Summary.
3 DISCRETE-TIME SYSTEMS.
3.1 Atomic Models.
3.1.1 Trajectories.
3.1.2 The State Transition and Output Function.
3.1.3 Two Examples of Atomic, Discrete-Time Models.
3.1.4 Systems with Bags for Input and Output.
3.1.5 A Simulator for Atomic Models.
3.2 Network Models.
3.2.1 The Parts of a Network Model.
3.2.2 The Resultant of a Network Model.
3.2.3 An Example of a Network Model and Its Resultant.
3.2.4 Simulating the Resultant.
3.3 A Simulator for Discrete-Time Systems.
3.4 Mealy/Moore-Type Systems.
3.5 Cellular Automata.
3.6 Summary.
4 DISCRETE-EVENT SYSTEMS.
4.1 Atomic Models.
4.1.1 Time and Trajectories.
4.1.2 The State Transition Function.
4.1.3 The Output Function.
4.1.4 Legitimate Systems.
4.1.5 An Example of an Atomic Model.
4.1.6 The Interrupt Handler in the Robotic Tank.
4.1.7 Systems with Bags for Input and Output.
4.1.8 A Simulator for Atomic Models.
4.1.9 Simulating the Interrupt Handler.
4.2 Network Models.
4.2.1 The Parts of a Network Model.
4.2.2 The Resultant of a Network Model.
4.2.3 An Example of a Network Model and Its Resultant.
4.2.4 Simulating the Resultant.
4.3 A Simulator for Discrete-Event Systems.
4.3.1 The Event Schedule.
4.3.2 The Bag.
4.3.3 The Simulation Engine.
4.4 The Computer in the Tank.
4.5 Cellular Automata Revisited.
4.6 Summary.
5 HYBRID SYSTEMS.
5.1 An Elementary Hybrid System.
5.2 Networks of Continuous Systems.
5.3 Hybrid Models as Discrete-Event Systems.
5.4 Numerical Simulation of Hybrid Systems.
5.5 A Simulator for Hybrid Systems.
5.6 Interactive Simulation of the Robotic Tank.
5.6.1 Correcting the Dynamics of a Turn.
5.6.2 A Simplified Model of the Motor.
5.6.3 Updating the Display.
5.6.4 Implementing the Tank Physics.
5.7 Approximating Continuous Interaction Between Hybrid Models.
5.8 A Final Comment on Cellular Automata.
5.8.1 Differential Automata with Constant Derivatives.
5.8.2 Modeling Asynchronous Cellular Automata with Differential Automata.
5.8.3 A Homomorphism from Differential Automata to Asynchronous Cellular Automata.
5.9 Summary.
6 APPLICATIONS.
6.1 Control Through a Packet-Switched Network.
6.1.1 Model of the Pendulum and Its PID Controller.
6.1.2 Integration with an Ethernet Simulator.
6.1.3 Experiments.
6.2 Frequency Regulation in an Electrical Power System.
6.2.1 Generation.
6.2.2 Transmission Network and Electrical Loads.
6.2.3 Frequency Monitoring and Load Actuation.
6.2.4 Software Implementation.
6.2.5 Experiments.
6.3 Summary.
7 THE FUTURE.
7.1 Simulation Programming Languages.
7.2 Parallel Computing and Discrete-Event Simulation.
7.3 The Many Forms of Discrete Systems and Their Simulators.
7.4 Other Facets of Modeling and Simulation.
APPENDIX A DESIGN AND TEST OF SIMULATIONS.
A.1 Decomposing a Model.
A.1.1 Bottom-Up Testing.
A.1.2 Invariants and Assertions.
A.2 Input and Output Objects.
A.2.1 Simple Structures.
A.2.2 Unions.
A.2.3 Pointers and Hierarchies of Events.
A.2.4 Mixing Strategies with Model Wrappers.
A.3 Reducing Execution Time.
APPENDIX B PARALLEL DISCRETE EVENT SIMULATION.
B.1 A Conservative Algorithm.
B.1.1 Lookahead.
B.1.2 The Algorithm.
B.2 Implementing the Algorithm with OpenMP.
B.2.1 Pragmas, Volatiles, and Locks.
B.2.2 Overview of the Simulator.
B.2.3 The LogicalProcess.
B.2.4 The MessageQ.
B.2.5 The ParSimulator.
B.3 Demonstration of Gustafson?s and Amdahl?s Laws.
APPENDIX C MATHEMATICAL TOPICS.
C.1 System Homomorphisms.
C.2 Sinusoidal State-Steady Analysis.
REFERENCES.
INDEX.