Search code examples
omnet++veins

How to implement a vehicle module in OMNeT++ that simultaneously supports LTE, WiFi, and DSRC networks?


I want to merge the Car module from Simu5G or SimuLTE with the Car module from Veins into one module, so that this module can use both cellular communication and DSRC communication. However, I’ve encountered many issues, including problems with the Mobility and ipConfigurator module. I’m wondering if anyone has attempted this before. I know there was a project called VeinsLTE that attempted something like this, but that project is quite old, and the architecture used by SimuLTE in it is significantly different from the current one, so it doesn't work in my environment. I am using the Simu5G 1.2.1 PnP virtual machine. I have just started using OMNeT++ recently and am not very familiar with many aspects. I would appreciate it if you could point out any issues.

Thank you!

This is my lteAndWifiAndCar.ned

package simu5g.simulations.LTE.tltl;

import inet.networklayer.configurator.ipv4.Ipv4NetworkConfigurator;
import inet.networklayer.ipv4.RoutingTableRecorder;
import inet.node.ethernet.Eth10G;
import inet.node.ethernet.Eth10M;
import inet.node.inet.Router;
import inet.node.inet.StandardHost;
import simu5g.common.binder.Binder;
import simu5g.common.carrierAggregation.CarrierAggregation;
import simu5g.nodes.Ue;
import simu5g.nodes.eNodeB;
import simu5g.nodes.PgwStandard;
import simu5g.world.radio.LteChannelControl;

import inet.node.inet.WirelessHost;
import inet.node.wireless.AccessPoint;
import simu5g.simulations.LTE.tltl.LteAndWifiMedium;
import inet.physicallayer.wireless.ieee80211.packetlevel.Ieee80211ScalarRadioMedium;
import inet.visualizer.canvas.integrated.IntegratedCanvasVisualizer;
import simu5g.simulations.LTE.tltl.HetNetNode.HetNetHost;

import org.car2x.veins.subprojects.veins_inet.VeinsInetManager;
import inet.environment.common.PhysicalEnvironment;
import org.car2x.veins.visualizer.roads.RoadsCanvasVisualizer;
import org.car2x.veins.visualizer.roads.RoadsOsgVisualizer;
//import simu5g.nodes.cars.Car;
import org.car2x.veins.base.connectionManager.ConnectionManager;
import org.car2x.veins.base.modules.BaseWorldUtility;
import org.car2x.veins.modules.mobility.traci.TraCIScenarioManager*;
import org.car2x.veins.modules.obstacle.ObstacleControl;
import org.car2x.veins.modules.world.annotations.AnnotationManager;
import org.car2x.veins.base.modules.*;

