question

eric avatar image
0 Likes"
eric asked eric commented

Use Custom Code to modify Max Content

maxcontent.fsm

Hi,

Please check the attached file.

My model uses Custom Code in PF to change the Max Content of the machine. The model can still run after the Max Content is reduced, but after the Max Content is increased, the model cannot allow items to continue flowing in and will stop running.

How should I modify it?

FlexSim 23.0.14
customcode
maxcontent.fsm (30.2 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

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered eric commented

My assumption on why this is happening is that the processor will only receive a new item when another exits when the current content is equal to the maximum content. If the current content is less, the input should already be open and so the processor should normally not receive another item (since it would then have two pending inputs).

To 'jumpstart' the processor again, call receiveitem() on it, when increasing the max content past its current content if the processor's input is currently closed.

Object processor = Model.find("Processor1");
int newMaxValue = 10; processor.setProperty("MaxContent", newMaxValue); if(!ipopen(processor, 1) && processor.subnodes.length < newMaxValue) {     receiveitem(processor, 1); }
· 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.

eric avatar image eric commented ·

Thank you for your help

0 Likes 0 ·