I' m making a passenger transportation model and I'm looking for a way to find the relation between the travelling distance and time (waiting time + travelling time) for the passengers. The distance is initially set on 20 km, but I want to vary the distance from 20 to 40 km. Is this possible to run 1 simulation for the different values using the scenario wizard? As a result I would like to have the time it takes for each passenger to be transported for each distance.
The model is attached below.
Thanks in advance,
- Transportation model.mod
- (23.54 KiB) Downloaded 9 times
See attached model where I introduced some techniques that might help you to achieve what you want.
1. Use of tables to store settings in a central location. I added a table named ModelSettings. This table contains the distance to be used. In your servers car1,2,3 you will find a reference to cell 1,1 in this table. So the distance is now saved in a central location and can be changed on start of a run.
2. The basic version of what you asked for would be: change the value in the table (increase distance), start a new run in the experiment wizard and analyze the results. However in that way you have a new experiment for each distance increase. This is what I automated with some scripting. The idea of it is:
- We have 125 runs.
- Each 25 runs the distance is increased with 5 km.
- At the end of each run write the waiting time in the queue to another table called ResultsWaitingTime.
- At the end of the experiment I have a table filled with the avg stay per run where each column refers to a distance and each row to a separate run.
3. Please look up the following locations to find the scripts that I used to achieve this:
- In the experiment wizard you will find code in the OnStartOfRun trigger. This code: (1) resets the distance to 20km and empties the table on start of run nr. 1. and (2) for each 25th run increases the distance with 5km.
- I added an atom called UserEvents (from library category Time) in the model. This is with it's first input channel connected to the queue. This atom can be used to create events independently from the flow in your model. When you select the first line and click edit, you'll get 2 tabs. In the 2nd tab "event" you will find the script that writes the AvgStay in the queue to the resultstable. In the first tab you'll find the setting that makes the event to be executed at the end of each run.
You can now run an experiment and when it is finished open up the table "ResultsWaitingTime" to look op the avg waiting times for each individual run.
4. NB I see that you are using the Normal distribution. Please note that the normal distribution can result in negative values, which will create errors in your model (or at least warnings in the tracer). Events cannot be negative as in 'back in time'. So, whenever you use the normal distribution for actvity times it is best to prevent the negatives with a Max( 0, Normal ( ...) ).
Hope this helps!
Kind Regards, Marlies