Set different label value to patients by percentage in proximity system.

Set different label value to patients by percentage in proximity system.

pdh1025102t
Not applicable
13 Views
4 Replies
Message 1 of 5

Set different label value to patients by percentage in proximity system.

pdh1025102t
Not applicable

[ FlexSim 22.2.2 ]

Hi.


According to patient's label, I want to set different label value to patients by percentage.


Specifically, Floor spot1 give 'get' label's value - 0 or 1' to patient using set label function of proximity system.

Patients who have 'type a' label have 70% to acquire 'get' label's value - 0 and 30% to acquire value - 1 by Floor spot1.

Patients who have 'type b' label is the opposite.


I tried to solve this problem in patient flow but I couldn't find the way.

So I think I should to use code in set label page of proximity system.

Could you help me to solve this problem?


Thank you.

Q_set different label value by percentage.fsm

0 Likes
Accepted solutions (1)
14 Views
4 Replies
Replies (4)
Message 2 of 5

moehlmann_fe
Observer
Observer
Accepted solution

You could probably also solve this with a Decide activity in the patient flow, but using the proximity trigger is likely quicker.

Check which of the two "type" values are present on the patient, then use the "bernoulli" distribution to assign one of two values by percentage.

Object patient = agent.object;
if(patient.type == "a")
{
    patient.get = bernoulli(70, 0, 1, getstream(patient));
}
if(patient.type == "b")
{
    patient.get = bernoulli(70, 1, 0, getstream(patient));
}

1665729957907.png

Message 3 of 5

pdh1025102t
Not applicable

Thank you for your replying!

I add code snippet in proximity trigger and it seems to be working properly.

Doesn't it matter to enter any value to 'tag value'?

q-code-snippet.png

Q_set different label value by percentage1.fsm

0 Likes
Message 4 of 5

moehlmann_fe
Observer
Observer
I'm not sure what you mean by "tag value". The default code of the "Set Label" option uses different, older syntax when creating/setting the label.

patient.get = ... essentially does the same as patient.labels.assert("get").value = ...

The default code first assigns the object, label name and value to distinct variables in order to enable entering those in the option's GUI.

At this point you can actually delete the "Set Label" option from the trigger. The code snippet alone is enough to create and set the label.
0 Likes
Message 5 of 5

pdh1025102t
Not applicable

Ahhhh, Ok!

Thank you so much!

0 Likes