network lteAndWifiAndCar
{
    parameters:
        double playgroundSizeX @unit(m); // x size of the area the nodes are in (in meters)
        double playgroundSizeY @unit(m); // y size of the area the nodes are in (in meters)
        double playgroundSizeZ @unit(m); // z size of the area the nodes are in (in meters)
        int numUe = default(1);
        int numHost = default(1);
        int numUser;
        @display("i=block/network;bgb=1010,543;bgi=background/budapest");
    submodules:
//        visualizer: IntegratedCanvasVisualizer {
//            parameters:
//                @display("p=50.993748,406.70624;is=s");
//        }
        routingRecorder: RoutingTableRecorder {
            @display("p=50.993748,156.7125;is=s");
        }
        configurator: Ipv4NetworkConfigurator {
            @display("p=50.993748,220.14375;is=s");
        }
        server: StandardHost {
            @display("p=526.10626,36.06875;is=n;i=device/server");
        }

        //lte
        channelControl: LteChannelControl {
            @display("p=50,25;is=s");
        }
        binder: Binder {
            @display("p=50.993748,277.35626;is=s");
        }
        carrierAggregation: CarrierAggregation {
            @display("p=50.993748,334.56876;is=s");
        }
        lteRouter: Router {
            @display("p=460.1875,133.08125;i=device/smallrouter");
        }
        pgw: PgwStandard {
            @display("p=252.48125,186.5625;is=l");
        }
        eNB: eNodeB {
            @display("p=302.23126,324.61874;is=vl");
        }
        ue[numUe]: HetNetHost {
            @display("i=device/car_vs;p=401.73123,411.68124");
        }

        //wifi
        radioMedium: Ieee80211ScalarRadioMedium {
            @display("p=49.75,95.76875;is=s");
        }
        wifiRouter: Router {
            @display("p=638.04376,133.08125;i=device/smallrouter");
        }
        ap: AccessPoint {
            parameters:
                @display("p=686.55,243.775;is=m;r=,,#707070");
        }
//        host[numHost]: HetNetHost {
//            parameters:
//                @display("i=device/car_vs;p=526.10626,324.61874");
//        }

        //cars
//        manager: VeinsInetManager {
//            @display("p=939.03125,34.825;is=s");
//        }
//        physicalEnvironment: PhysicalEnvironment {
//            @display("p=939.03125,236.3125;is=s");
//        }
//        roadsCanvasVisualizer: RoadsCanvasVisualizer {
//            @display("p=939.03125,95.76875;is=s");
//        }
//        roadsOsgVisualizer: RoadsOsgVisualizer if useOsg {
//            @display("p=939.03125,164.175;is=s");
//        }





        obstacles: ObstacleControl {
            @display("p=939.03125,104.475;is=s");
        }
        annotations: AnnotationManager {
            @display("p=939.03125,192.78125");
        }
        connectionManager: ConnectionManager {
            parameters:
                @display("p=939.03125,49.75;i=abstract/multicast;is=s");
        }
        world: BaseWorldUtility {
            parameters:
                playgroundSizeX = veins_eval_by_version(veins_omnetpp_buildnum(), "playgroundSizeX", 1525, "parent.playgroundSizeX");
                playgroundSizeY = veins_eval_by_version(veins_omnetpp_buildnum(), "playgroundSizeY", 1525, "parent.playgroundSizeY");
                playgroundSizeZ = veins_eval_by_version(veins_omnetpp_buildnum(), "playgroundSizeZ", 1525, "parent.playgroundSizeZ");
                @display("p=50.993748,473.86874;i=misc/globe;is=s");
        }
        manager: TraCIScenarioManagerLaunchd {
            parameters:
                @display("p=939,263;is=s");
        }
        node[0]: HetNetHost{
            
        }
    connections:
        server.pppg++ <--> Eth10G <--> lteRouter.pppg++;
        lteRouter.pppg++ <--> Eth10G <--> pgw.filterGate;
        pgw.pppg++ <--> Eth10G <--> eNB.ppp;

        lteRouter.pppg++ <--> Eth10G <--> wifiRouter.pppg++;
        wifiRouter.ethg++ <--> Eth10M <--> ap.ethg++;
}

This is my hetNetHost.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 simu5g.simulations.LTE.tltl.HetNetNode;

import inet.networklayer.configurator.ipv4.HostAutoConfigurator;
import inet.node.inet.WirelessHost;
import simu5g.stack.ICellularNic;
import simu5g.corenetwork.statsCollector.UeStatsCollector;
import org.car2x.veins.modules.nic.Nic80211p;

//import org.car2x.veins.subprojects.veins_inet.VeinsInetMobility;

//
// Wireless-enabled Host
//
module HetNetHost extends WirelessHost
{
    parameters:
        numWlanInterfaces = default(1);
        @display("i=device/cellphone");

        //# is lte/DSRC enabled ?
        bool enableLTE = default(false);
        bool enableDSRC = default(false);

        //# Mobility
        mobility.typename = default("StationaryMobility");

        //# Apps
//        int numApps = default(0);   // no of apps.
//                                     Specify the app types in INI file with app[0..1].typename="UdpVideoStreamClient" syntax 

        //# Transport layer
//        bool hasUdp = default(firstAvailableOrEmpty("Udp") != "");
//        bool hasTcp = default(firstAvailableOrEmpty("Tcp", "TcpLwip", "TcpNsc") != "");
//        bool hasSctp = default(false);

        //# Node specs
        string nodeType = "UE";  // DO NOT CHANGE
        int masterId @mutable;
        int macNodeId @mutable = default(0); // TODO: this is not a real parameter
        int macCellId @mutable = default(0); // TODO: this is not a real parameter

        //# D2D capability
        string nicType = default("LteNicUe");

        //# Network Layer specs
        //        bool hasIpv4 = default(true);
        //        bool hasIpv6 = default(false);
        *.interfaceTableModule = default(absPath(".interfaceTable"));
        *.routingTableModule = default("^.ipv4.routingTable");

        //# External Ethernet interfaces
        //        int numEthInterfaces = default(0);
        string extHostAddress = default("");

        //# Loopback interfaces
//        int numLoInterfaces = default(1);

        //# Num of PcapRecorders
//        int numPcapRecorders = default(0); // no of PcapRecorders

        bool hasRNISupport = default(false);

