# Net4sat wiki

### Sidebar

OpenSAND implements, in the physical layer, link budget calculations to emulate the loss of packets due to attenuation.

The SNR value is calculated for each leg of the communication (uplink and downlink), where it is affected by attenuation. On reception, the total SNR is calculated, and compared against a reference value, which can depend on the type of MODCOD used. If the total SNR is below the reference, then the packet is considered lost.

Link budget calculation and error emulation in OpenSAND is implemented by four different sub-systems:

• Attenuation: specifies the attenuation for a given link.
• Minimal Condition: specifies the total SNR threshold for QEF communications.
• Error Insertion: specifies the action taken when a packet is below the minimal condition.
• Clear Sky Condition: specifies the clear sky SNR for a given link.

The SNR for each link and for each packet is calculated with the following expression: $$SNR_{dB} = clear\_sky\_condition_{dB} - attenuation_{dB}$$

And the total link budget: $$SNR_{TOTAL} = \left( SNR_{UP}^{-1} + SNR_{DOWN}^{-1} \right)^{-1}$$

The obtained $SNR_{TOTAL}$ value is compared to the minimal condition threshold: if it is below, then the Error Insertion action will be performed on the packet. Else, the packet is considered error free.

## OpenSAND Exploitation

Although the Link Budget calculation is always performed for every packet, it is only relevant when attenuation is enabled.

Link Budget is configured through the different blocks that form part of it:

• Attenuation
• Minimal Condition
• Error Insertion
• Clear Sky Condition

Each of these components can be configured for the uplink and downlink of every ST and GW, in the Advanced dialog of the Configuration tab (uplink_physical_layer and downlink_physical_layer under each host). Minimal condition and Error Insertion can only be configured for downlinks.

Some of these functions are implemented using plugins. Plugins can be configured by selecting the name of the plugin in the bottom-left box: the configuration will appear in the bottom-right box.

Every change in the model type for any of the functions (Attenuation, Minimal Condition and Error Insertion) needs to be applied (button Apply) before the corresponding plugin can be configured).

### Minimal Condition

The Minimal Condition specifies the threshold value that will determine whether a packet is lost or not. Since the total SNR is calculated on reception, this function is only configured for downlinks.

There are two types of minimal condition implemented in OpenSAND: Constant and ACM-Loop.

#### Constant

Minimal Condition used by default. It implements a constant Minimal Condition, with default value equal to 0 dB (this means that all packets with SNR < 0 dB will be dropped).

The parameters are configured in the plugin configuration file constant.conf.

Parameter name Description Value type Range of values Default value
threshold Constant threshold value for Quasi-Error Free communications, expressed in dB double - 0

#### ACM-Loop

When using the ACM Loop minimal condition plugin, the threshold value for QEF communications of the module Minimal Condition varies depending on the MODCOD of the packet received, which is stored in the frame header. The reference values are loaded from the MODCOD definition files used by the DVB layer for FMT simulation.

There is no configuration associated with this plugin.

### Error Insertion

The Error Insertion plugin determines the action to take when the total SNR of a packet is below the threshold level.

For the time being, OpenSAND only implements a single Error Insertion plugin, called Gate, which drops packets when they are below the minimal condition threshold.

No configuration is needed for this plugin.

### Clear Sky Condition

Clear sky condition represents the value of the SNR for a link when there is no attenuation. There is no plugin associated to this value.

The parameter clear_sky_conditions specifies the constant SNR for a given link.

### Probes

Each of the subsystems provides different probes to keep track of the link budget calculations. These probes are available for all hosts of type ST and GW, under the Phy section:

• downlink_attenuation: stores the value of the attenuation (in dB) on the downlink for this host.
• downlink_clear_sky_condition: stores the value of the SNR for clear sky conditions (in dB) on the downlink for this host.
• downlink_total_cn : stores the value of the total SNR (in dB) for this host.
• drops: stores the number of packets with errors in the interval.
• minimal_condition: stores the threshold value (in dB) for QEF communications.
• uplink_attenuation: stores the value of the attenuation (in dB) on the uplink for this host.
• uplink_clear_sky_condition: stores the value of the SNR for clear sky conditions (in dB) on the uplink for this host.

### Validation

A simple way to validate the Link Budget feature, is to add an attenuation:

1. Enable attenuation, in the Configuration tab.
2. Change the default attenuation (0 dB):
1. in the Advanced dialog, select a host and choose either the uplink or downlink physical layer configuration.
2. select the Ideal plugin in the bottom left box, and change the attenuation_value for the selected link. Any value over 20 dB should cause losses (default clear sky condition is 20 dB, and default minimal condition threshold is 0 dB).
3. Start simulation, and send traffic (e.g. a ping) via the link where the attenuation was changed. Packets should be lost. This can be corroborated with the Drops probe on the receiving side.

## OpenSAND Software Design

All of the Link Budget subsystems are implemented in the Physical Layer Block. Some features are implemented in the Upward channel, while other on the Downward channel.

All functions related to minimal condition and error insertion, are performed on the Upward channel (receiving side of STs and GWs) of the Physical Layer Block. On the Downward channel, the SNR of packets being sent is calculated. Since all configurations related to attenuation, minimal condition, error insertion, and clear sky condition are performed only on ST and GW hosts, the satellite does not intervene in the calculation of the link budget.

For packets going out of a host (GW or ST), the procedure is the following:

1. The packet SNR (uplink) is set to: clear_sky_condition - attenuation (in method PhyChannel::addSegmentCN)

For packets being received on a host (GW or ST), the procedure is the following:

1. The minimal condition is updated (method PhyChannel::updateMinimalCondition calls the plugin updateThreshold method with the packet MODCOD ID).
2. The SNR of the downlink is set to: clear_sky_condition - attenuation (in method PhyChannel::getTotalCN).
3. The total SNR is calculated according to the expression on top of this page (in method PhyChannel::getTotalCN).
4. The packet total SNR is contrasted against the minimal condition threshold (using method ErrorInsertion::isToBeModifiedPacket)
5. If true, the packet is modified.

### Minimal Condition

The Minimal Condition sub-system is implemented using plugins of the class MinimalCondition. The main attributes of this class are:

• double minimal_cn. The attribute minimal_cn contains the value of minimal SNR (in dB) to have QEF transmissions.

The main virtual methods of the Minimal Condition class are:

• bool init(): Load the plugin parameters.
• bool updateThreshold(uint8_t modcod_id): This method is called to change the minimal_cn depending on the new conditions of the communications obtained from MODCOD Id.

These virtual methods are implemented by each of the different plugins. In particular, the ACM_Loop implements the updateThreshold method as follows: it will read the MODCOD ID and set the minimal_cn to the value specified in the MODCOD definition file.

### Error Insertion

The Minimal Condition sub-system is implemented using plugins of the class MinimalCondition. The main methods of this class are:

• bool init(): Load the plugin parameters.
• bool isToBeModifiedPacket(double cn_total, double threshold_qef): This method determines if the received message does not comply with the minimum SNR requirements for having a QEF transmission.
• bool modifyPacket (unsigned char *payload, size_t length): When a message arrives, if the function isToBeModifiedPacket() determines that the packet is not QEF, modifyPacket() function will alter the message, depending on the plugin chosen. Moreover, if the function returns true, the packet header will be tagged as CORRUPTED and then rejected from DVB layer, else the DVB layer may accept it.

### Clear Sky Condition

The Clear Sky Condition is implemented as a parameter of the associated PhyChannel, which is used when the link SNR is calculated.