pub struct Simulation { /* private fields */ }
Expand description

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.

Implementations

This constructor method creates a simulation from a supplied configuration (models and connectors).

This method sets the models and connectors of an existing simulation.

Simulation steps generate messages, which are then consumed on subsequent simulation steps. These messages between models in a simulation drive much of the discovery, analysis, and design. This accessor method provides the list of active messages, at the current point of time in the simulation. Message history is not retained, so simulation products and projects should collect messages as needed throughout the simulation execution.

An accessor method for the simulation global time.

This method provides a mechanism for getting the status of any model in a simulation. The method takes the model ID as an argument, and returns the current status string for that model.

This method provides a mechanism for getting the records of any model in a simulation. The method takes the model ID as an argument, and returns the records for that model.

To enable simulation replications, the reset method resets the state of the simulation, except for the random number generator. Recreating a simulation from scratch for additional replications does not work, due to the random number generator seeding.

Clear the active messages in a simulation.

Reset the simulation global time to 0.0.

This method provides a convenient foundation for operating on the full set of models in the simulation.

Input injection creates a message during simulation execution, without needing to create that message through the standard simulation constructs. This enables live simulation interaction, disruption, and manipulation - all through the standard simulation message system.

The simulation step is foundational for a discrete event simulation. This method executes a single discrete event simulation step, including internal state transitions, external state transitions, message orchestration, global time accounting, and step messages output.

This method executes simulation step calls, until a global time has been exceeded. At which point, the messages from all the simulation steps are returned.

This method executes the specified number of simulation steps, n. Upon execution of the n steps, the messages from all the steps are returned.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.