        string applType = default(""); //type of the application layer
//        string nicType = default("Nic80211p"); // type of network interface card
        string veinsmobilityType = default("org.car2x.veins.modules.mobility.traci.TraCIMobility"); //type of the mobility module
    gates:
        input cellularRadioIn @directIn;     // connection to master
        input veinsradioIn @optional @directIn; // gate for sendDirect

    submodules:
        veinsApp: <applType> like org.car2x.veins.base.modules.IBaseApplLayer if enableDSRC {
            parameters:
                @display("i=block/app,p,1131.258,79.03;p=1131.258,79.03");
        }
        cellularNic: <nicType> like ICellularNic if enableLTE {
            nodeType = parent.nodeType;
            @display("p=570,987.6923");
        }
        nic: <default("Nic80211p")> like org.car2x.veins.modules.nic.INic80211p if enableDSRC {
            parameters:
                @display("p=1133.516,986.74603");
        }
        veinsmobility: <default("")> like org.car2x.veins.base.modules.IMobility if typename != "" {
            parameters:
                @display("p=124.19,824.17004;i=block/cogwheel;is=s");
        }
        ueCollector: UeStatsCollector if hasRNISupport {
            @display("p=124.61539,723.07697;is=s");
        }

    connections allowunconnected:
//        cellularNic.upperLayerOut --> li.in++;
//        cellularNic.upperLayerIn <-- li.out++;

        cellularNic.upperLayerOut --> nl.in++ if exists(cellularNic);
        cellularNic.upperLayerIn <-- nl.out++ if exists(cellularNic);
        cellularNic.radioIn <-- cellularRadioIn if exists(cellularNic);

        nic.upperLayerOut --> veinsApp.lowerLayerIn if exists(nic);
        nic.upperLayerIn <-- veinsApp.lowerLayerOut if exists(nic);
        nic.upperControlOut --> veinsApp.lowerControlIn if exists(nic);
        nic.upperControlIn <-- veinsApp.lowerControlOut if exists(nic);

        veinsradioIn --> nic.radioIn if exists(nic);
}


and this is my omnetpp.ini

[Config lteAndWifiAndCar]
network = lteAndWifiAndCar

*.configurator.addStaticRoutes = false
*.configurator.dumpAddresses = true

*.numUe = ${numUEs=5}                 
*.numHost = ${numHosts=2}           
*.numUser = numHost+numUe          

*.ue[*].enableLTE = true
*.node[*].enableLTE = true

*.configurator.config = xmldoc("./hetNetIpConfig.xml")

#lte
#=============  ================
*.ue[*].numApps = 1
*.server.numApps = parent.numUser        

# connect each UE to the eNB
*.ue[*].macCellId = 1                  
*.ue[*].masterId = 1                   

#=============  ============
*.eNB.mobility.initFromDisplayString = false        
*.eNB.mobility.initialX = 300m
*.eNB.mobility.initialY = 300m
*.ue[*].mobility.constraintAreaMaxX = 600m
*.ue[*].mobility.constraintAreaMaxY = 600m
*.ue[*].mobility.constraintAreaMinX = 0m
*.ue[*].mobility.constraintAreaMinY = 0m
*.ue[*].mobility.initFromDisplayString = false
#*.ue[*].mobility.initialX = uniform(0m,600m)
#*.ue[*].mobility.initialY = uniform(0m,600m)

#*.ue[*].mobility.initialX = 0m         
#*.ue[*].mobility.initialY = 0m

*.ue[*].mobility.speed = 10mps
*.ue[*].mobility.typename = "CircleMobility"        
*.ue[*].mobility.cx = 300m                  
*.ue[*].mobility.cy = 300m
*.ue[*].mobility.r = 100m + ancestorIndex(1)*30m         
*.ue[*].mobility.startAngle = ancestorIndex(1)*30deg        

#lte
*.server.app[*].typename = "UdpEchoApp"
*.server.app[*].localPort = 8000+ancestorIndex(0)
*.ue[*].app[*].typename = "UdpBasicApp"
#*.ue[*].app[*].destAddresses = "server" 
*.ue[*].app[*].destAddresses = "10.0.2.1"
*.ue[*].app[*].destPort = 8000+ancestorIndex(1)
*.ue[*].app[*].localPort = 7777 
*.ue[*].app[*].messageLength = intuniform(10B, 100B)
*.ue[*].app[*].sendInterval = exponential(0.01s)
*.ue[*].app[*].packetName = "tltl-lte"
*.ue[*].app[*].startTime = uniform(0s,0.02s)

