Reputation: 1
I have data in an Excel spreadsheet that represents the number of vehicles that pass through a traffic light at each hour of the day, over several days. The 24 columns represent the hours of the day and each row represents a different day.
I would like each CarSource block that I implement in the simulation to capture the number of vehicles present in the table and assign it to the Arrival Time property, automatically, from 00:00 to 23:00.
For each hour elapsed in the simulation, the Arrival Time property must be updated with the information related to the next hour, obtained from the spreadsheet.
Would anyone have any suggestions on how to do this, using AnyLogic (version 8.4.0)?
Upvotes: 0
Views: 72
Reputation: 9431
so the arrival time property doesn't exist... I assume you mean arrival table, but that won't work in your case because you don't have exact arrival times.
So you will need to use a different strategy, which is to use an event triggered by rate (let's call it rateEvent) in which you will use carSource.inject();
and change that rate according to your database value at the time.
you will need another event that runs once per hour and reads the database to know what rate to use during that hour... in the event you will need to do rateEvent.restart();
in order to reevaluate the rate.
To read the correct data, you will need to figure it out, since you can read directly from excel or use the excel as a database... But what you can use easily is:
excel.getCellNumericValue
check the anylogic help documentation for that
Upvotes: 0