openmodelica - Modelica: Mixing connectors and direct inputs -


the following modelica package - while neither being particularly useful nor interesting - not yield warnings.

package p   connector c     real c;   end c;   model     input c x;     output real y;   equation      y = x.c;   end a;   model b     input c inp;     output c out;     a;   equation      a.x = inp;     out.c = a.y;   end b; end p; 

however, when a not use connectors in following case, there warning: the following input lacks binding equation: a.x. clearly, there binding equation a.x. why there such warning?

package p   connector c     real c;   end c;   model     input real x;     output real y;   equation      y = x;   end a;   model b     input c inp;     output c out;     a;   equation      a.x = inp.c;     out.c = a.y;   end b; end p; 

the issue here there not binding equation. there ordinary equation. binding equation 1 applied modification element, e.g.

model b   input c inp;   output c out;   a(x=inp.c) "binding equation"; equation    out.c = a.y; end b; 

note in general, if 2 things connectors, should not equated, should connected. avoid issue. in first version of b:

model b   input c inp;   output c out;   a; equation   connect(a.x, inp);    out.c = a.y; end b; 

the reason binding equation restriction has making sure components balanced. can read more in specification or in modelica example. using binding equation, makes clear equation can used solve variable (i.e., term in equation containing variable won't vanish or ill-conditioned).


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -