AlertSender¶
Package: simu5g.apps.alert
simple module AlertSender
Generates periodic alert messages and sends them to a specified multicast group or unicast destination. The packet size, transmission period, start time, and stop time are configurable using the corresponding parameters. The destination address must be a multicast IP address. This module can be used in simulations that require periodic alert generation via device-to-device (D2D) communications, such as vehicular networks.
Inheritance diagram¶
Parameters¶
Name |
Type |
Default value |
Description |
|---|---|---|---|
localPort |
int |
-1 |
|
destPort |
int |
3000 |
|
destAddress |
string |
||
packetSize |
int |
10B |
|
period |
double |
0.02s |
|
startTime |
double |
0s |
|
stopTime |
double |
0s |
0 means “never stops” |
interfaceTableModule |
string |
||
multicastInterface |
string |
“cellular” |
If not empty, set the multicast output interface option on the socket (interface name expected) |
tos |
int |
-1 |
If not -1, set the Type of Service (IPv4) / Traffic Class (IPv6) field of sent packets to this value |
Properties¶
Name |
Value |
Description |
|---|---|---|
display |
i=block/source |
Gates¶
Name |
Direction |
Size |
Description |
|---|---|---|---|
socketOut |
output |
||
socketIn |
input |
Signals¶
Name |
Type |
Unit |
Description |
|---|---|---|---|
alertSentMsg |
Statistics¶
Name |
Title |
Source |
Record |
Unit |
Interpolation Mode |
Description |
|---|---|---|---|---|---|---|
alertSentMsg |
Alert messages sent |
alertSentMsg |
sum,vector |
Source code¶
//
// Generates periodic alert messages and sends them to a specified multicast
// group or unicast destination. The packet size, transmission period, start time, and stop
// time are configurable using the corresponding parameters. The destination address must be a
// multicast IP address. This module can be used in simulations that require periodic alert
// generation via device-to-device (D2D) communications, such as vehicular networks.
//
simple AlertSender like IApp
{
parameters:
int localPort = default(-1);
int destPort = default(3000);
string destAddress;
int packetSize @unit(B) = default(10B);
volatile double period @unit("s") = default(0.02s);
double startTime @unit("s") = default(0s);
double stopTime @unit("s") = default(0s); // 0 means "never stops"
string interfaceTableModule;
string multicastInterface = default("cellular"); // If not empty, set the multicast output interface option on the socket (interface name expected)
int tos = default(-1); // If not -1, set the Type of Service (IPv4) / Traffic Class (IPv6) field of sent packets to this value
@signal[alertSentMsg];
@statistic[alertSentMsg](title="Alert messages sent"; unit=""; source="alertSentMsg"; record=sum,vector);
@display("i=block/source");
gates:
output socketOut;
input socketIn;
}