nanziguilai
nanziguilai

Reputation: 11

How to dynamically change the road capacity of a road

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

Answers (2)

Felipe
Felipe

Reputation: 9421

This solution doesn't use stop lines and can make the accident occur anywhere you want at random moments. model structure

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): car source

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: enter image description here

Upvotes: 4

Florian
Florian

Reputation: 972

You could model the situation like this:

Process Flows

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

Related Questions