Table of Contents

Class Transmitter

Namespace
NominalSystems.Classes
Assembly
NominalSystems.Classes.dll

[Nominal] This class handles the transmitting of data from some data source and can send out the data to a LinkedBlock that can communicate it over the ether. This requires a connection to some form of receiver.


public class Transmitter : Antenna
Inheritance
Transmitter
Derived

Constructors

Transmitter()

Initializes the transmitter

protected Transmitter()

Fields

BytesTransmitted

A counter for the number of bytes transmitted over the network. This is the sum of the bytes in the outgoing buffer over time.

[Unit("B")]
[ReadOnly]
public int BytesTransmitted

Field Value

int

CanTransmit

A flag that can be overwritten by a power module preventing the transmission from occurring.

[ReadOnly]
public bool CanTransmit

Field Value

bool

ForceTransmit

A flag that when enabled will force a transmission of a message

[Unit(UnitType.NONE)]
[Metadata(IsAdvanced = true)]
public bool ForceTransmit

Field Value

bool

IsTransmitting

A flag for if the transmitter is attempting to transmit data

[Unit(UnitType.NONE)]
[ReadOnly]
public bool IsTransmitting

Field Value

bool

LineLoss

Line Loss from transmitter to antenna

[Unit(UnitType.DECIBEL)]
[Metadata(IsAdvanced = true)]
public double LineLoss

Field Value

double

NextUplinkTime

The time when the next message can be uplinked

[Unit(UnitType.SECOND)]
[ReadOnly]
[Metadata(IsAdvanced = true)]
public double NextUplinkTime

Field Value

double

PacketSize

The number of bytes in each packet that is fixed within the packet list for the data.

[Unit("B")]
[Range(8, 1.7976931348623157E+308)]
public int PacketSize

Field Value

int

UplinkedMessage

A flag that specified if a message was uplinked

[ReadOnly]
[Metadata(IsAdvanced = true)]
public bool UplinkedMessage

Field Value

bool

Properties

NumOutPackets

The number of out messages in the telemetry buffer

[Unit(UnitType.NONE)]
[ReadOnly]
public int NumOutPackets { get; }

Property Value

int

NumPacketsLoaded

The number of in messages in the transmitter buffer

[Unit(UnitType.NONE)]
[ReadOnly]
[Metadata(IsAdvanced = true)]
public int NumPacketsLoaded { get; }

Property Value

int

Methods

GetPackets()

Copies the packets that are ready in the outgoing packet and returns the packets as an array. This ensures that the interface to the transmitter is unable to modify the data within the buffer.

public DataPacket[] GetPackets()

Returns

DataPacket[]

An array of the data packets ready to be copied

OnLoad(double)

Called after all of the data has been loaded from a save state on this object. This enables any post-load operations to be performed and extra data to be loaded from the metadata.

protected override void OnLoad(double time)

Parameters

time double

[s] The current clock time of the simulation

OnSave()

Called before the object is saved into the save state. This ensures that any additional metadata can be saved on the object before it is automatically serialized.

protected override void OnSave()

OnUpdate(double, double)

Called when the object should update from the simulation tick. This will take in a time and a step, where the time is the time of the clock before updating the object.

protected override void OnUpdate(double time, double step)

Parameters

time double

[s] Current time of the simulation before the update

step double

[s] The time-step to update during this tick

TransmitBytes(byte[], string)

Attempts to transmit a byte array across the network. The data will be converted to packets in the correct order and transmitted over the network. The key is used to have an identification of the data, which can provide additional context about the information that is sent, but can be completely optional.

public bool TransmitBytes(byte[] bytes, string key = "")

Parameters

bytes byte[]

The byte array to communicate across the network

key string

The key that defines the data on the network

Returns

bool

A successful flag if the data was added to the queue

TransmitJSON(JToken?, string)

Attempts to transmit a JSON object across the network. The data will be converted to packets in the correct order and transmitted over the network. The key is used to have an identification of the data, which can provide additional context about the information that is sent, but can be completely optional.

public bool TransmitJSON(JToken? json, string key = "")

Parameters

json JToken

The JSON object to communicate across the network

key string

The key that defines the data on the network

Returns

bool

A successful flag if the data was added to the queue

TransmitMessage(Message?, string)

Attempts to transmit a message across the network. The data will be converted to packets in the correct order and transmitted over the network. The key is used to have an identification of the data, which can provide additional context about the information that is sent, but can be completely optional. By default, if no key is present, the key will be the name of the message type.

public bool TransmitMessage(Message? msg, string key = "")

Parameters

msg Message

The message to communicate across the network

key string

The key that defines the data on the network

Returns

bool

A successful flag if the data was added to the queue

TransmitString(string, string)

Attempts to transmit a string across the network. The data will be converted to packets in the correct order and transmitted over the network. The key is used to have an identification of the data, which can provide additional context about the information that is sent, but can be completely optional.

public bool TransmitString(string str, string key = "")

Parameters

str string

The string to communicate across the network

key string

The key that defines the data on the network

Returns

bool

A successful flag if the data was added to the queue

TransmitTimedMessage(Message?, double, string)

Attempts to transmit a message across the network. The data will be converted to packets in the correct order and transmitted over the network. The key is used to have an identification of the data, which can provide additional context about the information that is sent, but can be completely optional. By default, if no key is present, the key will be the name of the message type. This contains an additional option for a custom time to transmit the message, if it was sent from another source.

public bool TransmitTimedMessage(Message? msg, double time, string key = "")

Parameters

msg Message

The message to communicate across the network

time double

[s] The time at the current moment of sending, to stamp the message

key string

The key that defines the data on the network

Returns

bool

A successful flag if the data was added to the queue