question

Josiah S2 avatar image
0 Likes"
Josiah S2 asked Felix Möhlmann answered

Code Snip for process time value by case

I would like a code snip that sets the processor "back to" value by case which reads a label for process time. I am using "Model.find("Processor1>variables/cycletime").value = 45;"

but I would like to change it once the process is done back to reading labels for the value

FlexSim 22.1.3
processflowprocesstimeusing code
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

I would suggest to have both options in the process time at the same time and switch between them with an if-condition that checks some variable, such as a label.

Since 'Values by Case' is more complex, it would be best to first set that up. Then open the code editor of the process time and add the fixed value under some condition.

1657779622506.png

Here line 1-4 and 7-17 were already present from setting the 'Values by Case' option. Line 5 checks if the label 'useFixedTime' on the object is smaller than 0. If so, the 'Values by Case' code is used. Otherwise the value of the label is returned as process time.

This way, you can switch between the behaviours by setting the label to either the wanted process time or a negative number.


1657779622506.png (43.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.