Opened 4 years ago

Closed 4 years ago

#5755 closed defect (fixed)

SimulationResult does not contain promised variables when simulation fails

Reported by: dariomangoni@… Owned by: sjoelund.se
Priority: normal Milestone: NeedsInput
Component: Scripts Version: v1.14.0
Keywords: Cc: sjoelund.se

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 Changed 4 years ago by casella

  • Cc sjoelund.se added
  • Component changed from *unknown* to Run-time
  • Milestone changed from Future to 2.0.0
  • Owner changed from somebody to lochel

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 Changed 4 years ago by adrpo

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 Changed 4 years ago by sjoelund.se

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 Changed 4 years ago by sjoelund.se

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 Changed 4 years ago by dariomangoni@…

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 Changed 4 years ago by sjoelund.se

  • Milestone changed from 2.0.0 to NeedsInput
  • Owner changed from lochel to sjoelund.se
  • Status changed from new to assigned

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 Changed 4 years ago by sjoelund.se

  • Component changed from Run-time to Scripts
  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.