0

I'm modeling a customer service office and are building a statechart of satisfied/unsatisfied customers.

How can I measure how long each customer (pedestrian) is in the pedService block?

I want to say that if the customer is waiting in the queue more than 5 minuts they are becoming unsatisfied. I tried to make the condition in the state chart like this:

   main.pedService.delayTime() > 5;
  • duplicate of [How do I measure time elapsed](https://stackoverflow.com/questions/1770010/how-do-i-measure-time-elapsed-in-java) – Nowhere Man Apr 15 '20 at 22:12

1 Answers1

0

You can use the following code in your service (when it begins the service or when it ends the service or exits the blog):

time()-ped.getBlockEnterTime()

This will give you the total time the pedestrian has been in the service block. With that you can use your condition to make the pedestrian satisfied or unsatisfied.

This is one option

The other option is to trigger a user controlled event when the pedestrian enters the block and make the pedestrian unsatisfied if it's activated: - when it enters the block do ped.event.restart(5); - when the agent leaves the block do ped.event.reset(); - in the event make the code necessary to make the pedestrian unsatisfied

The difference is that the second technique will make the customer unsatisfied when it's in the queue, while the first technique will make him unsatisfied only after it leaves the queue

Felipe
  • 8,311
  • 2
  • 15
  • 31
  • Hi @Felipe I inserted the code in "on enter queue" like this: variable = (time() - ped.getBlockEnterTime()); and it's working. Then I inserted the condition main.variable > 5, in transition from satisfied to unsatisfied in the statechart. Later I created a oval on the pedestrian that will turn red if the customer is in the state "frustrated", how do i do that? – visu_hello Apr 16 '20 at 13:46