#wifi
# management submodule parameters
*.node[*].wlan[0].mgmt.numChannels = 5

# access point
*.ap.wlan[*].mgmt.ssid = "TLTL"
*.ap.wlan[*].mgmt.beaconInterval = 100ms

#Mobility configure
#*.host[*].mobility.initFromDisplayString = false
#*.host[*].mobility.typename = "LinearMobility"
#*.host[0].mobility.speed = 10mps
#*.host[1].mobility.speed = 15mps
#*.host[*].mobility.initialMovementHeading = 0deg
#*.host[*].mobility.updateInterval = 100ms
#*.host[*].mobility.constraintAreaMinX = 40m
#*.host[*].mobility.constraintAreaMaxX = 800m
#*.host[0].mobility.initialX = 526.10626m
#*.host[0].mobility.initialY = 324.61874m
#*.host[1].mobility.initialX = 526.10626m
#*.host[1].mobility.initialY = 364.61874m

*.node[*].veinsmobility.typename = "org.car2x.veins.modules.mobility.traci.TraCIMobility"
*.node[*].mobility.typename = "TraCIMobility"
*.node[*].veinsmobility.x = 0
*.node[*].veinsmobility.y = 0
*.node[*].veinsmobility.z = 0
*.node[*].veinsmobility.setHostSpeed = false
*.node[*].veinsmobility.accidentCount = 0
*.node[*].veinsmobility.accidentStart = 73s
*.node[*].veinsmobility.accidentDuration = 50s

#*.node[*].mobility.typename = "org.car2x.veins.modules.mobility.traci.TraCIMobility"
#*.node[*].mobility.typename = "org.car2x.veins.modules.mobility.traci.VeinsInetMobility"
#*.node[*].mobility.typename = "VeinsInetMobility"
#*.node[*].mobility.typename = "TraCIMobility"
#*.node[*].mobility.x = 0
#*.node[*].mobility.y = 0
#*.node[*].mobility.z = 0
#*.node[*].mobility.setHostSpeed = false
#*.node[*].mobility.accidentCount = 0
#*.node[*].mobility.accidentStart = 73s
#*.node[*].mobility.accidentDuration = 50s

#*.node[*].mobility.x = 0
#*.node[*].mobility.y = 0
#*.node[*].mobility.z = 0
#*.node[*].mobility.initialX = 0m
#*.node[*].mobility.initialY = 0m


# wireless channels
**.analogModel.ignorePartialInterference = true
*.ap.wlan[*].radio.channelNumber = 2
*.node[*].wlan[0].radio.channelNumber = 0  # just initially -- it'll scan

# wireless configuration
**.radio.transmitter.power = 1.0mW # sets communication ranges

#**.networkConfiguratorModule = ""  # no need for configurator

*.node[*].wlan[0].agent.activeScan = false
*.node[*].wlan[0].agent.defaultSsid = "TLTL"
*.node[*].wlan[0].agent.channelsToScan = " "  # " " means all
*.node[*].wlan[0].agent.probeDelay = 0.1s
*.node[*].wlan[0].agent.minChannelTime = 0.15s
*.node[*].wlan[0].agent.maxChannelTime = 0.3s

# visualization
#*.visualizer.physicalLinkVisualizer.displayLinks = true
#*.visualizer.dataLinkVisualizer.displayLinks = true
#*.visualizer.packetFlowVisualizer.displayRoutes = true

#*.visualizer.routingTableVisualizer.displayRoutingTables = true
*.ap.wlan[0].radio.displayCommunicationRange = true

*.node[*].numApps = 1

*.node[*].app[0].typename = "UdpBasicApp"
*.node[*].app[0].destAddresses = "server" 
#*.node[*].app[*].destAddresses = "10.0.2.2"
*.node[*].app[0].destPort = 8005+ancestorIndex(1)
*.node[*].app[0].localPort = 8888
*.node[*].app[0].messageLength = intuniform(10B, 100B)
*.node[*].app[0].sendInterval = exponential(0.01s)
*.node[*].app[0].packetName = "tltl-wifi"
*.node[*].app[0].startTime = uniform(0s,0.02s)

