question

Tushar H avatar image
0 Likes"
Tushar H asked Tushar H commented

Coding Error

Hello team,

I am trying to learn coding so i tried one code

1738759705205.png

its working only for first cycle.

I want to do is it will run continuously its means first 5 boxes will come then input port will close for 100 seconds and again open for next 5 boxes but for next cycle its continuously open

please correct me by using coding only

thank you in advance

FlexSim 24.1.0
coding
1738759705205.png (214.5 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 Tushar H commented

You are reading the input statistic of the queue which only ever increases (apart from being reset when a warmup time is set). You need a local counter, for example a label that you can reset back to 0 whenever the output gets closed.

I would also advice against using "await". It won't make a difference in this small example model. But it needs to store any variables from the code in a node so it can later resume the execution and is thus much slower than using messages or delayednodefunction(). With the latter you can call the same code again but pass in an additional parameter that changes what the code does. For starters, I would just use messages though.

1738766939867.png


1738766939867.png (43.6 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.