question

Nicolas M6 avatar image
0 Likes"
Nicolas M6 asked Nicolas M6 commented

How to set the people state in a custom code?

How to set the people state in a custom code the same way we set the default state profile?

In the model attached, for exemple, the activity "time in State_X" is a certain activity like wait in a pull from list.

In the graph below, I would like to see
- idle =3s
- State_X = 4s
- InTransit...
- State_Y = 5s

Thanks in advance

20200318-set-peoplestate.fsm

FlexSim 20.0.3
statespeople flow
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered Nicolas M6 commented

Use a code snippet like this:

  1. Object person = token.Person;
  2. person.stats.state("HC States").valueString = "State_X";

setpeoplestate.fsm


setpeoplestate.fsm (61.3 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered Nicolas M6 commented

You can use

  1. token.Person.as(Object).stats.state("HC States").value = "State_X";

in your custom code.

Note that the people activities put the person in their previous state when they finish. In this case, that means that instead of going back to idle, they will go back to State_X.

· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.