Struct sim::simulator::Simulation [−][src]
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]
&mut self,
until: f64
) -> Result<Vec<Message>, SimulationError>
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]
fn clone(&self) -> Simulation
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Default for Simulation
[src]
fn default() -> Simulation
[src]
impl<'de> Deserialize<'de> for Simulation
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for Simulation
[src]
Auto Trait Implementations
impl RefUnwindSafe for Simulation
impl Send for Simulation
impl Sync for Simulation
impl Unpin for Simulation
impl UnwindSafe for Simulation
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,