Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Is it a compiler bug?

Is it a compiler bug?

With the InOutArray.mo I get:

Error: Variable m.x[1] is not referenced in any equation (possibly after symbolic manipulations).

However if I make it scalar instead of an array, everything works fine, try that with InOut.mo.

The InOutArray.mo is a simplified version of a complicated model that is why it looks awkward and silly. With the complicated model I get either

Error: Internal error BackendDAETransform.selectDummyState: no state to select

or

Error: An independent subset of the model has imbalanced number of equations (3) and variables (2).

depending on how I change that complicated model.

Any help is greatly appreciated.

---------------------
For some reason I cannot attach files, it says "Upload error"

InOutArray.mo giving the error:

package InnerOuter

  constant Integer C=1;

  partial class Equations
    inner Real x[C];
    inner Real y[C];
    replaceable class FirstEq  =  Eq1;
    replaceable class SecondEq =  Eq2;
    FirstEq  eq1;
    SecondEq eq2;
  end Equations;

  partial class Eq1
    outer Real x[C];
    outer Real y[C];
  end Eq1;

  partial class Eq2
    outer Real x[C];
    outer Real y[C];
  end Eq2;

  class EqA
    extends Eq1;
    equation
      x[1] + y[1] = 1;
  end EqA;

  class EqB
    extends Eq2;
    equation
      x[1]*x[1] + y[1]*y[1] = 1;
  end EqB;

end InnerOuter;

model InOut

  import InnerOuter.*;

  class Main
    extends Equations;
    redeclare class FirstEq  = EqA;
    redeclare class SecondEq = EqB;
  end Main;

  Main m;

end InOut;

-----------

InOut.mo, basicly the same as above but this one works:

package InnerOuter

  partial class Equations
    inner Real x;
    inner Real y;
    replaceable class FirstEq  =  Eq1;
    replaceable class SecondEq =  Eq2;
    FirstEq  eq1;
    SecondEq eq2;
  end Equations;

  partial class Eq1
    outer Real x;
    outer Real y;
  end Eq1;

  partial class Eq2
    outer Real x;
    outer Real y;
  end Eq2;

  class EqA
    extends Eq1;
    equation
      x + y = 1;
  end EqA;

  class EqB
    extends Eq2;
    equation
      x*x + y*y = 1;
  end EqB;

end InnerOuter;

model InOut

  import InnerOuter.*;

  class Main
    extends Equations;
    redeclare class FirstEq  = EqA;
    redeclare class SecondEq = EqB;
  end Main;

  Main m;

end InOut;

Re: Is it a compiler bug?

The above code compiles nicely with the JModelica compiler and the correct equations are generated.

I would greatly appreciate any help to get this work in OpenModelica.

Re: Is it a compiler bug?

Hi,

it looks like a error in the frontend:

class InOut
  Real m.x[1];
  Real m.y[1];
equation
  m.eq1.x[1] + m.eq1.y[1] = 1.0;
  m.eq2.x[1] ^ 2.0 + m.eq2.y[1] ^ 2.0 = 1.0;
end InOut;

because m.eq1.x, m.eq1.y, m.eq2.x and m.eq2.y are unkown variables.

Re: Is it a compiler bug?

Thanks for the response, for some reason I did not get a notification in e-mail (or accidentaly deleted with the junk mail).

Anyhow, what should I do now?

There are 0 guests and 0 other users also viewing this topic
You are here: