Model start time imported from database

Nasr Cheaib :

I have an excel sheet that import data into my anylogic model database. Is there any way to have the simulation start time to be coded to look at what day/time is in the database to start the simulation. enter image description here

Florian :

From the internal AnyLogic database you can just retrieve it during initial experiment setup and use it to modify the model start date with the following code:

getExperiment().getEngine().setStartDate(selectFrom(mytable).firstResult(mytable.mycolumn));

Code to retrieve date valuie from internal DB

Here is an example of the date value stored in the internal database, that fits to the code above:

Database table that contains date value

The only thing to look out for might be the order of initialization. It might be that the query for the date form the internal database happens before the internal database is automatically updated from the Excel file. In this case you should directly query from the Excel file, not from the internal database.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=398022&siteId=1