Table of Contents

Class Receiver

Namespace
NominalSystems.Classes
Assembly
NominalSystems.Classes.dll

[Nominal] This class handles the receiving of data from a Link Block and can read the data and submit it to some kind of data storage. The receiver can decode messages stored and return them as values ready for use.


public class Receiver : Antenna
Inheritance
Receiver
Derived

Constructors

Receiver()

Default constructor

protected Receiver()

Fields

BufferSize

The size of the buffer of data that can be stored before the data is deleted. When the buffer is exceeded, the oldest data is removed, packet by packet.

[Unit("B")]
public double BufferSize

Field Value

double

DeleteCorruptedPackets

A flag whether to delete packets that are corrupted. If true, all packets that are corrupted will be deleted. If false, the packets will be available in the output buffer.

[Metadata(IsAdvanced = true)]
public bool DeleteCorruptedPackets

Field Value

bool

Diameter

Diameter of the receiver dish

[Unit(UnitType.METRE)]
[Range(0, 1.7976931348623157E+308)]
public double Diameter

Field Value

double

DownlinkTimesData

The list of downlink times that are being processed. This will be used user for serialization and deserialization of the data. The data will be stored in the data set and will be used for the processing of the data.

[Hidden]
public List<double> DownlinkTimesData

Field Value

List<double>

EnableDopplerShift

A flag whether to enable the Doppler shift or not. If true, the Doppler shift will be calculated and applied to the data.

[Metadata(IsAdvanced = true)]
public bool EnableDopplerShift

Field Value

bool

InterferenceFraction

The fraction of packets that were interfered with

[Unit(UnitType.NONE)]
[ReadOnly]
[Metadata(IsAdvanced = true)]
public double InterferenceFraction

Field Value

double

ProcessingData

The list of processing packet data that is being processed. This will be used for serialization and deserialization of the data. The data will be stored in the data set and will be used for the processing of the data.

[Hidden]
public List<JArray> ProcessingData

Field Value

List<JArray>

ReadyData

The list of ready data that is being processed. This will be used for serialization and deserialization of the data. The data will be stored in the data set and will be used for the processing of the data.

[Hidden]
public JObject ReadyData

Field Value

JObject

SignalToNoise

Current Signal to noise ratio of active link

[Unit(UnitType.NONE)]
[ReadOnly]
public double SignalToNoise

Field Value

double

ThresholdSignalToNoise

Cuts off the signal to noise ratio if it is below a value

[Unit(UnitType.DECIBEL)]
[Range(0, 1.7976931348623157E+308)]
[Metadata(IsAdvanced = true)]
public double ThresholdSignalToNoise

Field Value

double

Properties

NumDataReady

The number of chunks of data that are ready to be received and handled by the user.

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

Property Value

int

NumProcessingPackets

The number of packets that are being processed. The processing time depends on the bitrate of the receiver.

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

Property Value

int

Methods

GetReadyKeys()

Returns the list of keys stored in the receiver that are ready in the ready data output buffer.

public string[] GetReadyKeys()

Returns

string[]

The array of keys available

GetReadyMessageKeys()

Returns the list of keys stored in the receiver that are ready in the ready data output buffer and are messages.

public string[] GetReadyMessageKeys()

Returns

string[]

The array of message keys available

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

ReceiveBytes(string)

Checks the buffer, at a particular key, and returns the oldest byte array clump of data that exists on the receiver. If the key is invalid or no data is found, an empty byte array will be returned. This will also remove the data from the queue, and it will be deleted from the receiver.

public byte[] ReceiveBytes(string key = "")

Parameters

key string

The key to check the data on

Returns

byte[]

A byte array from the received data

ReceiveJSON(string)

Checks the buffer, at a particular key, and returns the oldest JSON object clump of data that exists on the receiver. If the key is invalid or no data is found, a null reference will be returned. This will also remove the data from the queue, and it will be deleted from the receiver.

public JToken? ReceiveJSON(string key = "")

Parameters

key string

The key to check the data on

Returns

JToken

A JSON object from the received data

ReceiveMessage(Message?, string)

Checks the buffer, at a particular key, and attempts to update a message with the data from the buffer. This will return whether the message is successfully updated. If there is no data, or the key is invalid, then the message will not be updated.

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

Parameters

msg Message

The message to update the data with

key string

The key to check the data on

Returns

bool

A successful update of the message

ReceiveString(string)

Checks the buffer, at a particular key, and returns the oldest string clump of data that exists on the receiver. If the key is invalid or no data is found, an empty string will be returned. This will also remove the data from the queue, and it will be deleted from the receiver.

public string ReceiveString(string key = "")

Parameters

key string

The key to check the data on

Returns

string

A string from the received data