How to control output port with message?

How to control output port with message?

Cat892
Not applicable
62 Views
2 Replies
Message 1 of 3

How to control output port with message?

Cat892
Not applicable

[ FlexSim 7.5.4 ]

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


0 Likes
Accepted solutions (1)
63 Views
2 Replies
Replies (2)
Message 2 of 3

joerg_vogel_HsH
Mentor
Mentor
Accepted solution

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”);
0 Likes
Message 3 of 3

Cat892
Not applicable
Thanks a lot! I'll try it.
0 Likes