ModelicaSpecification icon indicating copy to clipboard operation
ModelicaSpecification copied to clipboard

Overconstrained types used as arrays

Open modelica-trac-importer opened this issue 7 years ago • 1 comments

Reported by eshmoylova on 28 Mar 2017 15:09 UTC How are Connections functions and equalityConstrained supposed to apply to overconstrained types used as arrays?

One of the free Modelica libraries (not developed by MA) contains an overconstrained type, ReferenceAngle, that is being used to define an array in a connector of the form:

connector Terminal
  Voltage v[n];
  flow Current i[n];
  ReferenceAngle theta[m];
end Terminal;

How should the equalityConstraint be defined for ReferenceAngle? The library has it defined as:

function equlityConstraint
  input ReferenceAngle theta1[:];
  input ReferenceAngle theta2[:];
  output residue[0];
....
end equalityConstraint;

It seems to contradict the specification that requires that the equalityConstraint function should be of the form:

function equalityConstraint
  input Type T1;
  input Type T2;
  output Real residue[ <n> ]
...
end equalityConstraint;

However, in Dymola if equalityConstraint is defined according to the specification and the Terminal as above you will get an error for calling calling the function with array inputs. Does it mean that the rule "Scalar Function Applied to Array Arguments" (Section 12.4.6) does not apply to equalityConstraint?

How should Connection functions be applied in such case? Let p be an instance of Terminal. Is it allowed to specify the following?

Connections.root(p.theta[1]);

In Dymola, it gives an error. I do not see anything in the Specification that would forbid it. If it is allowed, and p.theta[1] is set as root but p.theta[2] was not chosen as a root (assuming m = 2), what should be the result of Connections.isRoot(p.theta)?


Migrated-From: https://trac.modelica.org/Modelica/ticket/2171

modelica-trac-importer avatar Nov 04 '18 20:11 modelica-trac-importer

Modified by beutlich on 10 Jan 2018 08:19 UTC

modelica-trac-importer avatar Nov 04 '18 20:11 modelica-trac-importer