Table of Contents

Class PowerBus

Namespace
NominalSystems.Classes
Assembly
NominalSystems.Classes.dll

[Nominal] The Power Bus is a component that can be attached to an object that controls the power system on-board the entity. It allows for power to flow from a battery unit, into a series of nodes. All components that are power related must attach to this component.


public class PowerBus : UniverseBehaviour
Inheritance
PowerBus

Constructors

PowerBus()

Default constructor

protected PowerBus()

Fields

Cache

A Dictionary of the EPS Components in the network to their IDs, for easy lookup of the networked components.

[Hidden]
public Dictionary<Guid, UniverseObject> Cache

Field Value

Dictionary<Guid, UniverseObject>

DisableExcessPowerCorrection

A Flag that instructs the PowerBus to disable corrections to its simulation if PowerSources are over supplying PowerSinks. This means that the PowerNodeModel data for PowerSinks will be calculated as if they were receiving the correct amount of power.

[Metadata(IsAdvanced = true)]
public bool DisableExcessPowerCorrection

Field Value

bool

DisableInsufficientPowerCorrection

A Flag that instructs the PowerBus to disable corrections to its simulation if PowerSources aren't meeting the expectations of PowerSinks. This means that the PowerNodeModel data for PowerSinks will be calculated as if they were receiving the correct amount of power.

[Metadata(IsAdvanced = true)]
public bool DisableInsufficientPowerCorrection

Field Value

bool

MadeOpenCircuit

A List of the NS EPS Components that were made open circuit by the PowerBus.

[Hidden]
public List<UniverseObject> MadeOpenCircuit

Field Value

List<UniverseObject>

ZeroGroundPlane

A Flag that instructs the PowerBus to zero any Current or Voltage values that connect to the ground plane.

[Metadata(IsAdvanced = true)]
public bool ZeroGroundPlane

Field Value

bool

Methods

Connect(UniverseObject?, UniverseObject?)

Connects two EPS Components in the network. This will create a wire between the two components This assumes that the positive terminal of the 'fromNode' is connected to the negative terminal of the 'toNode'.

public bool Connect(UniverseObject? fromNode, UniverseObject? toNode)

Parameters

fromNode UniverseObject

The component to connect from

toNode UniverseObject

The component to connect to

Returns

bool

A success of connecting the objects

ConnectTerminals(UniverseObject?, UniverseObject?, TerminalType, TerminalType)

Connects two EPS Components in the network with a specific terminal type. This will create a wire between the two components and connect them in the network. The terminals that the components are connected from and to can be specified here in this network.

public bool ConnectTerminals(UniverseObject? fromNode, UniverseObject? toNode, TerminalType fromTerminal = TerminalType.Positive, TerminalType toTerminal = TerminalType.Negative)

Parameters

fromNode UniverseObject

The node to connect from

toNode UniverseObject

The node to connect to

fromTerminal TerminalType

The terminal to connect from on the from node

toTerminal TerminalType

The terminal to connect to on the to node

Returns

bool

A success of connecting the objects

Disconnect(UniverseObject?, UniverseObject?)

Disconnects two EPS Components in the network. This will not remove the component from the cache, but more just disconnect the wire that joins the two components together.

public bool Disconnect(UniverseObject? fromNode, UniverseObject? toNode)

Parameters

fromNode UniverseObject

The component connected

toNode UniverseObject

The component that it is connected to

Returns

bool

A successful disconnection

DisconnectTerminals(UniverseObject?, UniverseObject?, TerminalType, TerminalType)

Disconnects two EPS Components in the network. This is based on the terminals that the wires are connected to, within the network.

public bool DisconnectTerminals(UniverseObject? fromNode, UniverseObject? toNode, TerminalType fromTerminal = TerminalType.Positive, TerminalType toTerminal = TerminalType.Negative)

Parameters

fromNode UniverseObject

The EPS Component that the connection be break starts at

toNode UniverseObject

The EPS Component that the connection to break ended at

fromTerminal TerminalType

The terminal type of the 'From' component

toTerminal TerminalType

The terminal type of the 'To' component

Returns

bool

True if the connection was disconnected successfully

GetConnectedInputs(UniverseObject)

Returns a list of all components that are connected on the power bus as an input to a particular component. This is all the components that are connected to the negative terminal of the component.

public UniverseObject[] GetConnectedInputs(UniverseObject component)

Parameters

component UniverseObject

The component to return the connected inputs for

Returns

UniverseObject[]

An array of the connected components

GetConnectedOutputs(UniverseObject)

Returns a list of all components that are connected on the power bus as an output to a particular component. This is all the components that are connected to the positive terminal of the component.

public UniverseObject[] GetConnectedOutputs(UniverseObject component)

Parameters

component UniverseObject

The component to return the connected outputs for

Returns

UniverseObject[]

An array of the connected components

GetNetworkedComponents()

Returns an array of the components in the network of the PowerBus

public UniverseObject[] GetNetworkedComponents()

Returns

UniverseObject[]

An array of the networked components

IsComponentConnected(UniverseObject)

Returns whether a particular component is connected in the Network

public bool IsComponentConnected(UniverseObject component)

Parameters

component UniverseObject

The component to check

Returns

bool

A connection flag

IsValid()

Returns whether the current system is valid and has a completed circuit.

public bool IsValid()

Returns

bool

A valid flag

OnLoad(double)

Called after all of the data has been loaded from a save state on this object. This enables any post-load operations to be performed and extra data to be loaded from the metadata.

protected override void OnLoad(double time)

Parameters

time double

[s] The current clock time of the simulation

OnUpdate(double, double)

Called when the object should update from the simulation tick. This will take in a time and a step, where the time is the time of the clock before updating the object.

protected override void OnUpdate(double time, double step)

Parameters

time double

[s] Current time of the simulation before the update

step double

[s] The time-step to update during this tick

Remove(UniverseObject?, bool)

Removes a component from the network

public bool Remove(UniverseObject? component, bool repair = true)

Parameters

component UniverseObject

The component to remove

repair bool

Connect the Inputs of the removed component to the Outputs of the removed component

Returns

bool

True if the component was successfully removed

Replace(UniverseObject?, UniverseObject?)

Replaces a component in the network with another component

public bool Replace(UniverseObject? original, UniverseObject? replacement)

Parameters

original UniverseObject

The original component to remove

replacement UniverseObject

The new component

Returns

bool

A success flag for the replacement