question

Joe L6 avatar image
0 Likes"
Joe L6 asked Joe L6 commented

CenterPort choosing problem

Hi team,

I have a question about CenterPort choosing. In my previous question(the link is as below), the operators in my model have a shift schedule. And I use 'Shift' globaltable and timetable to make it work.

https://answers.flexsim.com/questions/131586/operator-dayoff-setting.html?childToView=131579#answer-131579

Now I want my operators have different ability(operators only process the specific machine). To do this, I give every operators one Dispatcher, and connect the specific machine with the Dispatcher that the operators can process.

My problem is if there is a machine that 2 operators can process it, but we need to consider the shift schedule first. In the end there are only the operator that the shift schedule says will process the machine, other operators will go to 'Dayoff' item.

To simulate the above situation, I make a simple model. The only work that the operators can do is carry the item. I just want to know how to make the queue or machine choose between different centerport.

I try to write the code in the 'Use Transport' of Queue 1 and Queue 2. But it seems like I only can control Operator1.

queue-code.png

op2-cant-control.png

How can I make the Queue and Processor choose the correct operator? Can I do it with writing code? Or the 'List' function can do it? Thanks for your reading and helping!

CenterPort_Choosing_Problem.fsm

FlexSim 18.1.2
pickoperatorcenterportusetransport
5 |100000

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

Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Joe L6 commented

In your if-conditions (line 27 and 43) your are using the assignment operator "=" instead of the equals comparison "==". This means two things: The expression "result = 1" will always evaluate as true and the result variable is overwritten with the value 1. As such, the first centerport connection is always chosen.

As a side note, if the table value for operator 2 is 0 at the given time, your code would try to return the 0th center object, which would throw an error.

· 10
5 |100000

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

Joe L6 avatar image Joe L6 commented ·

Thank you @Felix Möhlmann , I fix my code and the queue can choose the correct centerport according to the 'Shift' globaltable now.

fixed-code.png

Now I have another problem that when the time goes to the night shift, Operator1 will go to 'Dayoff' object as setting in the Timetable. But Operator2 won't leave the 'Dayoff' object and do the work.

shift.png

It seems like the 'Use Transport' logic in the Flow didn't renew with the time. How can I make the Queue and Processor keep renew every 12 hours? Thanks!

And I upload my new model as follows, Thanks!

centerport-choosing-problem-v2.fsm

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Joe L6 commented ·

The code is run every time an item needs to be moved, there is no need to "renew"/"update" anything. But the condition in line 21 to determine if the day shift or night shift is active doesn't work like that. (Missed this on my first look at the model)

First, multiple comparisons in a line like that will evaluate in order from left to right, with the result of the previous being used for the next. For example, if hour is 12:

"7 < 12 < 19" -> "(7 < 12) < 19" -> "(1 (true)) < 19" -> "1 (true)"

You have to combine multiple conditions with logical operators (&& for AND and || for OR)

Also, since after 7AM the day shift should be active, the condition should check if hour is larger or equal to 7.

1669196362749.png

1 Like 1 ·
1669196362749.png (1.9 KiB)
Joe L6 avatar image Joe L6 Felix Möhlmann commented ·

Thank you @Felix Möhlmann for the explain. I fixed my code and the model works as I expected now. If I have another problem I'll come back here and ask. Thanks!

0 Likes 0 ·
Show more comments
Lucas Antonio Risso avatar image
1 Like"
Lucas Antonio Risso answered Joe L6 edited

Have you considered using the option "center port by case"?

· 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.

Joe L6 avatar image Joe L6 commented ·

Hi @Lucas Antonio Risso,

I solved my first problem and I think the 'center port by case' can solved it too.

Now I have another problem that I expect the Queue or Processor recheck the 'use transport' or 'pick operator' logic every 12 hours.

Is it possible to make it happen in the 'center port by case' option? Thanks!

PS: Here's my new model, it only works for the first 12 hours. Thanks!

centerport-choosing-problem-v2.fsm

0 Likes 0 ·