WJSchakel / ots-fosim

Extension of OTS which can be used as a simulation core within FOSIM.
0 stars 0 forks source link

Create simulator dedicated to external control #11

Closed WJSchakel closed 7 months ago

WJSchakel commented 7 months ago

OTS is based on an event-based simulation tool named DSOL. Part of this is a simulator, which advances the clock and invokes the various events. The current animator (which is a simulator) is not intended for external control (i.e. stepping controlled by FOSIM). This causes a lot of resources to be discarded and setup again for each pause. To develop OTS-FOSIM with visualization, it is beneficial to have an animator which does not behave in this manner.

WJSchakel commented 7 months ago

Class OtsAnimatorStep was created. This extends OtsAnimator and DevsRealTimeAnimator. The latter has a run() method which creates a Thread for animation on each call. This is not sensical with external control. The method is overridden and implemented almost completely the same, except for the fact that an animation Thread is only created once.

WJSchakel commented 7 months ago

There are two different ways to exercise external control. Through an external stepping loop, or by calling runUntil(). For a simple single-lane demo these simulation speeds are roughly achieved:

Unfortunately, the step method has very poor performance with any animation. Still, animation is only relevant for testing. In the final product animation occurs on the FOSIM side.