[−][src]Struct sim::simulator::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.
Implementations
impl Simulation
[src]
pub fn post_json(models: &str, connectors: &str) -> Simulation
[src]
Like post_yaml
, this constructor method creates a simulation from
a supplied configuration (models and connectors).
pub fn put_json(&mut self, models: &str, connectors: &str)
[src]
Like put_yaml
, this method sets the models and connectors of an
existing simulation.
pub fn get_json(&self) -> String
[src]
This method provides the simulation state in a "pretty" serialized JSON format - with line breaks and indentations. The simulation details not included in this serialization are internal implementation details. If it is not included in the serialization, the data is not required to specify the simulation state, and it has been excluded deliberately.
pub fn post_yaml(models: &str, connectors: &str) -> Simulation
[src]
Like post_json
, this constructor method creates a simulation from
a supplied configuration (models and connectors).
pub fn put_yaml(&mut self, models: &str, connectors: &str)
[src]
Like put_json
, this method sets the models and connectors of an
existing simulation.
pub fn get_yaml(&self) -> String
[src]
This method provides the simulation state in a yaml serialized JSON format - with line breaks and indentations. The simulation details not included in this serialization are internal implementation details. If it is not included in the serialization, the data is not required to specify the simulation state, and it has been excluded deliberately.
pub fn get_messages_js(&self) -> Array
[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_messages_json(&self) -> String
[src]
This method is like get_messages_js
, but returns the messages as JSON.
pub fn get_messages_yaml(&self) -> String
[src]
This method is like get_messages_js
, but returns the messages as YAML.
pub fn get_global_time(&self) -> f64
[src]
An accessor method for the simulation global time.
pub fn status(&self, model_id: &str) -> String
[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 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 inject_input_json(&mut self, message: &str)
[src]
This method is like inject_input
, but the message is provided in
JSON format.
pub fn inject_input_yaml(&mut self, message: &str)
[src]
This method is like inject_input
, but the message is provided in
YAML format.
pub fn step(&mut self)
[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, and global time accounting.
pub fn step_until_js(&mut self, until: f64) -> Array
[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_until_json(&mut self, until: f64) -> String
[src]
This method is like step_until_js
, but returns the messages as
JSON.
pub fn step_until_yaml(&mut self, until: f64) -> String
[src]
This method is like step_until_js
, but returns the messages as
YAML.
pub fn step_n_js(&mut self, n: usize) -> Array
[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.
pub fn step_n_json(&mut self, n: usize) -> String
[src]
This method is like step_n_js
, but returns the messages as JSON.
pub fn step_n_yaml(&mut self, n: usize) -> String
[src]
This method is like step_n_js
, but returns the messages as YAML.
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 FromWasmAbi for Simulation
[src]
type Abi = u32
The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more
unsafe fn from_abi(js: u32) -> Self
[src]
impl IntoWasmAbi for Simulation
[src]
type Abi = u32
The wasm ABI type that this converts into when crossing the ABI boundary. Read more
fn into_abi(self) -> u32
[src]
impl OptionFromWasmAbi for Simulation
[src]
impl OptionIntoWasmAbi for Simulation
[src]
impl RefFromWasmAbi for Simulation
[src]
type Abi = u32
The wasm ABI type references to Self
are recovered from.
type Anchor = Ref<'static, Simulation>
The type that holds the reference to Self
for the duration of the
invocation of the function that has an &Self
parameter. This is
required to ensure that the lifetimes don't persist beyond one function
call, and so that they remain anonymous. Read more
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
[src]
impl RefMutFromWasmAbi for Simulation
[src]
type Abi = u32
Same as RefFromWasmAbi::Abi
type Anchor = RefMut<'static, Simulation>
Same as RefFromWasmAbi::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
[src]
impl Serialize for Simulation
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl WasmDescribe for Simulation
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Simulation
[src]
impl !Send for Simulation
[src]
impl !Sync for Simulation
[src]
impl Unpin for Simulation
[src]
impl !UnwindSafe for Simulation
[src]
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> ReturnWasmAbi for T where
T: IntoWasmAbi,
[src]
T: IntoWasmAbi,
type Abi = <T as IntoWasmAbi>::Abi
Same as IntoWasmAbi::Abi
pub fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
[src]
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>,