Home > Enterprise >  Setting toDate function as arrival time Anylogic
Setting toDate function as arrival time Anylogic

Time:12-08

I'm already struggling for days to use dates from excel in a proper way in anylogic.. I've created a database in where the date is formulated as integers in different columns since otherwise excel is messing up the dates (for example year=2021 , month=12 day=5 hour=6 minute=44 second=0 stands for 2021/12/5 6:44:00)

Now I know this can be converted to a date by the function toDate(year, month, day, hour, minutes seconds). But how can I use this integers to create agent with specific parameters from the database in a source and add to a custom population?

The most simple way is to add a column where the function toDate(......) is added in the database but I do not know how to do this (see picture if it is unclear). Or are there other solutions?

Possible solution

CodePudding user response:

One way: use Dynamic Events.

Create one and in the action code, write mySource.inject(1)

In Main, on startup, load all dbase rows and create a DE for each row, below assuming it is only with an hour-column: enter image description here (Use the database query wizard to adjust your query).

In your source object, set it to "call of inject() function"

This will work, but it is quite cumbersome, as you can see. Much easier if you get your Excel right and just import the date column clean and well so you can use the Source option "arrival table in database" directly. I know you need regular arrivals, so maybe code that up in Excel to give you these on specific dates...

  • Related