Opened 5 years ago

Closed 4 years ago

#5755 closed defect (fixed)

SimulationResult does not contain promised variables when simulation fails

Reported by: dariomangoni@… Owned by: Martin Sjölund
Priority: normal Milestone: NeedsInput
Component: Scripts Version: v1.14.0
Keywords: Cc: Martin Sjölund

Description

The simulate script function promises to output a record that is formatted as the following:

record SimulationResult
  String resultFile;
  String simulationOptions;
  String messages;
  Real timeFrontend;
  Real timeBackend;
  Real timeSimCode;
  Real timeTemplates;
  Real timeCompile;
  Real timeSimulation;
  Real timeTotal;
end SimulationResult;

However, some variables may be missing if simulation fails; then, querying such variables, makes scripts end prematurely.

Change History (7)

comment:1 by Francesco Casella, 5 years ago

Cc: Martin Sjölund added
Component: *unknown*Run-time
Milestone: Future2.0.0
Owner: changed from somebody to Lennart Ochel

This is a serious issue, because it's hard to debug a model which fails if one cannot see the results. I'll mark it as a blocker for 2.0.0, maybe we can do something about it while we work on the debugger

comment:2 by Adrian Pop, 5 years ago

This should be an easy fix, we just need some try/catch blocks I think, but without looking at the code you never know.

comment:3 by Martin Sjölund, 5 years ago

Adrian, it's things like the times are missing. You don't even need to use try/catch blocks.
Our scripts check for empty filename and if so, skips checking other variables.

comment:4 by Martin Sjölund, 4 years ago

Do you have an example where this happens? I only find cases that work properly, even in OMNotebook which has a special implementation for simulation results.

comment:5 by dariomangoni@…, 4 years ago

Sorry guys, I didn't save the models that was causing troubles and right now, after some months I cannot find a way to reproduce the issue...

comment:6 by Martin Sjölund, 4 years ago

Milestone: 2.0.0NeedsInput
Owner: changed from Lennart Ochel to Martin Sjölund
Status: newassigned

Ah, I just found an example when thinking of one more thing:

loadString("model M
equation
  assert(time < 0.5, \"abc\");
end M;");getErrorString();
r:=simulate(M);getErrorString();
x := r.timeSimulation;

Only if the simulation itself fails, time for simulation and total time (only) are missing. If translation fails, all variables are there.

comment:7 by Martin Sjölund, 4 years ago

Component: Run-timeScripts
Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.