Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#5723 closed enhancement (fixed)

[OMEdit] Do not allow the simulation window to be closed if the simulation is still running

Reported by: Adrian Pop Owned by: Adeel Asghar
Priority: normal Milestone: 1.16.0
Component: OMEdit Version:
Keywords: Cc:

Description (last modified by Adrian Pop)

For simulations is would be good not to be able to close the simulation window (btw, how do you get it back if you closed it?).

Especially for simulations that give some asserts at initialization but then continue is hard for the user to tell if the simulation failed or is actually continuing. The user closes the window, does some model modification and then recompiles one would get a "permision denied" when the gcc linker ld tries to write the executable again. OMEdit knows that the exe is still running, it should not let the user recompile the model.

Change History (9)

comment:1 by Adrian Pop, 5 years ago

Description: modified (diff)

comment:2 by Adeel Asghar, 5 years ago

Description: modified (diff)
Milestone: Future1.16.0
Status: newaccepted

comment:3 by Adrian Pop, 5 years ago

Description: modified (diff)
Milestone: 1.16.0Future
Priority: highnormal
Type: defectenhancement

comment:4 by Adrian Pop, 5 years ago

Milestone: Future1.16.0

comment:5 by Francesco Casella, 5 years ago

I understand you mean that you should only be allowed to cancel the simulation with the button (which sends a terminate signal to the executable), but not by closing the window with the window close button, right?

Can't we just interpret also that action as "close the window and terminate the simulation"?

comment:6 by Adeel Asghar, 5 years ago

Both solutions are possible. We can disable (not sure if the top right cross button can be disabled but for sure we can drop the event) closing the window if simulation is running OR cancel the simulation if users closes the window.

For simulations is would be good not to be able to close the simulation window (btw, how do you get it back if you closed it?).

They are placed in Simulation Setup->Archived Simulations.

comment:7 by Adeel Asghar, 5 years ago

Resolution: fixed
Status: acceptedclosed

Done in 5727cb1/OpenModelica.

The user can't close the simulation output window while the model is compiling or simulating.

comment:8 by Francesco Casella, 5 years ago

Just a comment. I am fine with this feature in principle. However, there are cases where the simulation gets stuck (i.e. because of chattering, or simply because it just takes forever to reach stopTime for any reason and you want to stop it). In these cases, we need a way to eventually stop the simulation and get rid of this window witout the need to kill the OMEdit process or to reboot the computer.

This is a MWE of such a situation

model Chattering
  Real x(start = 1, fixed = true);
equation
  der(x) = noEvent(if x > 0 then -1 else 1);
annotation(experiment(StopTime = 2));
end Chattering;

I just tried it with the latest nightly, and indeed I can stop the simulation by clicking on the Cancel Simulation button. I get this error message

Process crashed
Simulation process failed. Exited with code 62097.

which is not particularly nice, I would have preferred something more polite like

Simulation process terminated by the user at time = 0.5

but this is another story, I'll open a ticket about that.

The question is: are we reasonably sure that the Cancel Simulation button sends a powerful enough termination signal to the simulation executable, so that it basically always works?

comment:9 by Adeel Asghar, 5 years ago

See #5926 for more further details.

Note: See TracTickets for help on using tickets.