Class SimulationContext
Represents a simulation context object keeping all relevant
information's about the simulation execution itself.
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Mars.Interfaces
Assembly: Mars.Interfaces.dll
Syntax
public class SimulationContext : ISimulationContext, ISimulationState, IDisposable
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
Constructors
| Improve this Doc View SourceSimulationContext(Int64)
Create a simple simulation context, which is not realtime related.
Declaration
public SimulationContext(long startStep = 0L)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | startStep |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
SimulationContext(TimeSpan, DateTime, Nullable<DateTime>)
Create a simulation context with realtime settings
Declaration
public SimulationContext(TimeSpan oneTickTimeSpan, DateTime startTimePoint = default(DateTime), DateTime? endTimePoint = null)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | oneTickTimeSpan | |
System.DateTime | startTimePoint | |
System.Nullable<System.DateTime> | endTimePoint |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
Fields
| Improve this Doc View SourceId
The identifier of this state
Declaration
[JsonIgnore]
public readonly Guid Id
Field Value
Type | Description |
---|---|
System.Guid |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
RestartAt
State where to restart the simulation lifecycle
or null if no restart is requested
Declaration
[JsonIgnore]
public long? RestartAt
Field Value
Type | Description |
---|---|
System.Nullable<System.Int64> |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
Properties
| Improve this Doc View SourceActive
Indicates the active or inactive state
of the simulation workflow loop
Declaration
public bool Active { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
CurrentStep
Currently logical simulation step that is used
Declaration
public long CurrentStep { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
CurrentTick
Currently simulation system tick of the workflow
Declaration
public long CurrentTick { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
CurrentTimePoint
Realtime time point of the currently executed step
Declaration
public DateTime? CurrentTimePoint { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
EndTimePoint
Gets the ending realtime for the last executed simulation tick.
Declaration
public DateTime? EndTimePoint { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
InputWatch
Gets the stopwatch, used to measure the duration of the initialization phase,
for each agent, entity and layer together.
Declaration
public Stopwatch InputWatch { get; }
Property Value
Type | Description |
---|---|
System.Diagnostics.Stopwatch |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
IsAborted
Indicates whether the simulation was aborted
Declaration
public bool IsAborted { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
IsFinished
Indicates whether the simulation run is finished
Declaration
public bool IsFinished { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
IsInitialized
Indicates whether the simulation run was prepared for the first step
Declaration
public bool IsInitialized { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
IsPaused
Indicates whether the simulation was paused
Declaration
public bool IsPaused { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
IsPausedCompleted
Indicates whether the paused simulation state is already finished.
Declaration
[JsonIgnore]
public bool IsPausedCompleted { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
IsPrepared
Indicates whether the simulation was prepared
and the initial tick=0 was persisted.
Declaration
[JsonIgnore]
public bool IsPrepared { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
IsTimeReferenced
Determines whether the simulation is executed with a reference to time or not
Declaration
public bool IsTimeReferenced { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
Iterations
The count of successful executed steps
Declaration
public long Iterations { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
LastDateTime
The last successfully executed model time point
Declaration
public DateTime? LastDateTime { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
LastPauseDateTime
The time point for realtime execution where the a pause of the loop was received
or null if no pause was ever received
Declaration
public DateTime? LastPauseDateTime { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
LastPauseStep
The real simulation step where the pause command was received
or null if no pause was ever received
Declaration
public long? LastPauseStep { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int64> |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
LastPauseTick
The simulation system tick where the pause command was received
or null if no pause was ever received
Declaration
public long? LastPauseTick { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int64> |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
LastStep
The successfully executed model step
or null if no step was executed
Declaration
public long? LastStep { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int64> |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
LastTick
The successfully executed system tick beginning at 0
or null if no system tick was executed
Declaration
public long? LastTick { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int64> |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
MaxTicks
Gets or sets the maximum amount of ticks, when a simulation time-range is specified.
Declaration
public long MaxTicks { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
Meanwhile
Gets the global accessible realtime timespan of this scenario, describing
how long the simulation world lasted so far.
Declaration
[JsonIgnore]
public TimeSpan? Meanwhile { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.TimeSpan> |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
OneTickTimeSpan
Gets the global accessible time delta interval for realtime scenarios.
Declaration
public TimeSpan? OneTickTimeSpan { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.TimeSpan> |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
OutputWatch
Gets the stopwatch, used to measure the duration when processing or checking for simulation output.
Declaration
public Stopwatch OutputWatch { get; }
Property Value
Type | Description |
---|---|
System.Diagnostics.Stopwatch |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
ProgressInPercentage
Gets the current percentage progress of the simulation execution comparing with
MaxTicks.
Declaration
public double ProgressInPercentage { get; }
Property Value
Type | Description |
---|---|
System.Double |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
RestartFlag
Indicates a restart of the simulation workflow,
the workflow itself is active furthermore
Declaration
public bool RestartFlag { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
ResumeFlag
Indicates that the simulation shall be resumed
from the last paused simulation step
Declaration
public bool ResumeFlag { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
Start2020InSeconds
Generates a simulation context that start on 01-01-2020 and has a delta t of 1 second
Declaration
public static SimulationContext Start2020InSeconds { get; }
Property Value
Type | Description |
---|---|
SimulationContext |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
StartStep
Gets or sets the optional start step for step-based execution.
Declaration
public long StartStep { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
StartTimePoint
Gets the initializing realtime for simulation tick 0.
Declaration
public DateTime? StartTimePoint { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
State
Represents a simulation context object keeping all relevant
information's about the simulation execution itself.
Declaration
public SimulationContext.WorkflowStateType State { get; set; }
Property Value
Type | Description |
---|---|
SimulationContext.WorkflowStateType |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
StepFlag
Indicates whether a simulation step shall be calculated
Declaration
public bool StepFlag { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
TickWatch
Gets the stopwatch, used to measure the duration of each pre-, main- and post-tick and thus the raw
simulation computing time.
Declaration
public Stopwatch TickWatch { get; }
Property Value
Type | Description |
---|---|
System.Diagnostics.Stopwatch |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
Methods
| Improve this Doc View SourceDispose()
Represents a simulation context object keeping all relevant
information's about the simulation execution itself.
Declaration
public void Dispose()
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
Equals(Object)
Represents a simulation context object keeping all relevant
information's about the simulation execution itself.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
System.Object.Equals(System.Object)
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
GetHashCode()
Represents a simulation context object keeping all relevant
information's about the simulation execution itself.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
System.Object.GetHashCode()
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
SetTick(Int32, Int32)
Sets the current step context to the specified one.
Declaration
public void SetTick(int tick, int delta = 1)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | tick | The ticks to set for. |
System.Int32 | delta | The delta timespan of the logical time. |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
|
Improve this Doc
View Source
UpdateStep(Int32, Int32)
Updates the clock with the system execution tick by 1, the simulation step by
deltaT
and the current realtime point by OneTickTimeSpan by one simulation tick.
Declaration
public void UpdateStep(int delta = 1, int steps = 1)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | delta | The logical delta step for move forward in time. |
System.Int32 | steps | The amount of steps to update for. |
Remarks
The context provides the current simulation tick, step and realtime if set as well as delegates which are invoked to
provide an (in tick) initialize process with thread-specific information's (StepExecutionContext.
Implements
System.IDisposable