car node can't receive wave short messages - omnet++

I have a scenario that includes a single car node and a single RSU node. the car sends a beacon message every 1s. when the RSU receives a beacon message, it should reply back to the sender (the car) with a wave short message.
I create a WSM once the RSU receives a BSM, and I set the receiver's ID to the bsm sender ID (as I want the RSU to send the message only to a specific node). the problem is that the wsm in never received by the car (onWSM function is never called).
here is the code:
void RSUApp::onBSM(BasicSafetyMessage* bsm)
{
/*this fn is called when rsu receives a beacon*/
/*after receiving beacon, send the value of the current speed*/
WaveShortMessage* msg= new WaveShortMessage("speed");
msg->setSenderAddress(this->myId);
msg->setWsmData(std::to_string(this->currentSpeed).c_str());
int Id = bsm->getSenderAddress();
populateWSM(msg,Id,0);
sendDown(msg);
}
when I replace the receiver's ID by -1 (send broadcast message instead of sending to specific node), the car APP can handle the WSM without problems.
populateWSM(msg,-1,0);
I am using veins 4.7 and this is the ini file contents:
*.rsu[0].mobility.x = 500
*.rsu[0].mobility.y = 50
*.rsu[0].mobility.z = 3
*.rsu[*].applType = "iteration6.src.RSUApp"
*.rsu[*].appl.headerLength = 80 bit
*.rsu[*].appl.sendBeacons = false
*.rsu[*].appl.dataOnSch = false
*.connectionManager.sendDirect = true
*.connectionManager.maxInterfDist = 2600m
*.connectionManager.drawMaxIntfDist = true
*.**.nic.mac1609_4.useServiceChannel = false
*.**.nic.mac1609_4.txPower = 20mW
*.**.nic.mac1609_4.bitrate = 6Mbps
*.**.nic.phy80211p.sensitivity = -89dBm
*.**.nic.phy80211p.useThermalNoise = true
*.**.nic.phy80211p.thermalNoise = -110dBm
*.**.nic.phy80211p.decider = xmldoc("config.xml")
*.**.nic.phy80211p.analogueModels = xmldoc("config.xml")
*.**.nic.phy80211p.usePropagationDelay = true
*.node[*].applType = "iteration6.src.carApp"
*.node[*].appl.headerLength = 80 bit
*.node[*].appl.sendBeacons = true
*.node[*].appl.dataOnSch = false
*.node[*].appl.beaconInterval = 1s
can anyone help me with that problem?

It seems like you are using the wrong id for the recipient. Instead of
int Id = bsm->getSenderModuleId();
you should rather use
int Id = bsm->getSenderAddress();
This should do the trick.
See the following sources for more details:
WaveShortMessage
populateWSM

The newer version of veins returns MAC based myId while previous versions returned Module Identifier. This needs to be kept in mind while assigning addresses to nodes.

Related

Unable to open messaging channel in Substrate Tutorial

Replace chain-spec.rs
In Open Message Passing Channels guide, use the parachain-template.js parachain_id of 1000, 1001 respectively.
Add sudo pallet to runtime/lib.js.
impl pallet_sudo::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
}
construct_time!(
// Sudo: pallet_sudo, // or next line does not success open channel
Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>},
)
Use cargo build -release for node/src/chain-spec.rs with parachian_id = 1000 and 1001 respectively.
Start a test network with zombienet, where config.toml is configured according to the Simulate Parachains documentation.
[relaychain]
default_command = "polkadot-v0.9.32"
default_args = [ "-lparachain=debug" ]
chain = "rococo-local"
[[relaychain.nodes]]
name = "alice"
validator = true
ws_port = 9900
[[relaychain.nodes]]
name = "bob"
validator = true
ws_port = 9901
[[relaychain.nodes]]
name = "charlie"
validator = true
ws_port = 9902
[[relaychain.nodes]]
name = "dave"
validator = true
ws_port = 9903
[[parachains]]
id = 1000
cumulus_based = true
[parachains.collator]
name = "parachain-A-1000-collator01"
command = "parachain-A-template-node-v0.9.32"
ws_port = 9910
[[parachains]]
id = 1001
cumulus_based = true
[parachains.collator]
name = "parachain-B-1001-collator01"
command = "parachain-B-template-node-v0.9.32"
ws_port = 9920
[[hrmpChannels]]
sender = 1000
recipient = 1001
maxCapacity = 8
maxMessageSize = 8000
[[hrmpChannels]]
sender = 1001
recipient = 1000
maxCapacity = 8
maxMessageSize = 8000
The question arises.
When I follow the documentation step by step, there is no hrmp.OpenChannelRequested event in the recent time of the relay chain when the transaction is submitted, and ump.ExecutedUpward shows incomplete.
Parachain 1000 XCM Parameter 1:
Parachain 1000 XCM Parameter 2:
Relaychain Error:
Parachain Event:
I followed the steps above and am not sure what step was missed that caused the error in step 5 to occur.

