Opened 12 years ago

Closed 12 years ago

#1787 closed defect (fixed)

Backend adds = 0.0 bindings for no good reason

Reported by: Jens Frenkel Owned by: Martin Sjölund
Priority: high Milestone: 1.9.0
Component: Backend Version: trunk
Keywords: eval Cc: Per Östlund

Description

For the model Modelica.Mechanics.MultiBody.Examples.Loops.EngineV6_analytic
the frontend evaluates
engine.cylinder4.jointRRP.jointUSP.prismatic.positiveBranch:PARAM(fixed = false final = true ) .Boolean type

to a real value instead of a boolean

Change History (6)

comment:1 by Jens Frenkel, 12 years ago

comment:2 by Martin Sjölund, 12 years ago

Owner: changed from Adrian Pop to Martin Sjölund
Status: newassigned

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

Component: FrontendBackend

Hmmm. Not a pure front-end issue since this is not Ceval'ed in the front-end...

engine.cylinder4.jointRRP.jointUSP.prismatic.positiveBranch = Modelica.Mechanics.MultiBody.Joints.Internal.PrismaticWithLengthConstraint.selectBranch(engine.cylinder4.jointRRP.jointUSP.prismatic.length, {engine.cylinder4.jointRRP.jointUSP.prismatic.e[1], engine.cylinder4.jointRRP.jointUSP.prismatic.e[2], engine.cylinder4.jointRRP.jointUSP.prismatic.e[3]}, engine.cylinder4.jointRRP.jointUSP.prismatic.s_offset + engine.cylinder4.jointRRP.jointUSP.prismatic.s_guess, {engine.cylinder4.jointRRP.jointUSP.prismatic.r_a[1], engine.cylinder4.jointRRP.jointUSP.prismatic.r_a[2], engine.cylinder4.jointRRP.jointUSP.prismatic.r_a[3]}, {engine.cylinder4.jointRRP.jointUSP.prismatic.r_b[1], engine.cylinder4.jointRRP.jointUSP.prismatic.r_b[2], engine.cylinder4.jointRRP.jointUSP.prismatic.r_b[3]});

It must be either inline, ceval or simplify called from the back-end. I'll have a closer look.

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

lowerKnownVar is executed for this variable, and has an extra = 0.0 binding added to it. I will see what happens if I remove this automatic adding of bindings...

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

The testcase I will add (current omc simulates this as i=1, r=1)

model M
  parameter Integer i(start=1,fixed=false);
  Real r = i;
initial equation
  i = 2;
end M;

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

Resolution: fixed
Status: assignedclosed
Summary: eval returns real instead of bool valuesBackend adds = 0.0 bindings for no good reason

r12686 fixes this problem. My pretty testcase could not be added because we still do not support initial equations.

If the rest of the backend wants fixed=true parameters to have the binding added this can be done, but requires some more work (check fixed=true, check input type, etc).

Note: See TracTickets for help on using tickets.