Module: powerNodeBase
Executive Summary
The powerNodeBase class is used generate a standard interface and list of features for modules that consume or provide power. Specifically, each PowerNodeBase:
Writes out a PowerNodeUsageMsgPayload describing its power consumption at each sim update
Can be switched on or off using an optional PowerNodeStatusMsgPayload
Can also be switched on or off using the public variable
powerStatus
Core functionality is wrapped in the evaluatePowerModel()
protected virtual void method, which is assumed to compute power usage based on a module specific mathematical model.
Protected methods prepended with custom
are intended for module developers to override with additional, module-specific functionality.
For more information on how to set up and use classes derived from this module, see the simple power system example: scenarioPowerDemo.
Module Assumptions and Limitations
The power draw or supply for this module is assumed to be constant.
Message Connection Descriptions
The following table lists all the module input and output messages. The module msg variable name is set by the user from python. The msg type contains a link to the message structure definition, while the description provides information on what this message is used for.
Msg Variable Name |
Msg Type |
Description |
---|---|---|
nodePowerOutMsg |
Writes out the net power used/generated by a PowerNodeBase instance. |
|
nodeStatusInMsg |
(optional). If powerStatus is 0, the node is disabled; other values indicate various power modes depending on the module. |
User Guide
To specify the modules simulated power draw (neg. value) or generation (pos. value), set the variable
nodePowerOut
to the desired value in units of Watts.The module power status can be set using the public variable
powerStatus
. The default value is 1 meaning the device is on. If set to 0 the device is off and the power value returns to 0.The module power status can be set also through an optional input message. By connecting
nodeStatusInMsg
the status message is read in at every time step.
-
class PowerNodeBase : public SysModel
- #include <powerNodeBase.h>
power node base class
Public Functions
-
PowerNodeBase()
This method initializes the messaging parameters to either empty strings for message names or -1 for message IDs.
- Returns:
void
-
~PowerNodeBase()
Destructor.
- Returns:
void
-
void Reset(uint64_t CurrentSimNanos)
This method is used to reset the module. In general, no functionality must be reset.
- Returns:
void
-
void computePowerStatus(double currentTime)
Core compute operation that implements switching logic and computes module-wise power consumption.
-
void UpdateState(uint64_t CurrentSimNanos)
Provides logic for running the read / compute / write operation that is the module’s function.
- Parameters:
CurrentSimNanos – The current simulation time in nanoseconds
Public Members
-
Message<PowerNodeUsageMsgPayload> nodePowerOutMsg
output power message
-
ReadFunctor<DeviceStatusMsgPayload> nodeStatusInMsg
note status input message
-
double nodePowerOut
[W] Power provided (+) or consumed (-).
-
uint64_t powerStatus
Device power mode; by default, 0 is off and 1 is on. Additional modes can fill other slots.
-
BSKLogger bskLogger
— BSK Logging
Protected Functions
-
void writeMessages(uint64_t CurrentClock)
This method writes out a message.
- Returns:
void
-
bool readMessages()
This method is used to read incoming power status messages.
- Returns:
void
-
virtual void evaluatePowerModel(PowerNodeUsageMsgPayload *powerUsageMsg) = 0
Virtual void method used to compute module-wise power usage/generation.
-
virtual void customReset(uint64_t CurrentClock)
Custom Reset method, similar to customSelfInit.
Custom Reset() method. This allows a child class to add additional functionality to the Reset() method
- Returns:
void
-
virtual void customWriteMessages(uint64_t CurrentClock)
custom Write method, similar to customSelfInit.
custom Write method, similar to customSelfInit.
- Returns:
void
-
virtual bool customReadMessages()
Custom read method, similar to customSelfInit; returns true by default.
Custom read method, similar to customSelfInit; returns true by default.
- Returns:
void
Protected Attributes
-
PowerNodeUsageMsgPayload nodePowerMsg
buffer of output message
-
DeviceStatusMsgPayload nodeStatusMsg
copy of input message
-
double currentPowerConsumption
class variable
-
double previousTime
Previous time used for integration.
-
PowerNodeBase()