question

Cat avatar image
0 Likes"
Cat asked Cat commented

How to control output port with message?

Hi,


I set send message form PM1 to PM3 processor.

I want to set when PM3 get message close output port1.

It means item will go to PM3-1 processor, not to layout-control queue.

How can I set code in PM3 to choose output port1 or port2 ?

Please help. Thanks.


1679971245823.png


FlexSim 7.5.4
message triggercloseoutputport#sendtoport
1679971245823.png (63.4 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

·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Cat commented

You cannot close an output port number!
There exists a command, BUT it is not allowed to use it for this purpose.

You may consider other solutions.

A. You can add queues as interfaces between PM_3 and PM_3_1 and Layout_Control. Each Queue has got a capacity of one. These additional queues can set to close there input, which resolves in, that PM_3 is sending no more products to them.

B. You can adjust a source source code in Send To function of PM_3. If you open the source code editor of this function in processor, then you find in it for the picklist option “first available“ a code line

return 0;

You can rework it so, that this return command evaluates a label at your processor. This label can you set to different values which explicitly change the output port behavior.

  • Value of 1 sends items to Output Port 1
  • Value of 2 sends items to Output Port 2
  • Value of 0 sends items to first available Ports.

You add a number label at your processor. You call it as you like, for example “rule”. You set label by picklist option or by command in a function of your Processor.

setlablenum(current,”rule”,2);

The return line looks like

return getlabelnum(current,”rule”);
· 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.

Cat avatar image Cat commented ·
Thanks a lot! I'll try it.
0 Likes 0 ·

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.