Multiple conditions in a server

73 views
Skip to first unread message

Timothy Lack

unread,
Dec 20, 2022, 3:52:12 PM12/20/22
to Jaamsim Users Discussion Group
Good evening,

I can't solve a problem I've had for a while.
 
I'd like to make an EntityProcessor change its distribution law depending on which entity it's doing. I have three entities, so three normal laws that I would like to assign.
I tried with the code that you can see below but the time remains the same for the three entities.

If anyone could help me I would be delighted.

Timothy

Capture.PNG

Harry King

unread,
Dec 20, 2022, 6:42:55 PM12/20/22
to JaamSim Users Discussion Group
Timothy,

The problem is that your expression refers to the prototype objects used to generate the entities, instead of the generated entities themselves. It looks like you want the service time distribution to depend on the type of entity. The easiest way to do this is to define an attribute 'type' for each of the three prototype entities (ClientClasse1, ClientClasse2, and ClientClasse3) and set its value to 1, 2, or 3, respectively.

With this change, the correct expression for ServiceTime would be:

'this.obj.type == 1 ? [NormalDistributionCiasseAutoCaddi].Value : this.obj.type == 2 ? [NormalDistributionCiasseAutoPanier].Value : [NormalDistributionCiasseAutoMain].Value'

Note that this.obj returns the entity being processed by the EntityProcessor.

Harry

Colin Sifringer

unread,
Dec 21, 2022, 3:34:39 AM12/21/22
to JaamSim Users Discussion Group
Haha

Timothy Lack

unread,
Dec 21, 2022, 4:20:51 AM12/21/22
to JaamSim Users Discussion Group
thank you very much Harry ! it solved my problem 

Timothy 
Reply all
Reply to author
Forward
0 new messages