Struct sim::simulator::Simulation[][src]

pub struct Simulation { /* fields omitted */ }

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

impl Simulation[src]

pub fn post(models: Vec<Model>, connectors: Vec<Connector>) -> Self[src]

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

pub fn put(&mut self, models: Vec<Model>, connectors: Vec<Connector>)[src]

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

pub fn get_messages(&self) -> &Vec<Message>[src]

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.

pub fn get_global_time(&self) -> f64[src]

An accessor method for the simulation global time.

pub fn status(&self, model_id: &str) -> Result<String, SimulationError>[src]

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.

pub fn reset(&mut self)[src]

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.

pub fn reset_messages(&mut self)[src]

Clear the active messages in a simulation.

pub fn reset_global_time(&mut self)[src]

Reset the simulation global time to 0.0.

pub fn models(&mut self) -> Vec<&mut Model>[src]

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

pub fn inject_input(&mut self, message: Message)[src]

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.

pub fn step(&mut self) -> Result<Vec<Message>, SimulationError>[src]

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.

pub fn step_until(
    &mut self,
    until: f64
) -> Result<Vec<Message>, SimulationError>
[src]

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.

pub fn step_n(&mut self, n: usize) -> Result<Vec<Message>, SimulationError>[src]

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

impl Clone for Simulation[src]

impl Default for Simulation[src]

impl<'de> Deserialize<'de> for Simulation[src]

impl Serialize for Simulation[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,