Skip to content

Move timeout and progress reports to Simulation#1028

Open
pjonsson wants to merge 3 commits intocontiki-ng:masterfrom
pjonsson:simulation-timeout
Open

Move timeout and progress reports to Simulation#1028
pjonsson wants to merge 3 commits intocontiki-ng:masterfrom
pjonsson:simulation-timeout

Conversation

@pjonsson
Copy link
Copy Markdown
Contributor

@pjonsson pjonsson commented Dec 29, 2022

This moves the code for handling timeouts
and progress reports from LogScriptEngine to Simulation.

@pjonsson pjonsson changed the title Simulation: add support for timeout Move timeout and progress reports to Simulation Dec 31, 2022
@pjonsson
Copy link
Copy Markdown
Contributor Author

@nfi Added the commit that migrates the progress report to this PR. It's the last set timeout that should get precedence. I'm not sure what decides the order.

@nfi
Copy link
Copy Markdown
Member

nfi commented Dec 31, 2022

I get an exception when I deactivate and then reactivate a simulation script:

java.lang.IllegalStateException: Event is already scheduled: org.contikios.cooja.Simulation$1@19eff8d7
	at org.contikios.cooja.EventQueue.addEvent(EventQueue.java:95)
	at org.contikios.cooja.Simulation.scheduleEvent(Simulation.java:534)
	at org.contikios.cooja.Simulation.lambda$setTimeout$1(Simulation.java:556)
	at org.contikios.cooja.Simulation.lambda$new$0(Simulation.java:212)
	at java.base/java.lang.Thread.run(Thread.java:833)

@pjonsson
Copy link
Copy Markdown
Contributor Author

Fixed in latest update.

@nfi
Copy link
Copy Markdown
Member

nfi commented Dec 31, 2022

If you run a simulation until timeout, and then reload the simulation, the new simulation will immediately timeout without running anything. Also, it is no longer possible to continue running a simulation after first timeout.

@pjonsson
Copy link
Copy Markdown
Contributor Author

Fixed.

Add a method that gets the time of the first
scheduled item in the queue.
This moves the code for handling timeouts
from LogScriptEngine to Simulation.
This removes the duplicate progress reports when
using multiple script engines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants