'How can I change delay time by agent's state in Anylogic?

Im new on Anylogic and is building an Student Service simulation, in it I thought a senario that if student coming to service center with simple question, staff can solve that quickly, otherwise it takes staff more time. I use a statechart to implement the question type of student:enter image description here

and I set corrpesond delay time as: enter image description here

Once I try to build, complier give me an error: enter image description here

What does it mean? Can anyone tell me how to solve that?



Solution 1:[1]

you have to use the short version of the if statement which returns a value if(condition) else DOESNT return anything

instead use this:

agent.inState(agent.simpleQuestion) ? triangular(1,2,3) : triangular(3,4,5)

or instead you could do the same but you should create a function and add the function to the time delay

timeDelay(agent)

and in the function you would do

if(agent.inState(agent.simpleQuestion))
return triangular(1,2,3);
else
return triangular(3,4,5);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Felipe