You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goToTime method in the Simulation should allow users to move the simulation to a specific point in the future and pause it. However, after testing this method, I discovered that there is a flaw in its implementation.
When the goToTime method is first called, the Simulation correctly jumps to the specified time using the DoubleTime parameter:
val simulation = ...
simulation.goToTime(DoubleTime(10.0)
simulation.play()
// run simulation into another thread
executor. submit { simulation. run() }
simulation.waitFor(Stautus.PAUSED, 1, TimeUnit.SECONDS)
// here simulation.getTime is greater than 10.0
The issue arises when the goToTime method is called a second time to jump to a new time, as the simulation does not progress past the previous paused time. This problem occurs because the OutputMonitor is not removed after the first time the simulation is paused, which causes the monitor to trigger again and pause the simulation at the previous time.
Upon examining the source code, it is clear that the issue is caused by the OutputMonitor not being removed after its initial use. I have created a test that demonstrates this error, which can be found here.
The text was updated successfully, but these errors were encountered:
The solution looks relatively easy: upon satisfaction of the condition, the output monitor should deregister itself. Can you open a PR with the regression test?
The
goToTime
method in theSimulation
should allow users to move the simulation to a specific point in the future and pause it. However, after testing this method, I discovered that there is a flaw in its implementation.When the
goToTime
method is first called, theSimulation
correctly jumps to the specified time using theDoubleTime
parameter:The issue arises when the
goToTime
method is called a second time to jump to a new time, as the simulation does not progress past the previous paused time. This problem occurs because theOutputMonitor
is not removed after the first time the simulation is paused, which causes the monitor to trigger again and pause the simulation at the previous time.Upon examining the source code, it is clear that the issue is caused by the OutputMonitor not being removed after its initial use. I have created a test that demonstrates this error, which can be found here.
The text was updated successfully, but these errors were encountered: