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

Connector and OM compiler

Connector and OM compiler

Hi every one,

I am new to Modelica and openModelica.
Thank you for the help you'll give to this post.

We have defined a connector as follows :

connector ZPin
  discrete Real value;
end ZPin;

A ZPin variable is declared in a model :

model my_model
// Some variables / parameters declarations ....
ZPin var_zpin(value(start = 0));
...

equation
...
// no equation involving var_zpin ...
...
end my_model;


I want to generate C or XML files from my model using the OM compiler.
If variable "var_zpin.value" is not involved in any equation, the compiler will exit with an error :
the model contains more variables than equations and any discrete variable (like ZPin variable in a way)
must be involved in at least one equation.
Unless "my_model.var_zpin.value" is connected to another value in a larger model
declaring a my_model object (i just realize this connection is an equation involving "var_zpin.value" after all).

The problem is that i'd like not to be forced to create a connection with this variable or a new equation involving this variable :
How can i do so that OM compiler does not take into account this variable when it counts the number
of variables and compare it to the number of equations ?

Already tried solutions :
- Adding a dummy equation involving "var_zpin.value" (var_zpin.value = 0current/wink
  changes the C files generated in a not suitable way for us.
- Replacing
  ZPin var_zpin(value(start = 0));
  with
  input discrete real var_zpin(...);
  does not work : the OM compiler does not like it.

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