In VEINS 4.4, one can access the current location of the vehicles at the application layer (e.g. TraCIDemo11p) via "Mobility" module which is defined through TraCIMobility.
I followed the same approach to access the Mobility module at the lower layer (MAC1609_4.cc), where I added following statement at the stage 0 of the initialize function:
TraCIMobility* mobility = TraCIMobilityAccess().get(getParentModule());
However, I am not getting any compilation error, but when OMNET throws errors when the simulation starts and it gives following error.
Error in Module (MAC1609_4)
RSUExampleScenario.node[0].nic.mac1609_4(id=12) at event # 2, t = 0.1:
Assert: condition traci false in function get,
\veins/modules/mobility/traci/TraCIMobility.h line 193
I have searched around for different possible solutions, but, I am still unable to solve this problem.
Related posts are:
How to access TraCI command interface from TraCIDemoRSU11p in Veins Car2X simulator?
Transmission of vehicular status in Veins
RoadId() from the BaseWaveApplLayer.cc (VEINS, OMNET++)
How to get Coordinates of each vehicle in VEINS?
You are trying to access a TraCIMobility sub-module in the parent module of the Mac1609_4. This, however, is not the Car but the Nic80211p, which has no such sub-module, hence, the failing assertion.
It should work when you go up one additional layer in the hierarchy, as you then use the Car module as root to find the corresponding sub-module:
TraCIMobility* mobility = TraCIMobilityAccess().get(getParentModule()->getParentModule());
See the Car module and the Nic80211p module for reference:
https://github.com/sommer/veins/blob/veins-4.4/src/veins/nodes/Car.ned
https://github.com/sommer/veins/blob/veins-4.4/src/veins/modules/nic/Nic80211p.ned
Related
I am quite new to OMNET++ and I am currently working on a VANET simulation.
I am using the VeinsInCar module to simulate cars and the network being used is WLAN. I would like to change the coverage distance of the node. I tried using the following code but it is not working:
*.node*.wlan[0].radio.transmitter.communicationRange = 500m
Component in Ned file:
node[0]: VeinsInetCar {
#display("p=72,200;r=10");
}
Could you please help ?
Awaiting for a response.
Regards,
Azhar
The simulation configuration I want is for the vehicle and the RSU to communicate with each other through IEEE 802.11p and LTE through one eNB(eNodeB).
Refer to the veins_hetvnet repository and the paper Simulating cellular communications in vehicular networks: making SimuLTE interoperable with Veins to configure the .ned of each node and write the source code.
The error seems to occur in the code below among omnetpp.ini codes.
# car
**.car[*].masterId = 1
**.car[*].macCellId = 1
# RSU
**.fRSU[*].masterId = 1
**.fRSU[*].macCellId = 1
# Cell (eNodeB)
**.Cell.macCellId = 1
**.Cell.macNodeId = 1
**.dynamicCellAssociation = true
When I run the simulation, the following error occurs.
check_and_cast(): Cannot cast (LteMacEnbRealistic*)MyScenario.Cell.lteNic.mac to type 'LteMacEnbRealisticD2D*' -- in module (LteMacUeRealisticD2D) MyScenario.fRSU[0].lteNic.mac (id=184), during network initialization ..
The paper stated that it was the difference between automatic and manual coupling, but I don't know if that is true.
How can I modify the D2D communication with one eNB?
How I can create traffic light in OMNeT++ and SUMO, i have to create the traffic light and configure in XML file from which file using veins example.
The OMNeT++ proxy modules for SUMO traffic lights are available since Veins 4.7.
If you have a network including a traffic light, you need to add the following lines to your omnetpp.ini file:
*.manager.trafficLightModuleType = "org.car2x.veins.nodes.TrafficLight"
*.manager.trafficLightModuleName = "trafficLight"
*.manager.trafficLightModuleDisplayString = default
*.manager.trafficLightFilter = "MYTRAFFICLIGHTID"
*.trafficLight[*].mobility.x = 0
*.trafficLight[*].mobility.y = 0
*.trafficLight[*].mobility.z = 3
*.trafficLight[*].applType = "YOURAPPLAYERTYPE"
*.trafficLight[*].logicType = "YORUTRAFFICLIGHTLOGIC"
The term MYTRAFFICLIGHTID needs to be replaced with the ID you're using in your SUMO network. If you have multiple traffic lights to control, you can list SUMO IDs separated by spaces.
A traffic light consists of an application (YOURAPPLAYERTYPE) and a logic (YORUTRAFFICLIGHTLOGIC). Both properties are mandatory and need to be specified in your omnetpp.ini.
In the current Veins master branch, the YOURAPPLAYERTYPE is an OMNeT++ module, that uses the DemoBaseApplLayer as a the base module.
class YOURAPPLAYERTYPE: public DemoBaseApplLayer {
....
}
The YORUTRAFFICLIGHTLOGIC is an OMNeT++ module, that uses the TraCITrafficLightAbstractLogic as a the base module.
class YORUTRAFFICLIGHTLOGIC: public TraCITrafficLightAbstractLogic{
....
}
I'm working on Veins | OMNeT++ | SUMO.
Is it possible to select the starting position of our cars and the destination?
I only see spawn of vehicules at the exact same position and don't know how to adapt them. I've already read some topics explaining that we have cars that are created automatically by the TraCI module, but how can we control it?
Cars are initially created by SuMO and then inserted in Veins by the TraCIScenarioManager. In the demo example from Veins, multiple vehicles are driving from the same origin to the same destination:
194 Cars leaving the Computer Science Building and campus of the University of Erlangen-Nuremberg
In order to have different traffic, you have to adjust the network description files of SuMO - in particular the *.rou.xml. See the SuMO wiki for how to configure vehicles and routes.
I think you can following method in TraCICommandInterface.h.
bool addVehicle(std::string vehicleId, std::string vehicleTypeId, std::string routeId, simtime_t emitTime_st = -DEPART_NOW, double emitPosition = -DEPART_POS_BASE, double emitSpeed = -DEPART_SPEED_MAX, int8_t emitLane = -DEPART_LANE_BEST_FREE);
I generated plenty of routes (~90.000+) using SUMO's ACTIVITYGEN/DUAROUTER with a configuration file and different durations (--duration-d 1, --duration-d 7, ...).
The resulting .rou.xml is successfully executed by SUMO without serious errors. Just some warnings about invalid departPos.
But when using Veins, I receive the following error message:
<!> Error in module (Veins::TraCIScenarioManagerLaunchd)
Scenario.manager (id=6) at event #2327172, t=25619.2: Model error:
ASSERT: condition count == drivingVehicleCount false in function
processVehicleSubscription,
veins/modules/mobility/traci/TraCIScenarioManager.cc line 640.
I removed the ASSERT condition and displayed both values. count is always higher than drivingVehicleCount.
The included "veins" example is running without any problems.
I am using:
SUMO 0.22.0
OMNeT++ 4.6
Veins 4 alpha 2.
In addition, I tested Veins 3.0 and receive the same error message.
Did somebody encounter the same problem?
Commenting out the ASSERT is totally fine.
In SUMO any vehicle can have one of five states (according to statesvehicleStates_sm.uxf): first, it is loaded, transitions to running when it starts driving, then transitions to arrived when it arrived at its destination. In addition, running vehicles can temporarily become teleporting or parking.
Veins subscribes to these state changes to keep track of the number of driving vehicles. To make sure that the bookkeeping is correct, it compares its own count against SUMO's reported number of active vehicles.
I do not know why the numbers do not match sometimes. It only seems to occur in large congested networks.