Closed saharhoteit closed 1 year ago
Hello,
the E2E delay needs to be computed by the applications running on the vehicles. So, in the code of the application you are using, you should implement a statistic that computes and emits the E2E delay. See the CBRSender/CBRReceiver apps as an example.
Best regards. Giovanni
Hello, In the paper "Exploiting Simu5G for generating datasets for training and testing AImodels for 5G/6G network applications ", there is the following formula: simtime_t delay_val= rxTime - txTime; (Listing 4). What is the meaning of rxTime and txTime
Hello, In the paper "Exploiting Simu5G for generating datasets for training and testing AImodels for 5G/6G network applications ", there is the following formula: simtime_t delay_val= rxTime - txTime; (Listing 4). What is the meaning of rxTime and txTime
Hello, rxTime is the time a packet was received at the receiving module (e.g., receiver application), whereas txTime is the time the same packet was sent from the transmitting module (e.g., sender application). Their difference is the end-to-end delay.
Hello all, we have implemented a Vulnerable Road Users scenario that consists of users sending an alert message to nearby vehicles to inform them of their status. We aim in our simulation to study the effect of enabling mobile edge computing (MEC) on the average end to end latency. We have added the E2E delay statistics in the following files: AlertReceiver.ned, AlertReceiver.h, AlertReceiver.cc
But, the problem, in the result file (.vec), we don’t have the endToEnd delay. Can you help me please ?
---------------------------------------------AlertReceiver.ned----------------------------------------------------------------------------
// Simu5G
// Authors: Giovanni Nardini, Giovanni Stea, Antonio Virdis (University of Pisa)
// This file is part of a software released under the license included in file
// "license.pdf". Please read LICENSE and README files before using it.
// The above files and the present reference are part of the software itself,
// and cannot be removed from it.
package simu5g.apps.alert;
import inet.applications.contract.IApp;
simple AlertReceiver like IApp
{
parameters:
int localPort = default(3000);
string interfaceTableModule;
string multicastInterface = default("wlan"); // if not empty, set the multicast output interface option on the socket (interface name expected)
@signal[alertDelay];
@statistic[alertDelay](title="Alert Message Delay"; unit="s"; source="alertDelay"; record=mean, vector);
@signal[alertRcvdMsg];
@statistic[alertRcvdMsg](title="Alert Messages Received"; unit="s"; source="alertRcvdMsg"; record=sum, vector);
@display("i=block/source");
@signalalertEndToEndDelay;
@statistic[alertEndToEndDelay](title="End-to-end delay"; source="alertEndToEndDelay"; record=mean,vector);
gates:
output socketOut;
input socketIn;**
-----------------------------------------------AlertReceiver.h-------------------------------------------------------------------------------- // Simu5G // Authors: Giovanni Nardini, Giovanni Stea, Antonio Virdis (University of Pisa) // // This file is part of a software released under the license included in file // "license.pdf". Please read LICENSE and README files before using it. // The above files and the present reference are part of the software itself, // and cannot be removed from it.
class AlertReceiver : public omnetpp::cSimpleModule { inet::UdpSocket socket;
omnetpp::simsignal_t alertDelay_;
omnetpp::simsignal_t alertRcvdMsg_;
omnetpp::simsignal_t alertEndToEndDelay_;
omnetpp::simtime_t delaySum;
long nrReceived;
protected:
virtual int numInitStages() const override { return inet::NUM_INIT_STAGES; }
void initialize(int stage) override;
void handleMessage(omnetpp::cMessage *msg) override;
// utility: show current statistics above the icon
virtual void refreshDisplay() const override;
};
---------------------------------------------------AlertReceiver.cc ---------------------------------------------------------------------- // Simu5G // // Authors: Giovanni Nardini, Giovanni Stea, Antonio Virdis (University of Pisa) // // This file is part of a software released under the license included in file // "license.pdf". Please read LICENSE and README files before using it. // The above files and the present reference are part of the software itself, // and cannot be removed from it. //
Define_Module(AlertReceiver); using namespace inet;
void AlertReceiver::initialize(int stage) { cSimpleModule::initialize(stage);
if (stage != inet::INITSTAGE_APPLICATION_LAYER)
return;
int port = par("localPort");
EV << "AlertReceiver::initialize - binding to port: local:" << port << endl;
if (port != -1)
{
socket.setOutputGate(gate("socketOut"));
socket.bind(port);
// for multicast support
inet::IInterfaceTable *ift = inet::getModuleFromPar<inet::IInterfaceTable>(par("interfaceTableModule"), this);
inet::MulticastGroupList mgl = ift->collectMulticastGroups();
socket.joinLocalMulticastGroups(mgl);
// if the multicastInterface parameter is not empty, set the interface explicitly
const char *multicastInterface = par("multicastInterface");
if (multicastInterface[0]) {
NetworkInterface *ie = ift->findInterfaceByName(multicastInterface);
if (!ie)
throw cRuntimeError("Wrong multicastInterface setting: no interface named \"%s\"", multicastInterface);
socket.setMulticastOutputInterface(ie->getInterfaceId());
}
// -------------------- //
}
alertDelay_ = registerSignal("alertDelay");
alertRcvdMsg_ = registerSignal("alertRcvdMsg");
alertEndToEndDelay_ = registerSignal("alertEndToEndDelay");
nrReceived = 0;
delaySum = 0;
}
void AlertReceiver::handleMessage(cMessage *msg) { if (msg->isSelfMessage()) return;
Packet* pPacket = check_and_cast<Packet*>(msg);
// read Alert header
auto alert = pPacket->popAtFront<AlertPacket>();
// emit statistics
simtime_t delay = simTime() - alert->getPayloadTimestamp();
emit(alertDelay_, delay);
emit(alertRcvdMsg_, (long)1);
nrReceived++;
delaySum+=delay;
simtime_t delayVal = simTime() - msg->getCreationTime();
emit(alertEndToEndDelay_, delayVal);
EV << "AlertReceiver::handleMessage - Packet received: SeqNo[" << alert->getSno() << "] Delay[" << delay << "]" << "] EndToEndDelay [" << delayVal << endl;
delete msg;
}
void AlertReceiver::refreshDisplay() const { char buf[80]; if(nrReceived >0){ sprintf(buf, "received: %ld pks\nav. delay: %s s", nrReceived, (delaySum/nrReceived).format(-4).c_str()); } else { sprintf(buf, "received: 0 pks"); } getDisplayString().setTagArg("t", 0, buf); }
---------------------------------------------omnet.ini ---------------------------------------------------------------------------------- [General] cmdenv-express-mode = true cmdenv-autoflush = true image-path = ../../images network = simu5g.simulations.NR.VRUNR.Highway
##########################################################
########################################################## debug-on-errors = false print-undisposed = false
sim-time-limit = 20s
#########################################################
########################################################## *.alert.vector-recording = true .scalar-recording = false .vector-recording = false
**.routingRecorder.enabled = false
output-scalar-file = ${resultdir}/${configname}/${iterationvars}-${repetition}.sca output-vector-file = ${resultdir}/${configname}/${iterationvars}-${repetition}.vec
.numUeCell = 0 .numUeD2D = 2
.playgroundSizeX = 20000m .playgroundSizeY = 20000m *.playgroundSizeZ = 50m
##########################################################
########################################################## .veinsManager.host = "localhost" # if traci-launchd runs on localhost .veinsManager.moduleType = "simu5g.nodes.cars.NRCar" .veinsManager.moduleName = "car" .veinsManager.launchConfig = xmldoc("heterogeneous.launchd.xml") *.veinsManager.updateInterval = 0.1s
##########################################################
########################################################## .car[].mobilityType = "VeinsInetMobility"
##########################################################
##########################################################
**.numBands = 25
.ueTxPower = 26 .eNodeBTxPower = 46
.car[].cellularNic.nrPhy.dynamicCellAssociation = true .car[].masterId = 0 # ignored if dynamic association is disabled .car[].macCellId = 0 # ignored if dynamic association is disabled .car[].nrMasterId = 1 # ignored if dynamic association is disabled .car[].nrMacCellId = 1 # ignored if dynamic association is disabled
.gNodeB1.macCellId = 1 .gNodeB1.macNodeId = 1 .gNodeB2.macCellId = 2 .gNodeB2.macNodeId = 2
.car[].cellularNic.nrPhy.enableHandover = true .gNodeB.cellularNic.phy.enableHandover = true .gNodeB.cellularNic.phy.handoverLatency = 50ms .gNodeB.cellInfo.broadcastMessageInterval = 1s # eNB will sends broadcast triggers every second
.gNodeB.numX2Apps = 1 # one x2App per peering eNodeB .gNodeB.x2App[].server.localPort = 5000 + ancestorIndex(1) # Server ports (x2App[0]=5000, x2App[1]=5001, ...) .gNodeB1.x2App[0].client.connectAddress = "gNodeB2%x2ppp0" *.gNodeB2.x2App[0].client.connectAddress = "gNodeB1%x2ppp0" .sctp.nagleEnabled = false # if true, transmission of small packets will be delayed on the X2 .sctp.enableHeartbeats = false
#
# [Config D2DMulticast]
.ue[].macCellId = 1 .ue[].masterId = 1 .ue[*].mobility.initFromDisplayString = false
.ueD2D[0].mobility.initialX = 250m .ueD2D[0].mobility.initialY = 250m
.ueD2D[1].mobility.initialX = 251m .ueD2D[1].mobility.initialY = 250m
.ueD2D[].numApps = 1 **.ueTxPower = 23
.ueD2D[].app[].typename = "AlertSender" .ueD2D[].app[].localPort = 3088+ancestorIndex(0) .ueD2D[].app[].startTime = uniform(0s,0.02s) .ueD2D[].app[].stopTime = 4.9s .ueD2D[].app[].destAddress = "224.0.0.10" # IP address of the multicast group .ueD2D[].app[].destPort = 1000
**.amcMode = "D2D"
.enableD2DCqiReporting = false .usePreconfiguredTxParams = true **.d2dCqi = ${cqi=7}
.car[].numApps = 1
.car[0..7].app[].typename = "AlertReceiver" .car[0..7].app[].localPort = 1000
.car[].configurator.mcastGroups = "224.0.0.10"
Hello,
I think that you might have mistakenly disabled the metrics using this line in the omnetpp.ini file:
*.alert.vector-recording = true
Try to change it to something like:
**.alert**.vector-recording=true
Best regards. Giovanni
Hello,
Thank you for response. To calculate the delay of an alert message this code it's right simtime_t delayVal = simTime() - msg->getCreationTime();
void AlertReceiver::handleMessage(cMessage *msg) { if (msg->isSelfMessage()) return;
Packet pPacket = check_and_cast<Packet>(msg);
// read Alert header auto alert = pPacket->popAtFront();
// emit statistics simtimet delay = simTime() - alert->getPayloadTimestamp(); emit(alertDelay, delay); emit(alertRcvdMsg_, (long)1); nrReceived++; delaySum+=delay;
simtimet delayVal = simTime() - msg->getCreationTime(); emit(alertEndToEndDelay, delayVal); EV << "AlertReceiver::handleMessage - Packet received: SeqNo[" << alert->getSno() << "] Delay[" << delay << "]" << "] EndToEndDelay [" << delayVal << endl;
delete msg;
ello all, we have implemented a Vulnerable Road Users scenario that consists of users sending an alert message to nearby vehicles to inform them of their status. We aim in our simulation to study the effect of enabling mobile edge computing (MEC) on the average end to end latency. We have added the E2E delay statistics in the following files: AlertReceiver.ned, AlertReceiver.h, AlertReceiver.cc
I have changed *.alert.vector-recording = true to .alert.vector-recording=true But, the problem, in the result file (.vec), we don’t have the endToEnd delay. Can you help me please ?
In the vector file I have only two vectors
In the attachements the different files
Hello,
looking at the result file, there is only the metrics related to the message transmission (alertSentMsg). Considering this, maybe the problem is not how you collect statistics, but it might be that the receivers do not receive the messages at all. Make sure, for example, that the receiving UEs are in the transmission range of the sender.
Hello, Thank you for the response. I Have a question : It is necessary to implement the statistics of the end to end delay in the sender.cc and the receiver
Hello,
I deleted the .alert.vector-recording = true and I changed **.vector-recording=true. So, I have the results but not the end to end delay. I don't know what is the problem
I attached the following files :
Hello, Thank you for the response. I Have two questions :
Hello,
How we know that the receiver has received the alert message ? And how we know that the receiving UEs are in the transmission range of the sender ?
Thanks for your help
Hello,
Please how we can calculate the creation time of an alert message (in AlertReceiver.cc)
The creation time is not calculated. You can retrieve by adding the following line in the handleMessage() function: alert->getTag<CreationTimeTag>()->getCreationTime();
To do that you also need to include the required library: #include <inet/common/TimeTag_m.h>
Hello,
What is the condition for sending an alert message (the distance is less than a threshold ?). For example, if a car sends an alert message to another car to its inform that an ue is approaching, what is the condition ?
I am not sure I get your question. If you refer to the AlertSender app in the apps folder, there are no conditions. The sender just sends one small packet periodically, possibly using a multicast IP address.
Hello,
iI it possible to implement a scenario where a vehicle sends an alert message to others when an UE approaches the vehicle?
If you modify the application code to that effect.... yes
Hello, I have created a module obstacleDetector in order to a car[0] sends an alert to other vehicles when it detects an obstacle This the following file // obstacleDetector. ned package simu5g.apps.obstacle;
import inet.physicallayer.contract.packetlevel.IRadioMedium; import inet.physicallayer.contract.packetlevel.IRadioMediumControl; import inet.physicallayer.contract.packetlevel.IRadioMediumListener; import inet.physicallayer.contract.packetlevel.Packet; import inet.physicallayer.packetlevel.RadioMedium; import inet.applications.contract.IApp;
// Définition du module obstacleDetector module obstacleDetector like IApp { // Définir les ports d'entrée et de sortie input in; output out;
// Ajouter un attribut pour détecter les obstacles
bool obstacleDetected;
// Définir les paramètres de simulation
parameters:
double detectionRange @unit(m); // Portée de détection de l'obstacle
submodules:
// Ajouter un sous-module pour la voiture
car0: car {
@display("p=50,50");
gates:
inout radio;
}
connections:
// Connecter le sous-module car0 à la sortie "out" du module obstacleDetector
out --> car0.in;
// Connecter la voiture "car0" à tous les autres véhicules via un canal sans fil
for i=1..7 {
WirelessChannel.channel++ <--> car0.radio <--> WirelessChannel.channel++;
}
// Mettre à jour l'attribut obstacleDetected en fonction de l'entrée "in"
car0.obstacleDetected <== (in.value() <= detectionRange);
}
In this file I have the error : unexpected INPUT_. I don't understand this error.
Thanks
Hello,
I have three questions :
Please help me ?
1 - it means that the car sends the first message at a random time between 0 and 20 ms
2 - yes
3 - in the omnetpp.ini, you can set *.cars[0].app[*].period = exponential(1s)
, assuming lambda = 1s
Hello all, we have implemented a Vulnerable Road Users scenario that consists of users sending an alert message to nearby vehicles to inform them of their status. We aim in our simulation to study the effect of enabling mobile edge computing (MEC) on the average end to end latency. An example of the scenario with only two users and 7 vehicles is in attachement.
The simulation results gave us only the mac delay, rlc delay and rlc pdu delay, please find in attachement the results we have got. We would like to know if there is way to determine the E2E delay directly, or in other terms, how to enable to output the delay from the other layers? Thanks Best regards resultat.csv