Table of Contents

Interface ISimulationController

Namespace
Scaleout.Modules.DigitalTwin.Abstractions
Assembly
Scaleout.Modules.DigitalTwin.Abstractions.dll

Represents the controller of a digital twin model simulation process.

public interface ISimulationController

Properties

SimulationStartTime

Returns the simulation start time in UTC.

DateTimeOffset SimulationStartTime { get; }

Property Value

DateTimeOffset

The simulation start time.

Methods

CreateInstanceAsync(string, string, object)

Create a new digital twin instance of the specified simulation modelName.

Task CreateInstanceAsync(string modelName, string twinId, object newInstance)

Parameters

modelName string

Digital twin model name.

twinId string

Digital twin identifier.

newInstance object

Digital twin instance to create. This can an object of the actual class representing the digital twin model type or simply an anonymous object with a set of digital twin model's digital twin model or simply an anonymous object with a set of the digital twin model's properties and their initial values.

Returns

Task

The task object representing the asynchronous operation.

Exceptions

ModelSimulationException

The exception is thrown if the current digital twin model does not support simulation.

DigitalTwinInstantiationException

An error occurred while creating a new digital twin instance.

Delay(TimeSpan)

Delays the scheduling of the current instance for the specified delay.

void Delay(TimeSpan delay)

Parameters

delay TimeSpan

TimeSpan for simulation time delay.

Exceptions

ModelSimulationException

The exception is thrown if the current digital twin model does not support simulation.

DelayIndefinitely()

Delays calling the ProcessModelAsync(ProcessingContext<TDigitalTwin>, TDigitalTwin, DateTimeOffset) method for this instance forever. Users can interrupt this infinite delay later by calling RunThisInstance() for this instance within the ProcessMessageAsync(ProcessingContext<TDigitalTwin>, TDigitalTwin, byte[]) method call.

void DelayIndefinitely()

Exceptions

ModelSimulationException

The exception is thrown if the current digital twin model does not support simulation.

DeleteInstanceAsync(string, string)

Delete a digital twin instance of the specified simulation modelName.

Task DeleteInstanceAsync(string modelName, string twinId)

Parameters

modelName string

Digital twin model name.

twinId string

Digital twin identifier.

Returns

Task

The task object representing the asynchronous operation.

Exceptions

ModelSimulationException

The exception is thrown if the current digital twin model does not support simulation.

DeleteThisInstanceAsync()

Delete this simulation twin instance.

Task DeleteThisInstanceAsync()

Returns

Task

The task object representing the asynchronous operation.

Exceptions

ModelSimulationException

The exception is thrown if the current digital twin model does not support simulation.

EmitTelemetryAsync(string, byte[])

Sends a telemetry message to the corresponding real-time digital twin instance. The instance ID of the corresponding real-time digital twin is expected to be the same as the instance ID of the simulated digital twin instance that emits the telemetry message.

Task EmitTelemetryAsync(string modelName, byte[] message)

Parameters

modelName string

Real-time digital twin model name.

message byte[]

The JSON-serialized message to send.

Returns

Task

The task object representing the asynchronous operation.

Exceptions

ModelSimulationException

The exception is thrown if the current digital twin model does not support simulation.

DigitalTwinProcessingException

An error occurred while processing the message by digital twin.

GetSimulationTimeIncrement()

Gets the simulation's time increment.

TimeSpan GetSimulationTimeIncrement()

Returns

TimeSpan

TimeSpan for the simulation time increment.

Exceptions

ModelSimulationException

The exception is thrown if the current digital twin model does not support simulation.

RunThisInstance()

Adds this simulation twin instance to the end of the priority queue for running the ProcessModelAsync(ProcessingContext<TDigitalTwin>, TDigitalTwin, DateTimeOffset) method for it at the current simulation time.

void RunThisInstance()

StopSimulation()

Stop the currently running simulation after completing the current timestep.

void StopSimulation()