Module: dataStorageUnitBase¶
Executive Summary¶
DataStorageUnitBase is a base class that is used generate a standard interface and list of features for modules that store simulated onboard data. This class is used by other modules as a parent class and cannot be instantiated by itself. All Basilisk data storage modules based on this DataStorageUnitBase inherit the following common properties:
Writes out a dataStorageStatusSimMsg containing the sum of the current stored data (in bits), the storage capacity (bits), the current net data rate (in baud), an array of char array containing the names of the stored data (ex. Instrument 1, Instrument 2), and an array of doubles containing the stored data associated with each type (bits).
Allows for multiple dataNodeUsageSimMsg corresponding to individual Module: dataNodeBase instances to be subscribed to using the
addDataNodeToModel
method.Iterates through attached dataNodeUsageSimMsg instances, integrates the data for each data node, and adds it to its respective entry using
integrateDataStatus()
method, which may be overwritten in child classes.Loops through the vector of storedData to sum the total amount of data contained within the storage unit.
Core functionality is wrapped in the integrateDataStatus
protected virtual void method, which computes the amount of data stored in a storage unit on a module basis. This base class automatically implements a partitioned storage unit (different data buffers for each device). See Module: simpleStorageUnit for an example of how this functionality can be overwritten.
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 data system example: scenarioDataDemo
Module Assumptions and Limitations¶
The base class makes no specific data storage device related assumptions.
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 |
---|---|---|
nodeDataUseMsgNames |
Input messages. Vector of data node usage messages.
Set using |
|
storageUnitDataOutMsgName |
Output message. Describes storage unit capacity, storage level, net data rate, and contents. |
User Guide¶
The user must set the output message name variable
storageUnitDataOutMsgName
in Python.The input message names (data nodes) are provided by calling the method
addDataNodeToModel()
-
class
DataStorageUnitBase
: public SysModel¶ Public Functions
-
DataStorageUnitBase
()¶ This method initializes some basic parameters for the module.
- Return
void
-
~DataStorageUnitBase
()¶ Destructor.
- Return
void
-
void
SelfInit
()¶ SelfInit for this class.
- Return
void
-
void
CrossInit
()¶ CrossInit for this class. Subscribes to dataNodes that will send data to storage unit.
- Return
void
-
void
Reset
(uint64_t CurrentSimNanos)¶ This method is used to reset the module.
- Return
void
- Parameters
CurrentSimNanos
:
-
void
addDataNodeToModel
(std::string tmpNodeMsgName)¶ Adds dataNode to the storageUnit.
Adds a simDataNodeMsg name to be iterated over. Called in Python.
- Return
void
- Parameters
tmpNodeMsgName
:
-
void
UpdateState
(uint64_t CurrentSimNanos)¶ Reads messages, adds new data to the storage unit, and writes out the storage unit status
- Return
void
- Parameters
CurrentSimNanos
: The current simulation time in nanoseconds
-
std::vector<dataInstance>
getStoredDataAll
()¶ Getter function for the storedData vector.
Getter function for all of the stored data
- Return
std::vector<dataInstance>
-
double
getStoredDataSum
()¶ Getter function for the storedDataSum.
Getter function for sum of the stored data
- Return
double
Public Members
-
std::vector<std::string>
nodeDataUseMsgNames
¶ Vector of data node input message names.
-
std::string
storageUnitDataOutMsgName
¶ Vector of message names to be written out by the storage unit.
-
double
storageCapacity
¶
Protected Functions
-
void
writeMessages
(uint64_t CurrentClock)¶ Loops through the storedData vector and assigns values to output message.
- Return
void
- Parameters
CurrentClock
: The current time used for time-stamping the message
-
bool
readMessages
()¶ This method is used to read the incoming data supply/outgoing data messages and store them for future use.
- Return
void
-
void
integrateDataStatus
(double currentTime)¶ Integrates the dataStatus over all of the dataNodes.
Loops through all of the input messages, integrates the baud rates, and adds the new data to the storedData vector
- Return
void
- Parameters
currentTime
:
-
void
customSelfInit
()¶
-
void
customCrossInit
()¶ Custom output input reading method. This allows a child class to add additional functionality.
-
void
customReset
(uint64_t CurrentClock)¶ Custom subscription method, similar to customSelfInit.
-
void
customWriteMessages
(uint64_t CurrentClock)¶ Custom Reset method, similar to customSelfInit.
-
bool
customReadMessages
()¶ custom Write method, similar to customSelfInit.
-
int
messageInStoredData
(DataNodeUsageSimMsg *tmpNodeMsg)¶ Custom read method, similar to customSelfInit; returns true by default.
Returns index of the dataName if it’s already in storedData
Checks to see if a data node is in the storedData vector or not, returns the index.
- Return
index
- Parameters
tmpNodeMsg
:
-
double
sumAllData
()¶ Sums all of the data in the storedData vector.
Sums all of the data in the storedData vector
- Return
double
Protected Attributes
-
std::vector<std::int64_t>
nodeDataUseMsgIds
¶ Vector of all the data node messages IDs the storage unit is subscribed to.
-
int64_t
storageUnitDataOutMsgId
¶ Message ID of storage Unit output message.
-
DataStorageStatusSimMsg
storageStatusMsg
¶
-
std::vector<DataNodeUsageSimMsg>
nodeBaudMsgs
¶
-
double
storedDataSum
¶ [bits] Stored data in bits.
-
std::vector<dataInstance>
storedData
¶
-
double
previousTime
¶ Vector of data. Represents the makeup of the data buffer.
-
double
currentTimestep
¶ Previous time used for integration.
-
double
netBaud
¶ [s] Timestep duration in seconds.
-
uint64_t
outputBufferCount
¶ Net baud rate at a given time step.
-