0
votes

I am trying to simulate a customer by using agents. In the statechart I built, I would like to apply to each individual agent the waiting time spent in the system by defining different variables:

WatingTimeStart, WaitingTimeEnd and WaitingTime

In order to assign the waiting time to each agent I am using the following command in the transition prior to the state I would like to apply the condition:

this.WaitingTimeStart=time();

In the next State I am then using the following:

this.WaitingTimeEnd=time();
this.WaitingTime=this.WaitingTimeEnd-this.WaitingTimeStart;

Followed by the next transition with the condition (TolerarableWaitingTime is a pre-defined Variable)

this.WaitingTime>TolerarableWaitingTime;

My Problem is the transition does not accept the condition and is not processing the agents to the next state.

I probably make a mistake in:

  • assinging the variable WaitingTime to each agent
  • applying the condition correcly

Thanks a lot for any thoughts.

Bastian

1

1 Answers

0
votes

It was difficult to understand your question, but here it goes: first, you don't need to use "this", you can just do in the transition previous to the state in question:

WaitingTimeStart=time();

also by convention your variables should start with a low case letter, so it should be waitingTimeStart.

But you don't really even need that code and you are overcomplicating yourself... if you want to apply a waiting time (or a delay) you don't need a conditional transition, you can just use a timeout transition instead, where the timeout time is equal to TolerarableWaitingTime

statechart timeout transition