I wanted to a have a different rate for my model for each day. For this I have created a table which I provided in the transition. I am trying to access the rate based on the model date with the date() function. The model works for a short time (8 hours in model time) but then crashes with the error:
Exception during discrete event execution:
root.houses[1423]:
Empty database value result!
java.lang.RuntimeException: root.houses[1423]:
Empty database value result!
at com.anylogic.engine.Engine.error(Unknown Source)
at com.anylogic.engine.Agent.error(Unknown Source)
at com.anylogic.engine.Utilities.error(Unknown Source)
at com.anylogic.engine.Utilities.getResult(Unknown Source)
at com.anylogic.engine.Utilities.selectUniqueValue(Unknown Source)
at com.anylogic.engine.Utilities.selectUniqueValue(Unknown Source)
at adr01.House.evaluateRateOf(House.java:285)
at com.anylogic.engine.TransitionRate.start(Unknown Source)
at adr01.House.enterState(House.java:204)
at adr01.House.executeActionOf(House.java:318)
at com.anylogic.engine.TransitionMessage.execute(Unknown Source)
at com.anylogic.engine.Engine.a(Unknown Source)
at com.anylogic.engine.Engine.ln(Unknown Source)
at com.anylogic.engine.Engine$m.run(Unknown Source)
I disabled the table with a fixed rate and the model was running fine. So I'm pretty sure it is the database reference.
This setup cannot work. The date()
function returns the current model date (read the help on it) which is evaluated only once at the model start when the transition is created.
What you should do instead:
currentRate