question

Mohamed A17 avatar image
0 Likes"
Mohamed A17 asked Phil BoBo edited

How to select output port of fluid processor?

* THIS QUESTION IS UPDATED.

Hi,

I have a question on how to select the output port of a fluid processor. In the attached model, Each batch is processed on tank "FluidTank1". After the batch completion, the fluid is sent to a line from "FluidToItem1" or "FluidToItem2" which are pulled from "List: Lines". I inserted a fluid processor "FluidProcessor1" between the tank and the lines to control which line will be used.

My question is how to select the output port of FluidProcessor1 to match the required line (e.g. How to select output port 1 of "FluidProcessor1" if "FluidToItem1" is pulled). I wrote a custom code but it didn't work.

Best regards,
Mohamed

QF.fsm

FlexSim 22.0.1
custom codeoutput portfluid generator
qf.fsm (42.9 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.

1 Answer

·
Phil BoBo avatar image
0 Likes"
Phil BoBo answered Phil BoBo edited

Add a number label to your FluidProcessor for which port to send to. Return that label in the Destination Port field. Set that label at the appropriate time in your Process Flow logic:

1655299717984.png

You can use the ipopno() command to get the output port number associated with a certain input port of an object. That way, you can get the output port number of the FluidProcessor based on the downstream FluidToItem object:

ipopno(token.pullLine, 1)

qf_1.fsm


1655299717984.png (423.6 KiB)
qf-1.fsm (125.8 KiB)
· 2
5 |100000

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

Mohamed A17 avatar image Mohamed A17 commented ·

Hi,


Thank you Phil for your help. Really appreciated. Your solution is working great but when I implemented it in my FlexSim file, I got the following exception:
"time: 3.000000 exception: FlexScript exception: Label property Port retrieved on /FluidProcessor1. Label does not exist. at MODEL:/FluidProcessor1>variables/destinationportnumber".


Could you please help me how to get rid of that error for the attached qf-2.fsm. Also, I would like to ask how to apply your solution if there is more than one FluidTank and FluidProcessor as seen in the attached case "qf-3.fsm".


Best regards,

Mohamed

qf-3.fsm

qf-2.fsm

0 Likes 0 ·
qf-2.fsm (43.1 KiB)
qf-3.fsm (64.8 KiB)
Phil BoBo avatar image Phil BoBo ♦♦ Mohamed A17 commented ·

Add a Port label to your FluidProcessor object:

1655480148674.png

If you have a complex structure of objects and ports, then change your process flow logic to send to a port based on the object. Adjust your ports so that port 1 of each FluidProcessor goes to one object and port 2 goes to the other, and then set the label to 1 if you want it to go to the first object and 2 if you want it to go to the other:

1655480160046.png

1655480169466.png

0 Likes 0 ·
1655480148674.png (213.1 KiB)
1655480160046.png (331.8 KiB)
1655480169466.png (173.0 KiB)

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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