Skip to content

Modelica array class #3820

@JM-KANE

Description

@JM-KANE

I have been consistently confused about array class in Modelica. If such an array class was used as the type specifier of a component, the MLS has already provided an explanation. However:

  1. If base classes (such as function, record, or enumeration class) can be called, can array classes also be called? If yes, should the input and output types have an extra dimension?
model ArrayCallable
  record R
    Real x = 0;
  end R;
  record S = R[2](x = 1:2);
  S s = S();  // Illegal ?
  
  type E = enumeration(a, b);
  type G = E[2](quantity = {"a", "b"});
  G g = G(1); // Illegal ?
end ArrayCallable;
  1. Can array classes be used in composite names to access members of the class? For example, an array package.
model ArrayPackage
  package P
    constant Real c = 0;
  end P;
  package Q = P[2](c = 1:2);
  Real x = Q.c;  // Is c an element of Q?
end ArrayPackage;

In C++, there is a also concept of array types. The constructor for such types works by sequentially constructing each array element and is unrelated to the constructor of the base class. Moreover, it cannot access types or static variables from the base class. Is the handling in Modelica the same, or will there be clear regulations on this in the future?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions