I am using OMNeT++ 5.5.1, veins 5.0 and SUMO 1.7.0 to simulate a highway having six lanes in total (3 lanes in each direction). I am simulating the network with different number of vehicles (e.g., 50, 100, 150, 200) that I am generating from SUMO.
The simulation runs fine when number of vehicles are 50 and 100. However, when I set the number of vehicles to 150, I get an error: "Cannot open output scalar file ...
" (as attached in the screenshot below).
The error occurs when a vehicle (node[84]
) leaves the network.
On debugging, I found that this error is causing in callFinish()
method of cModule.cc
:
https://github.com/omnetpp/omnetpp/blob/omnetpp-5.x/src/sim/cmodule.cc#L1428
and it throws an exception that is caught here: https://github.com/omnetpp/omnetpp/blob/omnetpp-5.x/src/sim/cmodule.cc#L1443
Can anyone suggest how to correct it? Many thanks.
Best Regards,
Yasir Saleem
Thanks to @ChristophSommer for pointing out the attention towards memory corruption. It helped me to solve the issue.
Cause of Problem: For logging statistics, I was creating a csv file (ofstream) and I realized that the csv was opening by all the vehicles and RSUs (instead of one node) while was closing ofstream by only one node (RSU). This was causing the problem.
Solution: I fixed by making the ofstream variable global and opening and closing the ofstream file it by only one node (RSU).