question

anon-user avatar image
0 Likes"
anon-user asked Matthew Gillespie answered

"port by case" operation does not fit on the screen

What if the "port by case" operation does not fit on the screen?

Is there any way to operate it?

FlexSim 19.0.8
port by casescreen
5 |100000

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

1 Answer

Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered

If you have that many cases I would recommend using a different method. Here are some options:

Use a Table

You could create a table with one row per type and the port to be used by that type. Then you would just look up the value from the table like this:

Table("Ports")[item.Type][1]

Write some if statements

Open the code editor and use if statements to return the right port value.

if (item.Type <= 10)
	return 1;
else if(item.Type > 10 && item.Type <= 20)
	return 2;
else
	return 3;

Use a mathematical function

It's possible the port number can be derived from the item's Type using a mathematical function. For example, if Type 1-10 use port 1, Type 11-20 use 2, and Type 21-30 use 3 you could write this function:

Math.ceil(item.Type / 10)

Here's an example model with 3 routing queues using a different one of the above suggestions.

portsbytable.fsm


portsbytable.fsm (43.3 KiB)
5 |100000

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