Dmitry Borodaenko
Dmitry Borodaenko

Reputation: 11

Is there a way to trigger event in Anylogic by timestamps from database

To put it simple, I need my Delay block to release agents according to the timestamps from the DB. The same logic is aplied when agents are generated by Source blocks based on the Arrival Time (from DB)

Delay block seems to be unable to use absolute time from DB, it uses only Delay Time(period).

So, another option is to use StopDelay function, but to activate it I need to connect my DB to an event which would call for it. But Event doesn't seem to have any simple ( similar to Source block) ways to be triggered by the timestamps from DB. Could you please share your ideas about the ways to solve this problem?

Upvotes: 0

Views: 392

Answers (1)

Benjamin
Benjamin

Reputation: 12640

Use the "Dynamic Event" element (not the "Event").

At the start of your model, loop through all dbase entries and for each row, create a dynamic event like create_MyDynamicEvent(XXX) where XXX is the arrival time from your dbase (assuming it is the absolute duration relative to the model start)

In the Dynamic Event action code, simply call myDelay.stopDelay() to free all agents at that point

Upvotes: 1

Related Questions