If possible I would like to create an array of replaceable media packages that a user can then change each option using available choices.
Below is a typically way to define the medium.
replaceable package Medium = Modelica.Media.Interfaces.PartialMedium
"Coolant medium" annotation (choicesAllMatching=true);
The following is a prototype of what I was hoping could be done where each of the "Mediums" is potentially a different media.
parameter Integer n = 1 "Number of media models";
replaceable package Medium[n] = {Modelica.Media.Interfaces.PartialMedium}
"Coolant medium" annotation (choicesAllMatching=true);
However, this is not acceptable modelica. I've tried using variations on records as well but found no success. Any ideas? Perhaps this is not permitted in Modelica... Thank you.
If it was possible to create such an array, consider how you could use it:
model M
replaceable package Medium[n];
medium[1] m1; // "Creates a Medium array of size 1"; not reference to Medium 1
Real r = Medium[1].f(...); // Disallowed syntax; function names do not contain subscripts
end M;
You could probably try the following (works in OpenModelica; not tested in Dymola), but it is of limited value:
package M
constant Real r;
end M;
model Test
M[2] m(r={1,2});
M m1=m[1];
M m2=m[2];
end Test;