Opened 9 years ago

Last modified 7 years ago

#3832 new defect

Wrong min/max attributes for derivatives in equation systems

Reported by: Rüdiger Franke Owned by: Lennart Ochel
Priority: high Milestone: Future
Component: Backend Version:
Keywords: Cc:

Description

Nonlinear solvers can exploit the min/max attributes of variables. The backend introduces additional variables for derivatives. It is good if these variables for der(x) keep nominal attribute of x. They must not keep min and max attributes though.

See e.g.:

setCommandLineOptions("+simCodeTarget=Cpp");
loadModel(Modelica);
simulate(Modelica.Fluid.Examples.DrumBoiler.DrumBoiler);

The file OMCppModelica.Fluid.Examples.DrumBoiler.DrumBoilerAlgloop138.cpp:16f contains {name, nominal, min, max}:

  _vars[0] = {"der(evaporator.V_l)", 1.0, -1e60, 1e60};
  _vars[1] = {"der(evaporator.p)", 1000000.0, 611.657, 100000000.0};

The backend should not provide the min and max attributes of evaporator.p for der(evaporator.p) because the derivative of the pressure can be negative.

Change History (5)

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

6e3121a/OMCompiler works around the problem in the code generation (similar to what FMI model structure does). This results in:

  _vars[0] = {"der(evaporator.V_l)", 1.0, -HUGE_VAL, HUGE_VAL};
  _vars[1] = {"der(evaporator.p)", 1000000.0, -HUGE_VAL, HUGE_VAL};

You can close this ticket if it is intended to use the attributes of the original variable for the derivative (because Modelica 3.3 does not allow to define any attribute for a derivative).

in reply to:  1 comment:2 by Lennart Ochel, 9 years ago

Replying to rfranke:

You can close this ticket if it is intended to use the attributes of the original variable for the derivative (because Modelica 3.3 does not allow to define any attribute for a derivative).

I see no good reason to use the min/max(/nominal) attributes for derived variables. If these attributes are required, they could be defined via alias variables. Therefore, I propose to keep this ticket open and change this in the backend.

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

Milestone: 1.10.01.11.0

Ticket retargeted after milestone closed

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

Milestone: 1.11.01.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:5 by Francesco Casella, 7 years ago

Milestone: 1.12.0Future

The milestone of this ticket has been reassigned to "Future".

If you think the issue is still valid and relevant for you, please select milestone 1.13.0 for back-end, code generation and run-time issues, or 2.0.0 for front-end issues.

If you are aware that the problem is no longer present, please select the milestone corresponding to the version of OMC you used to check that, and set the status to "worksforme".

In both cases, a short informative comment would be welcome.

Note: See TracTickets for help on using tickets.