C++ Module: simpleTransmitter
Executive Summary
This module provides first-order modeling of data downlinking from a simple transmitter at a fixed baud rate. Specifically, the transmitter reads a DataStorageStatusMsgPayload from the storage unit it is subscribed to, searches for the data buffer with the maximum amount of data, and downlinks a packet of data at a fixed baud rate. The transmitter writes out a DataNodeUsageMsgPayload describing the data name and baud rate of the data it wants to downlink.
For more information on how to set up and use this module, see the simple data system example: scenarioDataDemo
Module Assumptions and Limitations
Each scheduled update with the device commanded off publishes zero baud and an empty partition name. It advances the update clock without adding bits to the packet. If the same storage source remains available and the unfinished packet’s partition still contains data, the first enabled update resumes that packet at the configured baud rate.
Suspending the transmitter task also suspends its update clock. If the task resumes with the device
enabled, the interval used for packet progress includes the scheduling gap. To discard partial progress
on power-up, call Reset(currentSimNanos) on the transmitter before its first enabled update.
The transmitter uses the last storage input added. If that input is disconnected or unwritten at an update,
the transmitter discards any partial packet and publishes zero baud with an empty partition name.
Calling Reset() or addStorageUnitToTransmitter() also discards a partial packet, even when adding the
same storage message again. The next packet uses the largest available partition.
When editing storageUnitInMsgs directly, the transmitter compares the selected payload address at each
update. Disconnecting and restoring the same address between updates preserves the partial packet.
Message Connection Descriptions
This module uses the input and output messages of the C++ Module: dataNodeBase base class, plus an additional DataStorageStatusMsgPayload input message subscribed to and read in customRead() method.
Msg Variable Name |
Msg Type |
Description |
|---|---|---|
storageUnitInMsgs |
vector of data storage input messages. These are set using the |
User Guide
This module inherits the user guide from the C++ Module: dataNodeBase base class, but there are several key differences from other C++ Module: dataNodeBase child classes:
Unlike other child classes of C++ Module: dataNodeBase, this module does not require a user to set a nodeDataName
The nodeBaudRate variable should be set to a negative value in order to remove data from the storage unit.
The user must specify a packetSize variable (negative value) in addition to the nodeBaudRate variable
The user must specify the number of buffers numBuffers variable so the transmitter knows how many buffers to search through
The user must specify the storage unit the transmitter should subscribe to using the addStorageUnitToTransmitter()` method
To set up this module users must create a SimpleTransmitter instance:
transmitter = simpleTransmitter.SimpleTransmitter()
transmitter.ModelTag = "transmitter"
Set the nodeBaudRate, packetSize, and numBuffers variables:
transmitter.nodeBaudRate = -16000. # baud
transmitter.packetSize = -1E6 # bits
transmitter.numBuffers = 2
The next step is to attach one or more DataStorageStatusMsgPayload instances to it using the addStorageUnitToTransmitter() method:
transmitter.addStorageUnitToTransmitter("msg name")
The final step is to add the model to task:
scenarioSim.AddModelToTask(taskName, transmitter)
Follow the C++ Module: partitionedStorageUnit or C++ Module: simpleStorageUnit instructions to add the transmitter to a storage unit.
For more information on how to set up and use this module, see the simple data system example: scenarioDataDemo
-
class SimpleTransmitter : public DataNodeBase
- #include <simpleTransmitter.h>
simple data transmitter class
Public Functions
-
SimpleTransmitter()
Constructor, which sets the default nodeDataOut to zero.
-
~SimpleTransmitter()
-
void addStorageUnitToTransmitter(Message<DataStorageStatusMsgPayload> *tmpStorageUnitMsg)
Adds a dataStorageStatusMsgPayload to be accessed by transmitter.
- Parameters:
tmpStorageUnitMsg – A spacecraft state message name.
Public Members
-
double packetSize
Size of packet to downklink (bytes).
-
int numBuffers
Number of buffers the transmitter can access.
-
int currentIndex = -1
Current partition that the transmitter is downlinking a packet for.
-
std::vector<ReadFunctor<DataStorageStatusMsgPayload>> storageUnitInMsgs
Vector of data node input message names.
-
std::vector<DataStorageStatusMsgPayload> storageUnitMsgs
local copies of input messages
-
BSKLogger bskLogger
class variable
Private Functions
-
void evaluateDataModel(DataNodeUsageMsgPayload *dataUsageMsg, double currentTime) override
Loads the nodeDataOut attribute into the dataUsageSimMessage instance.
-
bool customReadMessages() override
-
void customReset(uint64_t currentClock) override
-
int getMaxIndex()
-
SimpleTransmitter()