brianmc95 / OpenCV2X

OMNeT++ V2X simulation framework for ETSI ITS-G5
GNU General Public License v2.0
37 stars 15 forks source link

Failed to change simulation time #19

Closed anjackq closed 3 years ago

anjackq commented 3 years ago

Hi,

I would like to change the simulation time for my own purpose, however all my attempts failed.

For the default setting of the run_simulte-cars, the simulation starts at 500s and ends at 512s. For example, I would like to start the simulation at 50s and end at 60s, then I wrote the following code to my configuration in omnetpp.init file:

[Config Test]
extends = Base
*.traci.core.startTime = 50s
sim-time-limit = 60s

or I would like to just shrink the simulation time:

[Config Test]
extends = Base
sim-time-limit = 501s

However, the simulation still starts at 500s and ends at 512s. Thus, I cannot controll the simulation time as I wish.

Please help me if you have any idea about this problem, thx.

BR, Anjie

brianmc95 commented 3 years ago

Hi @anjackq,

No worries at all not sure quite why this issue is happening for you what you changed appears right. Though there are 3 variables that control the simulation time each in slightly different ways. So the first sim-time-limit simply controls the simulation end time like you set it there if it's 60s it should end at that time. The other warmup-period controls the time before stat recording occurs so in your case maybe 0s is what you want and have the full 60s. The final one is *.traci.core.startTime this controls the time at which omnet++ will start at in comparison with sumo so if it is 0s then sumo and omnet++ start at the same time with the initial sumo setup. It should be the case that startTime should be the earliest and sim time the latest and put warmup inbetween where you think best for getting the results you want.

sim-time-limit = 512s
warmup-period = 500s
*.traci.core.startTime = 490s

It is hard to know where exactly you are going wrong in your setup I would if I were you remove these 3 variables from the general area to avoid issues where it might be overriding your choice in the config and ensure base isn't somehow doing so either (I think it should work the opposite way in that your change should ensure the time is set by the config test but given it hasn't worked then I'm unsure).

Have a run through what I highlighted above and if it doesn't get it working for you then would you send me your omnetpp.ini file and I will check if there isn't anything obvious that might be causing the issue for you.

Kind Regards, Brian

anjackq commented 3 years ago

Hi @anjackq,

No worries at all not sure quite why this issue is happening for you what you changed appears right. Though there are 3 variables that control the simulation time each in slightly different ways. So the first sim-time-limit simply controls the simulation end time like you set it there if it's 60s it should end at that time. The other warmup-period controls the time before stat recording occurs so in your case maybe 0s is what you want and have the full 60s. The final one is *.traci.core.startTime this controls the time at which omnet++ will start at in comparison with sumo so if it is 0s then sumo and omnet++ start at the same time with the initial sumo setup. It should be the case that startTime should be the earliest and sim time the latest and put warmup inbetween where you think best for getting the results you want.

sim-time-limit = 512s
warmup-period = 500s
*.traci.core.startTime = 490s

It is hard to know where exactly you are going wrong in your setup I would if I were you remove these 3 variables from the general area to avoid issues where it might be overriding your choice in the config and ensure base isn't somehow doing so either (I think it should work the opposite way in that your change should ensure the time is set by the config test but given it hasn't worked then I'm unsure).

Have a run through what I highlighted above and if it doesn't get it working for you then would you send me your omnetpp.ini file and I will check if there isn't anything obvious that might be causing the issue for you.

Kind Regards, Brian

Thanks for your reply! It turns out that all my modification to the ini file is invalid, and the reason is that I'm editing the ini file from the trash, such as a stupid mistake! But, thanks a lot, you are very kind of helping!