Class NodeRuntime
The NodeRuntime class provides an interface to create a systemgraph runtime and editor node. Implementation of this class exposes the user implementation to the lifecycle of SystemGraph.
Inherited Members
Namespace: Mechatronics.SystemGraph
Syntax
[Serializable]
public class NodeRuntime : ScriptableObject
Remarks
Implement this class in conjunction with NodeCategory attribute to configure your node. See NodeCategoryAttribute for configuration attributes of your node.
Fields
_parent
The bound SystemGraphComponent that coordinate events, scheduler and nodes
Declaration
protected SystemGraphComponent _parent
Field Value
| Type | Description |
|---|---|
| SystemGraphComponent | Stores the parent SystemGraphComponent |
_portList
The port list
Declaration
[SerializeField]
protected List<PortData> _portList
Field Value
| Type | Description |
|---|---|
| List<PortData> |
_queryPath
The query path
Declaration
protected string _queryPath
Field Value
| Type | Description |
|---|---|
| String |
_tickCPUTimeNs
Store the last profiling time of the OnTick call of this Node
Declaration
protected long _tickCPUTimeNs
Field Value
| Type | Description |
|---|---|
| Int64 | Store the last profiling time in nanoseconds |
Properties
PortDataList
Gets the port data list.
Declaration
public List<PortData> PortDataList { get; }
Property Value
| Type | Description |
|---|---|
| List<PortData> | The port data list. |
QueryPath
Gets the query path.
Declaration
public string QueryPath { get; }
Property Value
| Type | Description |
|---|---|
| String | The query path. |
TickCPUTimeNs
Gets or sets the tick cpu time ns.
Declaration
public long TickCPUTimeNs { get; set; }
Property Value
| Type | Description |
|---|---|
| Int64 | The tick cpu time ns. |
Methods
Disable()
Forwarded OnDisable Unity event from the parent SystemGraphComponent
Declaration
public virtual void Disable()
Enable(Scheduler.ClockState)
Forwarded OnEnable Unity event from the parent SystemGraphComponent
Declaration
public virtual void Enable(Scheduler.ClockState clockState)
Parameters
| Type | Name | Description |
|---|---|---|
| Scheduler.ClockState | clockState | The parameters of the waveform associated to this node |
FixedUpdate()
Forwarded FixedUpdate Unity event from the parent SystemGraphComponent, if event is registered for this node.
Declaration
public virtual void FixedUpdate()
Initialize(SystemGraphComponent)
Initialize is called by SystemGraphComponent parent to bind the parent to the Node and to call the InternalInitialize event of the node.
Declaration
public void Initialize(SystemGraphComponent parent)
Parameters
| Type | Name | Description |
|---|---|---|
| SystemGraphComponent | parent | The SystemGraphComponent that owns this node |
InitializeDynamicPorts(SystemGraphComponent)
Called at start of runtime execution to load ports from PortList. Override for custom behaviour on load.
Declaration
public virtual bool InitializeDynamicPorts(SystemGraphComponent parent)
Parameters
| Type | Name | Description |
|---|---|---|
| SystemGraphComponent | parent | The parent. |
Returns
| Type | Description |
|---|---|
| Boolean | Returns true if the ports are succesfully loaded |
InternalInitialize()
The implementation of this virtual function shall handle special initialization code to handle when the graph is initialized.
Declaration
public virtual void InternalInitialize()
OnPortAdded(String, Type, String, PortDirection, FieldExtra, ref IPortType)
PortAddition event recieved from the editor during edit mode if ExpandablePorts attribute is set. By default this function will accept all ports.
Declaration
public virtual bool OnPortAdded(string entryName, Type portType, string tooltip, PortDirection direction, FieldExtra extra, ref IPortType portReference)
Parameters
| Type | Name | Description |
|---|---|---|
| String | entryName | The name of the new port |
| Type | portType | Type of the port object |
| String | tooltip | The tooltip. |
| PortDirection | direction | The direction. |
| FieldExtra | extra | The extra. |
| IPortType | portReference | The port reference. |
Returns
| Type | Description |
|---|---|
| Boolean | Returns true if the port is accepted |
OnPortRemoved(String)
Port removal event recieved from the editor during edit mode if ExpandablePorts attribute is set. By default this function will reject all removeals
Declaration
public virtual bool OnPortRemoved(string entryName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | entryName | The name of the port to remove |
Returns
| Type | Description |
|---|---|
| Boolean | Returns true if the port is removed |
OnTick(Double, Double, Scheduler.ClockState, Scheduler.Signal)
OnTick event received from the scheduler for this node waveform. This is received for every rising edge of the waveform at the frequency configured in the scheduler.
Declaration
public virtual bool OnTick(double now, double eventTime, Scheduler.ClockState clockState, Scheduler.Signal signal)
Parameters
| Type | Name | Description |
|---|---|---|
| Double | now | The current time in seconds of the scheduler clocksource |
| Double | eventTime | The current time in seconds of the scheduler waveform. This is independant from the clocksource time and aligned to every rising edge time in the waveform. |
| Scheduler.ClockState | clockState | The current parameters of the waveform event associated to this node |
| Scheduler.Signal | signal | Signals that the scheduler pass to the OnTick event receiver. These are signals that describe the action that should be done in the Node. For example, integrate this tick as multiple events. |
Returns
| Type | Description |
|---|---|
| Boolean | Returns true if time integration was performed |
Start()
Forwarded Start Unity event from the parent SystemGraphComponent
Declaration
public virtual void Start()
Update()
Forwarded Update Unity event from the parent SystemGraphComponent, if event is registered for this node.
Declaration
public virtual void Update()