Hi,
I have a simple question: why does the command "endreplication" not execute the model trigger "OnRunStop"? Is there an error in my code?
I attached picture and model with more details.
Thanks for the support.
Hi,
I have a simple question: why does the command "endreplication" not execute the model trigger "OnRunStop"? Is there an error in my code?
I attached picture and model with more details.
Thanks for the support.
endreplication() doesn't stop the model. It destroys all the pending events. In the Experimenter, when the simulation has no more events to process, the replication ends. In an interactive model session, if you were to generate an event after calling endreplication(), the simulation engine would process it. The model is still running, but it has no events to process.
OnRunStop also fires when you press the Stop button in the middle of running the model. That trigger fires whenever the model is stopped; not just at the end of a replication. You might want to put your code elsewhere, depending on what your code is doing.
If you want to stop the model in addition to ending the replication, call stop() and endreplication().
Whether that's how it should work could be debated, but that's how it does work currently.
6 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved