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 Xmera data storage modules based on this DataStorageUnitBase inherit the following common properties:
Writes out a DataStorageStatusMsgPayload 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 integers containing the stored data associated with each type (bits).
Allows for multiple DataNodeUsageMsgPayload corresponding to individual dataNodeBase instances to be subscribed to using the
addDataNodeToModel(msg)method.Iterates through attached DataNodeUsageMsgPayload 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.
Add or remove data from specified partitions using
setDataBuffer()method.
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 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 connection 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 |
|---|---|---|
nodeDataUseInMsgs |
Vector of data node usage input messages. Subscribed to using |
|
storageUnitDataOutMsg |
Output message. Describes storage unit capacity, storage level, net data rate, and contents. |
User Guide#
The user can connect to the output message using
storageUnitDataOutMsgin Python.The input message (data nodes) are provided by calling the method
addDataNodeToModel()
-
class DataStorageUnitBase : public SysModel#
on-board data handling base class
Subclassed by PartitionedStorageUnit, SimpleStorageUnit
Public Functions
-
DataStorageUnitBase()#
This method initializes some basic parameters for the module.
- Returns:
void
-
~DataStorageUnitBase()#
Destructor.
- Returns:
void
-
void reset(uint64_t currentSimNanos)#
This method is used to reset the module.
- Parameters:
currentSimNanos –
- Returns:
void
-
void addDataNodeToModel(Message<DataNodeUsageMsgPayload> *tmpNodeMsg)#
Adds dataNode to the storageUnit.
Adds a simDataNodeMsg name to be iterated over. Called in Python.
- Parameters:
tmpNodeMsg –
- Returns:
void
-
void updateState(uint64_t currentSimNanos)#
Reads messages, adds new data to the storage unit, and writes out the storage unit status
- Parameters:
currentSimNanos – The current simulation time in nanoseconds
- Returns:
void
-
void setDataBuffer(std::string partitionName, int64_t data)#
Adds/removes the data from the partitionName partition once.
Adds a specific amount of data to the storedData vector once
- Parameters:
partitionName – //Name of the partition to add data to
data – //Amount of data to add to the partition
- Returns:
void
Public Members
-
std::vector<ReadFunctor<DataNodeUsageMsgPayload>> nodeDataUseInMsgs#
Vector of data node input message names.
-
Message<DataStorageStatusMsgPayload> storageUnitDataOutMsg#
Vector of message names to be written out by the storage unit.
-
int64_t storageCapacity#
Storage capacity of the storage unit.
-
BSKLogger bskLogger#
logging variable
-
DataStorageUnitBase()#