Branch boxes

49 views
Skip to first unread message

Florentine van Bouwdijk

unread,
May 31, 2022, 2:41:41 PM5/31/22
to Jaamsim Users Discussion Group
Hi,

I want to branch boxes based on the attributes from the entities within the box. Is this possible? Because I couldn't find a way to do this, as the entity attributes are not showed in the output viewer of the box.
Thanks in advance!

Best regards,
Florentine

Florentine van Bouwdijk

unread,
May 31, 2022, 2:46:49 PM5/31/22
to Jaamsim Users Discussion Group
with the output viewer of the box I mean the container output

Op dinsdag 31 mei 2022 om 20:41:41 UTC+2 schreef Florentine van Bouwdijk:

Harry King

unread,
May 31, 2022, 6:32:25 PM5/31/22
to Jaamsim Users Discussion Group
Florentine,

Use the 'EntityList' output for the EntityContainer to access the entities inside the container. For example, if the entities have an attribute 'attribA', then the following expression would return this attribute's value for the first entity in the EntityContainer:

'[EntityContainer1].EntityList(1).attribA'

You may need to ensure that the container has at least one entity. For example, the following expression returns -1 if the container is empty:

'list = [EntityContainer1].EntityList; size(list) == 0 ? -1 : list(1).attribA'

Note that a local variable 'list' is used to simplify the expression.

Harry

Florentine van Bouwdijk

unread,
Jun 1, 2022, 3:30:57 AM6/1/22
to Jaamsim Users Discussion Group
Hi Harry,
Thank you for your answer. But now I have the following input error: 
error.PNG
I gave every entity an attribute which is called "Country". What is the problem here?

Op woensdag 1 juni 2022 om 00:32:25 UTC+2 schreef d.harr...@gmail.com:

Harry King

unread,
Jun 1, 2022, 9:19:14 AM6/1/22
to Jaamsim Users Discussion Group
Florentine,

[Worker].EntityList returns the list of entities in the container. The first entity in the container is [Worker].EntityList(1). Your expression should be:

'[Worker].EntityList(1).Country == "Italy"?1:2'

Harry

Reply all
Reply to author
Forward
0 new messages