How can I estimate the duration an agent stays in a specific state in a state chart? I want to count the number of times an agent enters a state and the duration before the transition us triggered to the other state
Asked
Active
Viewed 28 times
1 Answers
0
Easiest way:
- create a variable
timerState
of type double. - On entry of the state:
timerState=time();
- On Exit of the state:
double timeInState = time()-timerState;
Then do what you want with that timeInState
value.
Be VERY careful with this, though. You should not use the timerState
variable for anything else.

Benjamin
- 10,603
- 3
- 16
- 28