|
I've spent about 2 days looking for a way to stop a simulation elegantly through a steppable but I've had no luck. Simulator.finish() looks promising but I've only managed to get attr errors and to completely crash python when I'm calling it so I'm either doing it completely wrong, or this is not the function I'm looking for.. |
|
As far as I know it is not something commonly needed. Perhaps you could revise your question or add a comment describing why you would like to do this. If what you are trying to do is just end a simulation after a certain number of Monte Carlo steps that is easily done inside the main Python file using something like this:
One possible way to do what I think you are asking is to use the semaphores that the Player uses to pause or stop a simulation. To do this you would have to pass the simulation thread object to your steppable. In the main Python script there is usually a line similar to:
When you create your steppable create a parameter for the simthread object, something similar to:
Then in the main Python script when you instantiate your steppable you would pass the simthread object to it:
In your steppable when you would like to pause the simulation all you need to do is:
To restart:
To completely stop (end) your simulation:
None of these functions (except of course for the ones setting the number of Monte Carlo steps) were meant to be used this way however, and you will certainly mess up the Player's button control during the course of your simulation. |
|
Hi, Thank you for the answer! What I want is to stop the simulation on conditions other than the mcsteps it is now implemented in the latest built by calling CompuCellSetup.stopSimulation() from within the steppable I assume you mean the latest Windows 3.6.0 build? 3.6.0v2022? If this is the solution you are satisfied with, please accept the answer by clicking the the check mark on the left. Doing this will help guide others trying to solve the same problem. Thank you.
(Oct 24 '11 at 04:29)
acosmane ♦
|
If the answer provided was helpful please vote it up, or if it solved your problem "accept it" (click the check mark), this is probably best done for the answer you provided for yourself. It is important that your question/problem be re-solved, and the answer be marked for easy referral by others.