Raashid
Raashid

Reputation: 149

Cars following two different application layers

I am building an attack scenario where a vehicle, attacker, follows another vehicle, normal. The attacker starts sending BSMs with faulty position data to make normal stop on the road that it is traveling.

I have implemented AttackerCarApplLayer for attacker to use functions defined for it specifically and NormalCarApplLayer for normal.

I have defined the TraCIScenarioManager settings in omnetpp.ini as follows:

##########################################################
#            TraCIScenarioManager parameters             #
##########################################################
*.manager.updateInterval = 0.1s
*.manager.host = "localhost"
*.manager.port = 9999
*.manager.moduleType = "org.car2x.veins.nodes.AttackerCar"
*.manager.moduleName = "attacker"
*.manager.moduleType = "org.car2x.veins.nodes.Car"
*.manager.moduleName = "car"
*.manager.moduleDisplayString = ""
*.manager.autoShutdown = true
*.manager.margin = 25
#launch config. tells Veins which SUMO configuration to run
*.manager.configFile = "newyork.sumo.cfg"
#launch command. change sumo-gui with sumo depending on what you want to launch
*.manager.commandLine = "sumo-gui --remote-port $port --seed $seed --configuration-file $configFile"

And NormalCarWaveApplLayer settings as:

##########################################################
#                    WaveAppLayer                        #
##########################################################
*.car[*].applType = "NormalCarApplLayer"
*.car[*].appl.debug = false
*.car[*].appl.headerLength = 256 bit
*.car[*].appl.sendBeacons = true
*.car[*].appl.dataOnSch = false
*.car[*].appl.beaconInterval = 1s
*.car[*].appl.beaconPriority = 3
*.car[*].appl.dataPriority = 2
*.car[*].appl.maxOffset = 0.005s
*.car[*].appl.avoidBeaconSynchronization = true

And AttackerCarWaveApplLayer settings as:

##########################################################
#                   Attacker WaveAppLayer                #
##########################################################
*.attacker[*].applType = "AttackerCarApplLayer"
*.attacker[*].appl.debug = false
*.attacker[*].appl.headerLength = 256 bit
*.attacker[*].appl.sendBeacons = true
*.attacker[*].appl.dataOnSch = false
*.attacker[*].appl.beaconInterval = 1s
*.attacker[*].appl.beaconPriority = 3
*.attacker[*].appl.dataPriority = 2
*.attacker[*].appl.maxOffset = 0.005s
*.attacker[*].appl.avoidBeaconSynchronization = true

When the simulation launches, only AttackerCarApplLayer is instantiated for both normal and attacker. Is this the correct way to achieve my goal? If not, please suggest what you think.

Upvotes: 2

Views: 295

Answers (1)

Christoph Sommer
Christoph Sommer

Reputation: 6943

You are currently specifying moduleType and moduleName twice in your simulation's .ini file. The default behavior of OMNeT++ to use the first value it finds for a parameter. This is unlikely to be what you want. If you can use different SUMO vehicle types for your attackers and normal cars, here is how you can solve your problem instead:

Veins 4.5 allows you to use different values for moduleType, moduleName, and moduleDisplayString depending on the SUMO vehicle type. Simply set one SUMO vehicle type for your attackers, for example ATTACK, then refer to the syntax of https://github.com/sommer/veins/blob/veins-4.5/src/veins/modules/mobility/traci/TraCIScenarioManager.cc#L63 to set per-type configurations in your .ini file. For example, *.manager.moduleName = "ATTACK=attacker *=car"

Upvotes: 3

Related Questions