How can I integratre INET gPTP with INET TAS?

I would like to integrate two sample codes (TAS and gPTP) into the One Master Clock network environment.
The following are the .ini and .ned codes.
simpleGptp.ini
[General]
network = OneMasterClockGptpShowcase
**.displayGateSchedules = true
**.gateFilter = "**.eth[1].**"
**.gateScheduleVisualizer.height = 16
**.gateScheduleVisualizer.placementHint = "top"
# client applications
*.tsnDevice1.numApps = 2
*.tsnDevice1.app[*].typename = "UdpSourceApp"
*.tsnDevice1.app[0].display-name = "best effort"
*.tsnDevice1.app[1].display-name = "video"
*.tsnDevice1.app[*].io.destAddress = "tsnDevice2"
*.tsnDevice1.app[0].io.destPort = 1000
*.tsnDevice1.app[1].io.destPort = 1001
*.tsnDevice1.app[*].source.packetLength = 1000B - 54B # 42B = 8B (UDP) + 20B (IP) + 14B (ETH MAC) + 4B (ETH FCS) + 8B (ETH PHY)
*.tsnDevice1.app[0].source.productionInterval = exponential(200us) # ~40Mbps
*.tsnDevice1.app[1].source.productionInterval = exponential(400us) # ~20Mbps
# server applications
*.tsnDevice2.numApps = 2
*.tsnDevice2.app[*].typename = "UdpSinkApp"
*.tsnDevice2.app[0].io.localPort = 1000
*.tsnDevice2.app[1].io.localPort = 1001
# enable outgoing streams
*.tsnDevice1.hasOutgoingStreams = true
# client stream identification
*.tsnDevice1.bridging.streamIdentifier.identifier.mapping = [{stream: "best effort", packetFilter: expr(udp.destPort == 1000)},
{stream: "video", packetFilter: expr(udp.destPort == 1001)}]
# client stream encoding
*.tsnDevice1.bridging.streamCoder.encoder.mapping = [{stream: "best effort", pcp: 0},
{stream: "video", pcp: 4}]
# enable egress traffic shaping
*.tsnSwitch.hasEgressTrafficShaping = true
# time-aware traffic shaping
*.tsnSwitch.eth[*].macLayer.queue.numTrafficClasses = 2
*.tsnSwitch.eth[*].macLayer.queue.*[0].display-name = "best effort"
*.tsnSwitch.eth[*].macLayer.queue.*[1].display-name = "video"
*.tsnSwitch.eth[*].macLayer.queue.transmissionGate[0].offset = 0ms
*.tsnSwitch.eth[*].macLayer.queue.transmissionGate[0].durations = [4ms, 6ms] # period is 10 # length of periods
*.tsnSwitch.eth[*].macLayer.queue.transmissionGate[1].offset = 6ms
*.tsnSwitch.eth[*].macLayer.queue.transmissionGate[1].durations = [2ms, 8ms]
# enable time synchronization in all network nodes
*.*.hasTimeSynchronization = true
# all oscillators have a random constant drift
**.oscillator.typename = "ConstantDriftOscillator"
**.oscillator.driftRate = uniform(-100ppm, 100ppm)
# all Ethernet interfaces have 100 Mbps speed
*.*.eth[*].bitrate = 100Mbps
*.visualizer.typename = "IntegratedMultiCanvasVisualizer"
*.visualizer.infoVisualizer.displayInfos = true
# TSN clock gPTP master ports
*.tsnClock.gptp.masterPorts = ["eth0"]
# TSN switch gPTP bridge master ports
*.tsnSwitch.gptp.masterPorts = ["eth1", "eth2"]
# Set all reference clocks to master clock so the time difference can be visualized
**.referenceClock = "tsnClock.clock"
# data link visualizer displays gPTP time synchronization packets
*.visualizer.dataLinkVisualizer[0].displayLinks = true
*.visualizer.dataLinkVisualizer[0].activityLevel = "protocol"
*.visualizer.dataLinkVisualizer[0].packetFilter = "GptpSync"
*.visualizer.dataLinkVisualizer[0].lineColor = "blue2"
*.visualizer.numInfoVisualizers = 3
*.visualizer.infoVisualizer[0].modules = "*.tsnClock.clock"
*.tsnClock.clock.displayStringTextFormat = "time: %T"
*.visualizer.infoVisualizer[1].modules = "*.tsnSwitch.clock"
*.visualizer.infoVisualizer[1].placementHint = "topLeft"
*.visualizer.infoVisualizer[2].modules = "*.tsnDevice*.clock"
*.visualizer.infoVisualizer[2].placementHint = "bottom"
*.tsnDevice*.clock.displayStringTextFormat = "diff: %d"
*.tsnSwitch.clock.displayStringTextFormat = "diff: %d"
simpleGptp.ned
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
package tsn_scalability.simulations;
import inet.common.scenario.ScenarioManager;
import inet.networks.base.TsnNetworkBase;
import inet.node.ethernet.EthernetLink;
import inet.node.tsn.TsnClock;
import inet.node.tsn.TsnDevice;
import inet.node.tsn.TsnSwitch;
network OneMasterClockGptpShowcase extends TsnNetworkBase
{
submodules:
tsnClock: TsnClock {
#display("p=500,150");
}
tsnSwitch: TsnSwitch {
#display("p=500,300");
}
tsnDevice1: TsnDevice {
#display("p=400,450");
}
tsnDevice2: TsnDevice {
#display("p=600,450");
}
connections:
tsnClock.ethg++ <--> EthernetLink <--> tsnSwitch.ethg++;
tsnSwitch.ethg++ <--> EthernetLink <--> tsnDevice1.ethg++;
tsnSwitch.ethg++ <--> EthernetLink <--> tsnDevice2.ethg++;
}
Error message
omnetpp::common::expression::ExprNode::eval_error: Object nullptr has no member named 'destPort' -- in module (inet::queueing::PacketMultiplexer) OneMasterClockGptpShowcase.tsnDevice1.bridging.directionReverser.join (id=337), at t=0s, event #13
The problem happened when the tsnDevice1 sent the GptpPdelayReq packet passing through the bridging module.
If you have any ideas, please let me know. Thank you.
The gPTP packet doesn't contain a UDP header, so you should avoid dereferencing the UDP header if there's none.
For example:
expr(has(udp) && udp.destPort == 1000)
Ideally the gPTP packet is neither part of the video nor the best effort streams.
the example is for Store&Forward forwarding, if I try to switch to Cutthrough by adding *.*.hasCutthroughSwitching = true , the simulation ends with the errormessage Another packet streaming operation is already in progress -- in module (inet::physicallayer::EthernetPhyHeaderInserter) TsnMultiClient.switch.eth[5].phyLayer.phyHeaderInserter (id=705), at t=0.000000962s, event #87
Could this problem also solved with such a small tweak?
Thank you very much :)

