Reputation: 11
I drew a road network, which needs to dynamically change the capacity of a road in the process of model operation. For example, the capacity of a road in the first minute is 1000 v/h, and that in the second minute is 500 v/h.
Upvotes: 1
Views: 261
Reputation: 9421
This solution doesn't use stop lines and can make the accident occur anywhere you want at random moments.
First in the source I am adding the car population to the cars population (remember to make your population to start EMPTY... the default is 100, you have to change the default):
You have a normal carMoveTo and with an event, or a button or whatever you want, you can define the accident by changing the speed of the car to zero... So in the event after 15 seconds, I created the accident like this:
Car car=cars.random(); //I choose a random car to be accidented
car.setPreferredSpeed(0,KPH); //speed to 0 kph making it stop
create_MyDynamicEvent(30,SECOND,car); //this will fix the accident in 30 seconds
The dynamic event has the following code:
Upvotes: 4
Reputation: 972
You could model the situation like this:
Creating a car in a separate Source and process flow (the lower one), where the target of the carMoveTo block is not the real target, but rather the position where it will "break down", here at the marked stopLine, where you can see the stopped red car. Other cars will now automatically go around the obstacle, some will have to move lane. This will implicitly decrease your throughput.
In this example, the breakDown (delay) block defines how long the car is broken/blocking the road, afterwards it is again released and will leave the road like all others.
Upvotes: 1