Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#4119 closed defect (worksforme)

singulare model pass backend

Reported by: Vitalij Ruge Owned by: somebody
Priority: high Milestone: Future
Component: Backend Version:
Keywords: Cc:

Description

We gerenate for the follwoing example, wrong C and Cpp code.
But we should failed in the Backend or Frondend check, because we have a duplicate equation(singular model).

model foo
  function f
    input Real[2] x;
    output Real[2] y;
    output Real[2] z;
  algorithm
    y[1] := 2*x[1]^2 + 1; y[2] := 3*x[2]^3 + 2;
    z[1] := -y[1]/2+1/2+7; z[2] := -y[2]/3+2/3-7;
  end f;

  Real[2] y(each start = -1);
  Real[2] w(each start = -1);
  Real z1, z2, z3;
equation
  (, w) = f({y[1] + z3, y[2]});
  (, w) = f({y[1] + z3, y[2]}); // duplicate eq
  der(y[1]) = -z1*y[2] +1;
  der(y[2]) = -z2*y[1] + z1*y[2] +3;
  z3 = time;
end foo;

Change History (2)

comment:1 by Francesco Casella, 7 years ago

Component: *unknown*Backend
Resolution: worksforme
Status: newclosed

I tried this with OpenModelica-v1.13.0-dev-63-g453e1c7-64bit. The model generates an error in the backend:

[1] 23:15:12 Translation Warning
The Tearing heuristic has chosen variables with annotation attribute 'tearingSelect = avoid'. Use -d=tearingdump and -d=tearingdumpV for more information.

[2] 23:15:12 Translation Warning
Iteration variables with default zero start attribute in torn nonlinear equation system:
         $OMC$CF$init1[2]:VARIABLE()  type: Real  [2]
         $DER.y[1]:DUMMY_DER(fixed = false ) .foo type: Real  [2]
         $DER.y[2]:DUMMY_DER(fixed = false ) .foo type: Real  [2]
         $OMC$CF$init1[1]:VARIABLE()  type: Real  [2]


[3] 23:15:12 Symbolic Error
Too few equations, under-determined system. The model has 18 equation(s) and 20 variable(s).

[4] 23:15:12 Symbolic Warning
Equation 6 (size: 2) (_, w) = foo.f({y[1] + z3, y[2]}) is not big enough to solve for enough variables.
  Remaining unsolved variables are: z3
  Already solved: 
  Equations used to solve those variables:

[5] 23:15:12 Translation Error
Internal error Transformation Module PFPlusExt index Reduction Method Pantelides failed!

[6] 23:15:12 Translation Error
post-optimization module wrapFunctionCalls (simulation) failed.

I'm not sure why the model is reported to have 18 equations and 20 variables, as I see 7 equations in 7 variables. Maybe there's something wrong in how OMC deals with complex functions with empty output arguments.

I don't think we should look for duplicate equations, that in general could be quite expensive. Structural analysis should find this out.

in reply to:  1 comment:2 by Francesco Casella, 7 years ago

Replying to casella:

I'm not sure why the model is reported to have 18 equations and 20 variables, as I see 7 equations in 7 variables. Maybe there's something wrong in how OMC deals with complex functions with empty output arguments.

See #4553

Note: See TracTickets for help on using tickets.