##cars
#*.host[*].numWlanInterfaces = 2
#
## 
#*.host[*].app[1].typename = "UdpBasicApp"
#*.host[*].app[1].interface = "wlan1"
#*.host[*].app[1].destAddresses = "224.0.0.1"    
#*.host[*].app[1].destPort = 8001            
#*.host[*].app[1].localPort = 8000           
#*.host[*].app[1].messageLength = intuniform(10B, 100B)
#*.host[*].app[1].sendInterval = exponential(0.01s)
#*.host[*].app[1].packetName = "tltl-v2v"
#*.host[*].app[1].startTime = uniform(0s, 2s)
#
## 
#*.host[*].app[2].typename = "UdpSink"
#*.host[*].app[2].localPort = 8001
#
## Ieee80211Interface
#*.host[*].wlan[1].mgmt.typename = "Ieee80211MgmtAdhoc"
#*.host[*].wlan[1].agent.typename = ""
#*.host[*].wlan[1].opMode = "p"      
#*.host[*].wlan[1].radio.typename = "Ieee80211ScalarRadio"
#*.host[*].wlan[1].radio.bandName = "5.9 GHz"
#*.host[*].wlan[1].radio.channelNumber = 3
#*.host[*].wlan[1].radio.transmitter.power = 20mW
#*.host[*].wlan[1].radio.bandwidth = 10 MHz
#*.host[*].wlan[1].radio.antenna.mobility.typename = "AttachedMobility"
#*.host[*].wlan[1].radio.antenna.mobility.mobilityModule = "^.^.^.^.mobility"
#*.host[*].wlan[1].radio.antenna.mobility.offsetX = -2.5m
#*.host[*].wlan[1].radio.antenna.mobility.offsetZ = 1.5m
#
## 
#*.host[*].wlan[1].radio.antenna.mobility.constraintAreaMinX = 0m
#*.host[*].wlan[1].radio.antenna.mobility.constraintAreaMaxX = 0m
#*.host[*].wlan[1].radio.antenna.mobility.constraintAreaMinY = 0m
#*.host[*].wlan[1].radio.antenna.mobility.constraintAreaMaxY = 0m
#*.host[*].wlan[1].radio.antenna.mobility.constraintAreaMinZ = 0m
#*.host[*].wlan[1].radio.antenna.mobility.constraintAreaMaxZ = 0m


#DSRC configurate
*.node[*].enableDSRC = true

*.playgroundSizeX = 2500m
*.playgroundSizeY = 2500m
*.playgroundSizeZ = 50m

# Annotation parameters
*.annotations.draw = true

# Obstacle parameters
#*.obstacles.obstacles = xmldoc("config.xml", "//AnalogueModel[@type='SimpleObstacleShadowing']/obstacles")


# TraCIScenarioManager parameters
*.manager.updateInterval = 0.005s
*.manager.host = "localhost"
*.manager.port = 9999
*.manager.autoShutdown = true
*.manager.launchConfig = xmldoc("test.launchd.xml")
*.manager.moduleType = "simu5g.simulations.LTE.tltl.HetNetNode.HetNetHost"

#connectionManager parameters
*.connectionManager.sendDirect = true
*.connectionManager.maxInterfDist = 2600m
*.connectionManager.drawMaxIntfDist = false

*.**.nic.mac1609_4.useServiceChannel = false

*.**.nic.mac1609_4.txPower = 20mW
*.**.nic.mac1609_4.bitrate = 6Mbps
*.**.nic.phy80211p.minPowerLevel = -110dBm

*.**.nic.phy80211p.useNoiseFloor = true
*.**.nic.phy80211p.noiseFloor = -98dBm

*.**.nic.phy80211p.decider = xmldoc("config.xml")
*.**.nic.phy80211p.analogueModels = xmldoc("config.xml")
*.**.nic.phy80211p.usePropagationDelay = true

*.**.nic.phy80211p.antenna = xmldoc("antenna.xml", "/root/Antenna[@id='monopole']")
*.node[*].nic.phy80211p.antennaOffsetY = 0 m
*.node[*].nic.phy80211p.antennaOffsetZ = 1.895 m


Solution

  • If your simulation does not need to model any of the higher-layer functionality of DSRC (like channel hopping and service advertisements), you should be okay with using the INET Framework's 802.11 model in 802.11p mode. See the Veins_INET subproject - e.g., at https://github.com/sommer/veins/blob/veins-5.2/subprojects/veins_inet/examples/veins_inet/omnetpp.ini#L14 - for how to do that.

    To ensure that MAC parameters are set to what 802.11p stacks typically use, set values like mac.hcf.edcaTxopProcedures[*].txopLimit and mac.hcf.edca.edcaf[0].aifsn accordingly. See https://github.com/riebl/artery/blob/4bfd0af/src/artery/inet/VanetNic.ned for an example that parameterizes INET's Ieee80211Nic to match IEEE 802.11p.