simulation time limit issue

I am facing a problem with the simulation time limit.When It is reached, a new udp packet is created and the routing protocol is about to send a control packet then the end simulation event appears .so, how to prevent creating this udp packet at the end of simulation.
I am using INET veins-5.1-i2
omnetpp.ini file
network = Scenario
sim-time-limit = 24s
debug-on-errors = true
cmdenv-express-mode = true
image-path = ../../../../images
#UDPBasicApp
*.node[*].numApps = 1
*.node[*].app[0].typename = "UdpBasicApp"
*.node[1].app[0].destAddresses = "node[4]"
*.node[*].app[0].multicastInterface = "wlan0"
*.node[*].app[0].joinLocalMulticastGroups = true
*.node[*].app[0].destPort = 9001
*.node[*].app[0].localPort = 9001
*.node[*].app[0].messageLength = 100B
*.node[1].app[0].startTime = 21s
*.node[*].app[0].sendInterval = 1s
# Ieee80211Interface
*.node[*].wlan[0].opMode = "p"
*.node[*].wlan[0].radio.typename = "Ieee80211DimensionalRadio"
*.node[*].wlan[0].radio.bandName = "5.9 GHz"
*.node[*].wlan[0].radio.channelNumber = 3
*.node[*].wlan[0].radio.transmitter.power = 20mW
*.node[*].wlan[0].radio.bandwidth = 10 MHz
*.node[*].wlan[*].radio.antenna.mobility.typename = "AttachedMobility"
*.node[*].wlan[*].radio.antenna.mobility.mobilityModule = "^.^.^.^.mobility"
*.node[*].wlan[*].radio.antenna.mobility.offsetX = -2.5m
*.node[*].wlan[*].radio.antenna.mobility.offsetZ = 1.5m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMinX = 0m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMaxX = 0m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMinY = 0m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMaxY = 0m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMinZ = 0m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMaxZ = 0m
# HostAutoConfigurator
*.node[*].ipv4.configurator.typename = "HostAutoConfigurator"
*.node[*].ipv4.configurator.interfaces = "wlan0"
*.node[*].ipv4.configurator.mcastGroups = "224.0.0.1"
# VeinsInetMobility
*.node[*].mobility.typename = "VeinsInetMobility"
# VeinsInetManager
*.manager.updateInterval = 0.1s
*.manager.host = "localhost"
*.manager.port = 9999
*.manager.autoShutdown = true
*.manager.launchConfig = xmldoc("square.launchd.xml")
*.manager.moduleType = "org.car2x.veins.subprojects.veins_inet.VeinsInetCar"
# PhysicalEnvironment
*.physicalEnvironment.config = xmldoc("obstacles.xml")
*.radioMedium.obstacleLoss.typename = "IdealObstacleLoss"
# Misc
**.vector-recording = true
If the simulation time limit is low and you are afraid that a single extra packet can affect and throw off your results then:
a) You are doing it wrong because you have so few events and messages in your simulation that the result you receive has no statistical significance. (like: my packet delivery ratio is 81% (+- 60%) ???). This is useless. So, you should either run the simulation for a much longer time (if it converges to a steady state) or run a lot of simulations with different random generator seeds. In either case the effect of a single packet will disappear.
b) If you insist on counting all packets accurately and you don't want to loose even a single packet, then do what you would do in real life: stop sending packets from the data sources well before the simulation stops so all packets will have a chance (and time) to arrive at destination. You should configure your applications to stop sending at least a few seconds before the simulation time limit. There are parameters to do that in almost all application models.

