I have this code On destroy of my Main:
// Stop the simulation when all the jobs are done
if (jobs.size() == 0) {
makespan = time();
getEngine().finish(); // Pausiere die Simulation
getEngine().getState();
}
Ive got 2 maybe simple Questions:
I use the code getEngine().finish(); but my Simulation don't stop, the time still run. What is
wrong ???
i have this output element, but i don't get the time, even if i stop the Model myself, because the code above don't seems to work:
And a text element to get the time in another spot:
Your model does not finish because you call it in the "on destroy" of Main, which is only called when a model finishes. (It's like wondering why your lights do not turn off but you never toggle the light switch)
You need to call the .finish()
elsewhere from within the model.
PS: Always only ask 1 question on SOF, keeps things simple, see https://benjamin-schumann.com/blog/anylogic-stackoverflow