Time in AnyLogic

This entry is about how I solved a problem in my AnyLogic model with the Time settings. 

A few weeks ago, I went to "Simulation: Main", then clicked the "Presentation" tab, and changed Execution mode to "Virtual time (as fast as possible)".  I did this because I wanted to speed up the execution time of my model because I was in the middle of the testing and development process.  This worked.

However, some weeks later, I needed to change back to "Real time".  When I did that, I wasn't seeing my usual "System.out.println" messages that I print out for myself so I can keep tabs on what's going on in the Console.  What was going on??  Obviously, I had changed something during the time that I had it set to "Virtual time", and I couldn't remember what it was.  I had done way to much work to simply re-load an earlier version of my model.

After a bit of poking around, I figured it out.  After setting the model to "Real time with scale" = 1,  click on the main project title, and under the "General" tab, check the Time units.  I had mine set to "days".  So, naturally, in the few seconds that I was watching my console, obviously days were not passing, so, my code was not executing.   I changed this to "seconds" and that fixed it.

Another setting to watch out for is under "Simulation: Main" (or whatever yours is called), also under the "Presentation" tab, check out your "CPU ration (Presentation: Simulation)".  I had mine at 1:2 but wasn't seeing my Console outputs.  So I changed it to "1:1" and that fixed it.

I just LOVE this stuff.  I like growing in expertise and learning the subtleties of these tools.  I also love sharing what I learn with those who are interested in the same thing.  :) :) :)

*hearts*

No comments:

Post a Comment

Translate