[][src]Module sim::simulator

The simulator module provides the mechanics to orchestrate the models and connectors via discrete event simulation. The specific formalism for simulation execution is the Discrete Event System Specification. User interaction is also captured in this module - simulation stepping and input injection.

Two constructors are provided for creating a Simulation, post_json and post_yaml. If the default Simulation::default() is used to create the simulation, models and connectors should be added with the put_json or put_yaml method.

Most simulation analysis will involve the collection, transformation, and analysis of messages. Messages can be retrieved after each simulation step with the get_messages_yaml and get_messages_json methods. The Step N and Step Until methods enable the execution of many simulation steps with a single method call. Since message history isn't stored in the simulation struct, step_n and step_until collect the messages during the simulation steps, and provide them as a returned value. The returned value format depends on the method call: step_n_json, step_n_yaml, step_until_json, or step_until_yaml.

Structs

Message

Messages are the mechanism of information exchange for models in a a simulation. The message must contain origin information (source model ID and source model port), destination information (target model ID and target model port), and the text/content of the message.

Simulation

The Simulation struct is the core of sim, and includes everything needed to run a simulation - models, connectors, and a random number generator. State information, specifically global time and active messages are additionally retained in the struct.