Opened 7 years ago

Closed 7 years ago

#4783 closed defect (fixed)

Synchronous solverMethod ExplicitEuler and ImplicitTrapezoid generate too many states

Reported by: Rüdiger Franke Owned by: Lennart Ochel
Priority: high Milestone: 1.13.0
Component: Backend Version:
Keywords: Cc: Willi Braun, Volker Waurich

Description

This error was introduced during the last year after the solver methods "ExplicitEuler" and "ImplicitTrapezoid" had been implemented initially (see also #4237).

FMI export works for the following example using "ImplicitEuler":

model DID "Double Integrator Discrete-time"
  parameter Real p = 1 "gain for input";
  parameter Real y1_start = 1 "start value for first state";
  parameter Real y2_start = 0 "start value for second state";
  input Real u(start = -2);
  output Real y1(start = y1_start, fixed = true);
  output Real y2(start = y2_start, fixed = true);
  Real ud;
equation
  ud = sample(u, Clock(Clock(/*inferred*/), solverMethod = "ImplicitEuler"));
  der(y1) = p * ud;
  der(y2) = previous(y1) + 0.5 * p * ud * interval(ud);
end DID;

Invoke the omc commands:

//setCommandLineOptions("--std=3.3");
setCommandLineOptions("+simCodeTarget=Cpp");
translateModelFMU(DID, version="2.0");

This generates a correct FMU with the two discrete states previous(y1) and previous(y2).

Changing the solverMethod to "ExplicitEuler" or "ImplicitTrapezoid" results in four discrete states previous(der(y1)), previous(der(y2)), previous(y1) and previous(y2).

Any solverMethod should generate 2 discrete states. This was the case when the solver methods "ExplicitEuler" and "ImplicitTrapezoid" had been introduced.

Does anyone know when this was introduced and can it be removed again?

Change History (1)

comment:1 by Rüdiger Franke, 7 years ago

Resolution: fixed
Status: newclosed

Oooh, rfranke did it with d32ecb :-))

Note: See TracTickets for help on using tickets.