AnswerHub Upload Issue
Our AnswerHub community currently has a bug that prevents you from attaching your model or other files to your questions. AnswerHub is aware of this issue and they are working on a fix. Until we receive their patch, you can upload your models and other files to FlexSim's file share site. Include the file name in your question so that we know which upload to reference.

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:

Object person = token.Person;
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

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.

Thanks ! Indeed, it's a problem.

I notice another problem: During the animations "installation on the table" or "leaving the examination table" which are due to the activity "walk", the state HC is idle. It is false in my opinion. The patient is handling himself. He's active. This state should be in "InTransit" not idle state.

0 Likes 0 ·

If you're concerned about those state times you can edit the enter/exit instructions of the location to set the person's state during the animations. However, if you use more realistic processing times (like 15 minutes not 4 seconds) and travel distances I think you'll see that the few seconds it takes a person to sit down and stand up will be negligible.

0 Likes 0 ·
Nicolas M6 avatar image Nicolas M6 Matthew Gillespie ♦♦ ·

thanks for your answer. Sure. I clearly agree with you. I was just understanding the mechanism and I did not understand where this idle time came from. Thanks again.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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