question

Varun Rawal avatar image
1 Like"
Varun Rawal asked Varun Rawal commented

Photo eye usage for conditional port

Please find the attached model. I have inserted PE1 which I want to use to change the gate positions. The logic I want it when PE1 is blocked the Gate 1 should use the second port to send the products through. I was abot to write a process flow. But cannot figure out how to close just one port and open the other. Any one knowing a way how to achieve it?

Thanks in anticipconceptpn.fsmation.

FlexSim 18.1.1
separatorphotoeyeconditional port
conceptpn.fsm (8.9 MiB)
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

Logan Gold avatar image
3 Likes"
Logan Gold answered

There's no way to just close one output port (or one input port) on a Fixed Resource like a Processor. You have to close all the output ports or have them all open. However, you can close the input port(s) on one of the downstream objects (the Entry Transfer objects in the case) to prevent flowitems from travelling from the Processor to that object.

If you were to do this with the Custom Code activity you already have in your Process Flow, you just need to change the Action to closeinput and set the Object to:

model().find("Gate 1").as(Object).outObjects[1]

You'll need to make a change to the Send To Port logic on Gate 1 to something like First Available to make this work.

Another solution would be to set up a label on Gate 1 to determine which port flowitems should be sent. Then set up the Send To Port logic to By Expression and use the label for the expression.

If you were to set up a label named OutputPort on Gate 1 and set the initial value to 1 (and probably use the Automatically Reset Labels option), then the expression in the Send To Port would be:

current.OutputPort

Then it's just a matter of using the Process Flow to change the label to whatever port you want to use for each situation. After the Wait For Event activity that waits for PE1 to block, you can use a Custom Code activity to use Set Label and change the OutputPort label on Gate 1 to a 2. Then you could add another Wait For Event activity that waits until PE1 is clear and use another Custom Code activity to change the label back to a 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.