Building Software for Simulation: Theory and Algorithms, with Applications in C++
This book offers a concise introduction to the art of building simulation software, collecting the most important concepts and algorithms in one place. Written for both individuals new to the field of modeling and simulation as well as experienced practitioners, this guide explains the design and implementation of simulation software used in the engineering of large systems while presenting the relevant mathematical elements, concept discussions, and code development.
The book approaches the topic from the perspective of Zeigler's theory of modeling and simulation, introducing the theory's fundamental concepts and showing how to apply them to engineering problems. Readers will learn five necessary skills for building simulations of complicated systems:
- Working with fundamental abstractions for simulating dynamic systems
- Developing basic simulation algorithms for continuous and discrete event models
- Combining continuous and discrete event simulations into a coherent whole
- Applying strategies for testing a simulation
- Understanding the theoretical foundations of the modeling constructs and simulation algorithms
The central chapters of the book introduce, explain, and demonstrate the elements of the theory that are most important for building simulation tools. They are bracketed by applications to robotics, control and communications, and electric power systems; these comprehensive examples clearly illustrate how the concepts and algorithms are put to use. Readers will explore the design of object-oriented simulation programs, simulation using multi-core processors, and the integration of simulators into larger software systems.
The focus on software makes this book particularly useful for computer science and computer engineering courses in simulation that focus on building simulators. It is indispensable reading for undergraduate and graduate students studying modeling and simulation, as well as for practicing scientists and engineers involved in the development of simulation tools.
1.1 Elements of a Software Architecture.
1.2 Systems Concepts as an Architectural Foundation.
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.
3 DISCRETE-TIME SYSTEMS.
3.1 Atomic Models.
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.
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.
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.
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.2 Frequency Regulation in an Electrical Power System.
6.2.2 Transmission Network and Electrical Loads.
6.2.3 Frequency Monitoring and Load Actuation.
6.2.4 Software Implementation.
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.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.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.
"Written by leading experts in the field, this book (which is complementary to Fatigue of Materials and Structures: Application to Damage and Design, also edited by Claude Bathias and Andr Pineau), provides an authoritative, comprehensive and unified treatment of the mechanics and micromechanisms of fatigue in metals, polymers and composites." (PR-Inside.com, 15 March 2011)
"This book offers a concise introduction to the art of building simulation software, collecting the most important concepts and algorithms in one place." (Robotics Technology, 15 March 2011)