question

JIANYUAN, HALLEY L avatar image
0 Likes"
JIANYUAN, HALLEY L asked JIANYUAN, HALLEY L commented

Why doesn't the port open/closed as specified in the code?

Hello all,

I'm trying to open/close port when the value recorded in the global table exceeds a certain amount but even though there is no error message when running, the port doesn't seem to open/close.

In the model below, both processor 1 and 2 adds a number to Table("GlobalTable1")[1][1] when there's an item being processed. If the number hits 5, the input port should close and only opens when the number drops below 5.

However when running, I've observed that Table("GlobalTable1")[1][1] goes up to 20 when it should not be able to go above 5. I suspect it has to do with the maximum content of both processor being 10 and therefore adds up to 20 but since the input port should be closed I'm not sure how items are still being sent.

Thanks for taking your time to read!

test-9.fsm

global tableitem flowports controlobject referencing
test-9.fsm (29.7 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 JIANYUAN, HALLEY L commented

Your code is trying to close and open the input of the global table.

If you want to close the input of the processor, then you need to specify the processor as the involved object.


involved.png (83.7 KiB)
· 5
5 |100000

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