Table of Contents

Class PowerSource

Namespace
NominalSystems.Classes
Assembly
NominalSystems.Classes.dll

[Nominal] A power source is a component that can be added to the power bus system and is able to provide power that can charge up a storage unit, such as a battery.


public class PowerSource : PhysicalObject, IPowerInterface
Inheritance
PowerSource
Implements
Derived

Constructors

PowerSource()

Default constructor

protected PowerSource()

Fields

ControlCurrent

A flag for if the power source controls/sets the output current.

[Unit(UnitType.NONE)]
[Metadata(IsAdvanced = true)]
public bool ControlCurrent

Field Value

bool

IsForwardBiased

This flag is used to determine if the power source is forward biased. If so, then it acts as a diode in that current cannot flow backwards into the source. This parameter will be removed in the future, once diode models are implemented.

[Unit(UnitType.NONE)]
[Metadata(IsAdvanced = true)]
public bool IsForwardBiased

Field Value

bool

Out_PowerMsg

The power message containing the current information of the Power Source.

public PowerMessage? Out_PowerMsg

Field Value

PowerMessage

Properties

IsActive

A flag for if the power source or sink is currently active.

[Metadata(IsAdvanced = true, ContainedIn = "Out_PowerMsg")]
public bool IsActive { get; set; }

Property Value

bool

NominalVoltage

The desired voltage of the Power Source in Volts.

[Unit(UnitType.VOLT)]
[Range(0, 1.7976931348623157E+308)]
[Metadata(ContainedIn = "Out_PowerMsg")]
public double NominalVoltage { get; set; }

Property Value

double

Power

The power produced by the Power Source in Watts.

[Unit(UnitType.WATT)]
[ReadOnly]
[Range(0, 1.7976931348623157E+308)]
[Metadata(ContainedIn = "Out_PowerMsg")]
public double Power { get; set; }

Property Value

double

Methods

BuildPower(string, string)

Builds the power components based on the power bus reference. Here, the interfaced component will be able to assign its SPICE components to the power bus. This will return an array of IEntity objects that represent the SPICE components.

[Hidden]
public virtual IEntity[] BuildPower(string negative, string positive)

Parameters

negative string

The input node for the entity

positive string

The output node for the entity

Returns

IEntity[]

ConfigurePower(double)

Configures the power interface to its default state, which will include updating the variables of any SPICE power components to the correct state.

public virtual bool ConfigurePower(double step)

Parameters

step double

[s] The step time for the circuit run

Returns

bool

A success flag

ExportPower(OP)

Exports the power from the SPICE (OP) simulation to the power interface, updating any relevant data.

[Hidden]
public virtual void ExportPower(OP simulation)

Parameters

simulation OP

The SPICE OP simulation

OnCreate()

Called when the 'Component' is created from the controller.

protected override void OnCreate()

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

ResetPower()

Resets the power interface to its default state, which will include removing any SPICE power references associated to the current interface.

public virtual void ResetPower()