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 - addDataNodeToModelmethod.
- 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 - storageUnitDataOutMsgNamein Python.
- The input message names (data nodes) are provided by calling the method - addDataNodeToModel()
- 
class DataStorageUnitBase: public SysModel¶
- #include <dataStorageUnitBase.h>on-board data handling base class 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¶
- Storage capacity of the storage unit. 
 - 
BSKLogger bskLogger¶
- logging variable 
 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()¶
- Custom output input reading method. This allows a child class to add additional functionality. - Custom SelfInit() method. This allows a child class to add additional functionality to the SelfInit() method - Return
- void 
 
 - 
void customCrossInit()¶
- Custom subscription method, similar to customSelfInit. - Custom CrossInit() method. This allows a child class to add additional functionality to the CrossInit() method - Return
- void 
 
 - 
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 - Return
- void 
 
 - 
void customWriteMessages(uint64_t CurrentClock)¶
- custom Write method, similar to customSelfInit. - custom Write method, similar to customSelfInit. - Return
- void 
 
 - 
bool customReadMessages()¶
- Custom read method, similar to customSelfInit; returns true by default. - Custom read method, similar to customSelfInit; returns true by default. - Return
- void 
 
 - 
int messageInStoredData(DataNodeUsageSimMsg *tmpNodeMsg)¶
- 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¶
- class variable 
 - 
std::vector<DataNodeUsageSimMsg> nodeBaudMsgs¶
- class variable 
 - 
double storedDataSum¶
- [bits] Stored data in bits. 
 - 
std::vector<dataInstance> storedData¶
- Vector of data. Represents the makeup of the data buffer. 
 - 
double previousTime¶
- Previous time used for integration. 
 - 
double currentTimestep¶
- [s] Timestep duration in seconds. 
 - 
double netBaud¶
- Net baud rate at a given time step. 
 - 
uint64_t outputBufferCount¶
- class variable 
 
-