I am trying to build input/output connectors as interfaces and add them in a wrapper class that wraps a model. The variables of the connectors are defined using conditional declaration. when I instantiate the output connector in the wrapper class, I can compile the class successfully in Dymola when I use an "equation" section. but when I change it to an "algorithm" section I got an error that:
It has 2 scalar unknowns and 5 scalar equations.
The Real part has 2 unknowns and 2 equations.
The Integer part has 0 unknowns and 2 equations.
The Boolean part has 0 unknowns and 0 equations.
The String part has 0 unknowns and 1 equations.
I have trouble understanding this error. I know the general difference between an algorithm section and an equation section but cannot relate my knowledge to the error that I am getting. I created a small example of what I am trying to compile:
here are the connector definitions:
connector DO
/**/
parameter String Type;
parameter input Integer[:] Dim;
discrete output Real ScalarReal if Type == "Real" and size(Dim, 1) == 1 and Dim[1] == 1 "Scalar Real";
discrete output Real[Dim[1],Dim[2]] MatrixReal if Type == "Real" and size(Dim, 1) > 1 "Matrix Real";
end DO;
connector DI
parameter String Type;
parameter input Integer[:] Dim;
discrete input Real ScalarReal if Type == "Real" and size(Dim, 1) == 1 and Dim[1] == 1 "Scalar Real";
discrete input Real[Dim[1],Dim[2]] MatrixReal if Type == "Real" and size(Dim, 1) > 1 "Matrix Real";
end DI;
connector Conn
parameter input Integer nOut(min = 0) = 0;
parameter input Integer nIn(min = 0) = 0;
DI[nIn] InConn if nIn > 0;
DO[nOut] OutConn if nOut > 0;
end Conn;
and the wrapper model
model Wrapper
Conn testConn(nIn = 0, nOut = 1, OutConn(Type = {"Real"}, Dim = {{2,1}}));
equation
when sample(0,10) then
testConn.OutConn[1].MatrixReal = [2; 3];
end when;
end Wrapper;
Can anyone help me with this problem? Thanks a lot!