Class Scheduler
The Scheduler class is used to schedule emulation events of the systemgraph.
Namespace: Mechatronics.SystemGraph
Syntax
public class Scheduler
Fields
LastEventTime
Last Event Time
Declaration
public double LastEventTime
Field Value
| Type | Description |
|---|---|
| Double |
Now
Current time
Declaration
public double Now
Field Value
| Type | Description |
|---|---|
| Double |
TimeAbsolute
Time since start
Declaration
public double TimeAbsolute
Field Value
| Type | Description |
|---|---|
| Double |
TimeAtSource
Source time
Declaration
public double TimeAtSource
Field Value
| Type | Description |
|---|---|
| Double |
Properties
ClockSourceDescriptors
Gets the clock descriptors for nodes that are bound to a clock source
Declaration
public List<Scheduler.ClockDescriptor> ClockSourceDescriptors { get; }
Property Value
| Type | Description |
|---|---|
| List<Scheduler.ClockDescriptor> | The List of ClockDescriptor |
NextFrameTime
Gets the next frame time to schedule.
Declaration
public double NextFrameTime { get; }
Property Value
| Type | Description |
|---|---|
| Double | The next frame time. |
NodeEventMap
Gets the events clockstate associated with node runtimes
Declaration
public Dictionary<NodeRuntime, Scheduler.ClockState> NodeEventMap { get; }
Property Value
| Type | Description |
|---|---|
| Dictionary<NodeRuntime, Scheduler.ClockState> |
NodeOrder
Gets the initialization node order list.
Declaration
public List<NodeRuntime> NodeOrder { get; }
Property Value
| Type | Description |
|---|---|
| List<NodeRuntime> | The node order. |
Paused
Gets the pause state of the Scheduler
Declaration
public bool Paused { get; }
Property Value
| Type | Description |
|---|---|
| Boolean | Returns true when the scheduler is paused |
TimeScaleFactor
Get the TimeScaleFactor of the Scheduler
Declaration
public double TimeScaleFactor { get; }
Property Value
| Type | Description |
|---|---|
| Double | Returns the current time scale factor |
Waveform
Gets the list of waveforms
Declaration
public LinkedList<Scheduler.ClockDescriptor> Waveform { get; }
Property Value
| Type | Description |
|---|---|
| LinkedList<Scheduler.ClockDescriptor> | List of waveform |
Methods
DisableNodes()
Call Disable() for all nodes. See EnableNodes() for details on order.
Declaration
public void DisableNodes()
EnableNodes()
Call Enable() for all nodes. Order is random for Async nodes, but they will be called before Sync nodes. Sync nodes are enabled in the order they appear in the scheduler.
Declaration
public void EnableNodes()
FixedUpdate()
Called from a Unity FixedUpdate() to signal a scheduler update.
Declaration
public void FixedUpdate()
Initialize(SystemGraphComponent, SystemGraphObject)
Initialize this scheduler component.
Declaration
public bool Initialize(SystemGraphComponent owner, SystemGraphObject graphRuntime)
Parameters
| Type | Name | Description |
|---|---|---|
| SystemGraphComponent | owner | SystemGraphComponent that owns this scheduler. |
| SystemGraphObject | graphRuntime | Graph runtime data to schedule. |
Returns
| Type | Description |
|---|---|
| Boolean | True on success. |
Pause()
Pause the scheduler.
Declaration
public void Pause()
Resume()
Resume after Pause().
Declaration
public void Resume()
SetNodeFrequencyForNextFrame(NodeRuntime, Double)
Set a new frequency on provided node runtime
Declaration
public bool SetNodeFrequencyForNextFrame(NodeRuntime nodeRT, double frequency)
Parameters
| Type | Name | Description |
|---|---|---|
| NodeRuntime | nodeRT | Node to change frequency. |
| Double | frequency | Desired frequency |
Returns
| Type | Description |
|---|---|
| Boolean | True on success. |
SetNodeUseClockSourceForNextFrame(NodeRuntime)
Set a node to use the clocksource frequency
Declaration
public bool SetNodeUseClockSourceForNextFrame(NodeRuntime nodeRT)
Parameters
| Type | Name | Description |
|---|---|---|
| NodeRuntime | nodeRT | Node to change frequency. |
Returns
| Type | Description |
|---|---|
| Boolean | True on success. |
SetTimeScaleFactor(Double)
Set time scale.
Declaration
public void SetTimeScaleFactor(double timeScale)
Parameters
| Type | Name | Description |
|---|---|---|
| Double | timeScale | Time scale to set. |
StartNodes()
Call Start() for all nodes. See EnableNodes() for details on order.
Declaration
public void StartNodes()
Step(Int32)
Step the scheduler a integer number of steps.
Declaration
public void Step(int stepCount)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | stepCount | Number of steps to jump. |
SyncClockSourceTime(Double)
Synchronize the current time of the scheduler with the clock source. If the caller provides a forcedTimeAtSource higher or equal to 0.0, the clock will set the current time to the provided value.
Declaration
public void SyncClockSourceTime(double forcedTimeAtSource = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| Double | forcedTimeAtSource | When this value is higher or equal to 0.0, set the current time to this value |
Update()
Called from a Unity Update() to signal a scheduler update.
Declaration
public void Update()
UserUpdate(Double)
Called from a custom user update function to signal a scheduler update.
Declaration
public double UserUpdate(double now)
Parameters
| Type | Name | Description |
|---|---|---|
| Double | now | Custom source time |
Returns
| Type | Description |
|---|---|
| Double | Returns time of the next event |