Obtaining the sum of message byte lengths on the application layer by the Omnet++ result collection

Suppose in a wireless network with 25 nodes, we have a scenario where some of each node sends messages to some other nodes according to a routing protocol such as AODV. We simulate this network. After finishing the simulation, how to obtain the sum of messages byte length on the application layer by the Omnet++ result collection? For each node, we must have two metrics, a metric for sent message byte lengths (e.g. totalSentMessageByteLengths) and a metric for received message byte lengths (e.g. totalReceivedMessageByteLengths). If retransmission occurs, it should be summed once for the receiver side, summed the incorrect message byte lengths, and the correct message byte lengths for the sender side. If a node has more than an application, all the message byte lengths generated by all applications of the same node must be calculated. An instace code for a node in omnetpp.ini:
*.hostA.numApps = 2
*.hostA.app[0].typename = "UdpBasicApp"
*.hostA.app[0].destAddresses = "hostB"
*.hostA.app[0].destPort = 5000
*.hostA.app[0].messageLength = 1000B
*.hostA.app[0].sendInterval = exponential(12ms)
*.hostA.app[0].packetName = "UDPData"
*.hostA.app[0].typename = "TcpBasicApp"
*.hostA.app[0].destAddresses = "hostC"
*.hostA.app[0].destPort = 5001
*.hostA.app[0].messageLength = 1024B
*.hostA.app[0].sendInterval = exponential(45ms)
*.hostA.app[0].packetName = "TCPData"
Almost all application module has a packetSent or packetReceived statistics that gathers the mentioned data. So in short. Turn on scale statistics gathering on these apps.
**.app[*].*.scalar-recording = true

Obtaining the sum of correct message byte lengths on the network layer by the Omnet++ result collection

Suppose in a wireless network with 25 nodes, we have a scenario where some of each node sends messages to some other nodes according to a routing protocol such as AODV. We simulate this network. After finishing the simulation, how to obtain the sum of messages byte length on the network layer by the Omnet++ result collection?
For each node, we must have two metrics, a metric for sent message byte lengths (e.g. totalSentMessageByteLengths) and a metric for received message byte lengths (e.g. totalReceivedMessageByteLengths).
By correct messages, I mean messages received by a node whose destination address field is the address of the same node. If retransmission occurs, it should be summed once for the receiver side, summed the incorrect message byte lengths, and the correct message byte lengths for the sender side. If a node has more than an application, all the message byte lengths generated by all applications of the same node must be calculated. Message byte lengths mean the total byte of header and data on the network layer per byte.
An instace code for a node in omnetpp.ini:
*.hostA.numApps = 2
*.hostA.app[0].typename = "UdpBasicApp"
*.hostA.app[0].destAddresses = "hostB"
*.hostA.app[0].destPort = 5000
*.hostA.app[0].messageLength = 1000B
*.hostA.app[0].sendInterval = exponential(12ms)
*.hostA.app[0].packetName = "UDPData"
*.hostA.app[0].typename = "TcpBasicApp"
*.hostA.app[0].destAddresses = "hostC"
*.hostA.app[0].destPort = 5001
*.hostA.app[0].messageLength = 1024B
*.hostA.app[0].sendInterval = exponential(45ms)
*.hostA.app[0].packetName = "TCPData"
The Ipv4 module has several signals that can be used to create statistics either on a node or network level like packetSentToLower or packetReceivedFromLower. Just use these signals on your #statistics declaration.

Resources