Setting up an AnyLogic state chart to add 1 at a given rate

70 views Asked by At

I have a system dynamics calculation which is currently working extremely well using a single parameter value however I would like it to source from a database. Using this AnyLogic help I have set up the parameter to source from the database.

However in order to set up the "Choice condition" to cycle through the values in the table, I would like to set up a event or something to define which row should be used.

I assume I will need to set up a state chart with an event maybe to go from 1 to a defined number, by adding 1 at a given rate.

Any help would be appreciated, Thank you

1

There are 1 answers

0
Artem P. On

To clarify, Choice condition in this case refers to the database query. In the example, Choice condition refers to the name property of an incoming agent object, however it can be any variable in the model. Let's say there are three record in the database with record ids set to 1,2,3. Cycling through them can be done using the following approach:

  1. create an integer property called 'currentChoice'
  2. have a state chart that changes that property periodically (assuming it is time-based)
  3. check the current value of the 'currentChoice' property in the database Choice condition

This suggestion is based on the info provided, of course, if a bit more information about the purpose of this model is shared then maybe a better approach can be devised.