This documentation describes the C++ application programming interface to Ssim, a very simple discrete-event sequential simulation library. The simulator implemented by ssim executes reactive processes. These processes are defined in terms of discrete execution steps performed at given times, or in response to an interaction (an event) with another process. During the execution of an action, a process may schedule other future actions for itself, or it may signal events to another processes, which will respond by processing the signalled events at the given time. The simulation terminates when no more actions are scheduled.
The ssim library consists of essentially two classes defined within the ssim
namespace: ssim::Sim which defines the interface to the simulator, and ssim::Process which defines the interface for processes that the simulator can execute. Sim offers basic primitives for scheduling actions, signaling events, and for creating, starting, and stopping processes. Process declares the execution steps scheduled when a process is started, periodically scheduled, signaled, and stopped.
The execution of the simulation is based on a virtual clock that represents the time in the simulated world. The virtual clock is simply a counter, therefore the time unit is determined by the semantics of the simulated processes. The initial value of the virtual clock is 0. The passage of (virtual) time in the simulated world is explicitly controlled by each process, essentially in three ways:
In addition to the basic Process class, the library provides a utility class ProcessWithPId, that automate some common procedures for process implementations.