Class SimulationStarter
This class is the entry point of the simulation
Use the static factory method
Mars.Components.Starter.SimulationStarter.Start(Mars.Components.Starter.CommandArgumentContainer,Mars.Interfaces.Model.SimulationConfig)
to create a new simulation application and to interact with it.
Inheritance
System.Object
SimulationStarter
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Mars.Components.Starter
Assembly: Mars.Components.dll
Syntax
public class SimulationStarter : IDisposable
Methods
| Improve this Doc View SourceBuild(ModelDescription, SimulationConfig)
Prepares a simulation infrastructure to start the preparation and simulation
interaction, controlled by the returning ISimulation interface.
The build expects the ModelDescription with all entity types to simulate and the
SimulationConfig initialization data and global configurations
e.g. the amount of steps and steps size.
The returning ISimulation interface represents the endpoint to control
the whole simulation execution.
Declaration
public static ISimulation Build(ModelDescription description, SimulationConfig config)
Parameters
Type | Name | Description |
---|---|---|
ModelDescription | description | Static type description with all entity types to simulate. |
SimulationConfig | config | The global and type specific inputConfiguration object with all input data references for the types. |
Returns
Type | Description |
---|---|
ISimulation | The root ISimulation endpoint to prepare, start and control the simulation execution. |
Build(ModelDescription, String[])
Expects a SimulationConfig as passed arguments given by the simulation config itself or the file
reference.
For more details see in the description of
Build(ModelDescription, SimulationConfig)
Declaration
public static ISimulation Build(ModelDescription description, params string[] args)
Parameters
Type | Name | Description |
---|---|---|
ModelDescription | description | Static type description with all entity types to simulate. |
System.String[] | args | The argument list for the simulation execution. |
Returns
Type | Description |
---|---|
ISimulation |
BuildApplication(ModelDescription, SimulationConfig)
Constructs the whole simulation application together and pass the optional ModelDescription and
SimulationConfig to the components. When nothing was passed the extra
PrepareSimulation step have to performed.
Declaration
public static ISimulationContainer BuildApplication(ModelDescription description = null, SimulationConfig config = null)
Parameters
Type | Name | Description |
---|---|---|
ModelDescription | description | The static model description or null |
SimulationConfig | config | The init startup inputConfiguration for the execution. |
Returns
Type | Description |
---|---|
ISimulationContainer |
BuildApplication(ModelDescription, String[])
Constructs the whole simulation application together and pass the ModelDescription and
inputConfiguration arguments to the components.
To start a simulation use the returned ISimulationContainer and
resolve the ISimulation component.
Declaration
public static ISimulationContainer BuildApplication(ModelDescription description, string[] args)
Parameters
Type | Name | Description |
---|---|---|
ModelDescription | description | The static model description or null |
System.String[] | args | All command line arguments. |
Returns
Type | Description |
---|---|
ISimulationContainer | Returns a new application container able to resolve each component and service in the system. |
Dispose()
Release all acquired resources of the simulation and closes all
in/output connections of this simulation application.
Declaration
public void Dispose()
Run()
Starts the simulation execution
Declaration
public SimulationWorkflowState Run()
Returns
Type | Description |
---|---|
SimulationWorkflowState | The last SimulationWorkflowState where the simulation was paused, finished or aborted |
Start(ModelDescription, SimulationConfig)
Stars a simulation with the specified simulation
config
for the registered
description
. This creates a SimulationStarter handle which
has created the internal simulation application and can be started directly. In order to interact
with the simulation please use the
BuildApplication(ModelDescription, SimulationConfig)
function instead and
resolve the ISimulation component.
Declaration
public static SimulationStarter Start(ModelDescription description, SimulationConfig config)
Parameters
Type | Name | Description |
---|---|---|
ModelDescription | description | The model describing all layer and agent types. |
SimulationConfig | config | The deserialized simulation config with configured simulation steps, inputs and outputs |
Returns
Type | Description |
---|---|
SimulationStarter | Returns a new SimulationStarter handle which internally has constructed the simulation already. |
Exceptions
Type | Condition |
---|---|
SimulationStartupException | config or description is null |
Start(ModelDescription, String[])
Stars a simulation with the specified simulation inputConfiguration arguments
args
for the
registered
model description
. This creates a SimulationStarter handle which
has created the internal simulation application and can be started directly. In order to interact
with the simulation please use the
BuildApplication(ModelDescription, SimulationConfig)
function instead and resolve the ISimulation component.
Declaration
public static SimulationStarter Start(ModelDescription description, params string[] args)
Parameters
Type | Name | Description |
---|---|---|
ModelDescription | description | The model describing all layer and agent types. |
System.String[] | args | Arguments for the simulation config in order to use the simulation starter with the command line interface. |
Returns
Type | Description |
---|---|
SimulationStarter | Returns a new SimulationStarter handle which internally has constructed the simulation already. |
Exceptions
Type | Condition |
---|---|
SimulationStartupException |
args is null or has no parameter or
description is null
|
Implements
System.IDisposable