question

CHRISTIAN B3 avatar image
0 Likes"
CHRISTIAN B3 asked CHRISTIAN B3 commented

Procrastinate Object Stop in TimeTable / Down Function / Stop Object

I need to improve the Stop Object Down Function script code of a TimeTable, so that the stop of a conveyor is procrastinated until the conveyor gets empty.


At first I thought about a waituntil function I would use in plantsim in such a case, but I could not find a similar function in Flexscript.

So the next idea is to use a while loop, so that the script stays blocked until the conveyor is empty. But I do not know which piece of code to place inside the while, withou causing splash.

Obs: all objects linked to the timetable are conveyors


1712162963371.png

Or any other way ? Is there any way to make the code wait some seconds before reassessing the condition ? In PlantSim there is the wait(60) to wait 60 seconds, any similar code in Flexscript ?


Thank you !

FlexSim 22.0.16
timetablesdown behaviorstop object
1712162963371.png (38.3 KiB)
· 2
5 |100000

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

Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered CHRISTIAN B3 commented

The ability to suspend code execution for a predefined time or until a certain happens has been added to FlexSim in version 22.1. Though most of the time there is a more efficient solution than to periodically check for a condition.

https://docs.flexsim.com/en/22.1/Reference/CodingInFlexSim/WritingLogic/WritingLogic.html#coroutines

One such option would be to use a Process Flow as @Gustavo Teodoro suggested, but in conjunction with the time table by creating a token in the down function code. In the attached model I use a subflow, as this allows to use the conveyor as the instance object which saves having to set a label on the token. But that's honestly a very small detail, so a general Process Flow could work just as well.

conveyor-stop-empty-fm.fsm


· 2
5 |100000

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

Gustavo Teodoro avatar image
0 Likes"
Gustavo Teodoro answered Jeanette F converted comment to answer

Another option to perform the stop is through the flow process. In the attached model, there is a conveyor stop flow. There is a delay representing the Time Between Failures (TBF) which will be drawn at each round. Then, there is a conveyor check to see if there are items still being transported. If there are, the conveyor entrance is closed, and it is necessary to wait for the items to exit (Wait for Event). With each item exiting, it is checked again if there are items on the conveyor. When the conveyor is completely emptied, the Time To Repair (TTR) is applied, and after that, the conveyor can receive items again, and the entrance door is released. The attached model follows below.
FX_STOPOBJECT.fsm


fx-stopobject.fsm (45.3 KiB)
· 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.

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Joerg Vogel commented

close any input to your conveyor. If last item has left your conveyor, you can call a stop on your conveyor and you open the inputs again.

· 2
5 |100000

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