- Index
- » Developer
- » OpenModelica development
- » Translation Error: Connection...
Translation Error: Connection Equations for Parameters
Translation Error: Connection Equations for Parameters
Hi,
I have encountered an error at the translation of connection equations containing parameters (records) using OpenModelica.
In the following, the instantiated / flattend model is given. The bold part should be put inside an assert() statement as is done
with the scalar parameter xi.
Hope this helps.
Regards,
Markus.
// ------------------------------------------------------------------------------------------------------------------------------------------------------------
function PemFcSysLib.Media.CoolLiq "Automatically generated record constructor for PemFcSysLib.Media.CoolLiq"
input Real[5] A = {1.0, 1.0, 1.0, 1.0, 1.0};
input Real[5] B = {1.0, 1.0, 1.0, 1.0, 1.0};
input Real[5] C = {1.0, 1.0, 1.0, 1.0, 1.0};
input Real xi = 0.0;
output CoolLiq res;
end PemFcSysLib.Media.CoolLiq;
function PemFcSysLib.Media.FcGlysantin "Automatically generated record constructor for PemFcSysLib.Media.FcGlysantin"
input Real[5] A = {651.9132675, -54.2668599, 658.0692657, 230.3987895, -319.3904439};
input Real[5] B = {5.23037775, 0.76891425, -2.52525975, -2.66357325, 1.4016502499999999};
input Real[5] C = {-4.2598208, -1.9763164, -11.6849752, 4.9729312000000006, 10.110708};
input Real xi = 0.5;
output FcGlysantin res;
end PemFcSysLib.Media.FcGlysantin;
class PemFcSysLib.Test.CoolPort.TestSource
output Real p.y "Connector of Real output signal";
parameter Real p.k(start = 1.0) = 150000.0 "Constant output value";
output Real T.y "Connector of Real output signal";
parameter Real T.k(start = 1.0) = 323.0 "Constant output value";
output Real j_p.y "Connector of Real output signal";
parameter Real j_p.k(start = 1.0) = 0.2 "Constant output value";
parameter Real coolSourcePTJ.medium.A[1] = 651.9132675 "Model parameters density";
parameter Real coolSourcePTJ.medium.A[2] = -54.2668599 "Model parameters density";
parameter Real coolSourcePTJ.medium.A[3] = 658.0692657 "Model parameters density";
parameter Real coolSourcePTJ.medium.A[4] = 230.3987895 "Model parameters density";
parameter Real coolSourcePTJ.medium.A[5] = -319.3904439 "Model parameters density";
parameter Real coolSourcePTJ.medium.B[1] = 5.23037775 "Model parameters spec. heat cap. const. pres.";
parameter Real coolSourcePTJ.medium.B[2] = 0.76891425 "Model parameters spec. heat cap. const. pres.";
parameter Real coolSourcePTJ.medium.B[3] = -2.52525975 "Model parameters spec. heat cap. const. pres.";
parameter Real coolSourcePTJ.medium.B[4] = -2.66357325 "Model parameters spec. heat cap. const. pres.";
parameter Real coolSourcePTJ.medium.B[5] = 1.4016502499999999 "Model parameters spec. heat cap. const. pres.";
parameter Real coolSourcePTJ.medium.C[1] = -4.2598208 "Model parameters dyn. viscosity";
parameter Real coolSourcePTJ.medium.C[2] = -1.9763164 "Model parameters dyn. viscosity";
parameter Real coolSourcePTJ.medium.C[3] = -11.6849752 "Model parameters dyn. viscosity";
parameter Real coolSourcePTJ.medium.C[4] = 4.9729312000000006 "Model parameters dyn. viscosity";
parameter Real coolSourcePTJ.medium.C[5] = 10.110708 "Model parameters dyn. viscosity";
parameter Real coolSourcePTJ.medium.xi = 0.5 "Mass fraction Ethylen Glycol in solution";
input Real coolSourcePTJ.p "Source pressure";
input Real coolSourcePTJ.T "Source temperature";
input Real coolSourcePTJ.j "Source flow rate, defined pos. outwards";
parameter Real coolSourcePTJ.CpII.medium.A[1] = coolSourcePTJ.medium.A[1] "Model parameters density";
parameter Real coolSourcePTJ.CpII.medium.A[2] = coolSourcePTJ.medium.A[2] "Model parameters density";
parameter Real coolSourcePTJ.CpII.medium.A[3] = coolSourcePTJ.medium.A[3] "Model parameters density";
parameter Real coolSourcePTJ.CpII.medium.A[4] = coolSourcePTJ.medium.A[4] "Model parameters density";
parameter Real coolSourcePTJ.CpII.medium.A[5] = coolSourcePTJ.medium.A[5] "Model parameters density";
parameter Real coolSourcePTJ.CpII.medium.B[1] = coolSourcePTJ.medium.B[1] "Model parameters spec. heat cap. const. pres.";
parameter Real coolSourcePTJ.CpII.medium.B[2] = coolSourcePTJ.medium.B[2] "Model parameters spec. heat cap. const. pres.";
parameter Real coolSourcePTJ.CpII.medium.B[3] = coolSourcePTJ.medium.B[3] "Model parameters spec. heat cap. const. pres.";
parameter Real coolSourcePTJ.CpII.medium.B[4] = coolSourcePTJ.medium.B[4] "Model parameters spec. heat cap. const. pres.";
parameter Real coolSourcePTJ.CpII.medium.B[5] = coolSourcePTJ.medium.B[5] "Model parameters spec. heat cap. const. pres.";
parameter Real coolSourcePTJ.CpII.medium.C[1] = coolSourcePTJ.medium.C[1] "Model parameters dyn. viscosity";
parameter Real coolSourcePTJ.CpII.medium.C[2] = coolSourcePTJ.medium.C[2] "Model parameters dyn. viscosity";
parameter Real coolSourcePTJ.CpII.medium.C[3] = coolSourcePTJ.medium.C[3] "Model parameters dyn. viscosity";
parameter Real coolSourcePTJ.CpII.medium.C[4] = coolSourcePTJ.medium.C[4] "Model parameters dyn. viscosity";
parameter Real coolSourcePTJ.CpII.medium.C[5] = coolSourcePTJ.medium.C[5] "Model parameters dyn. viscosity";
parameter Real coolSourcePTJ.CpII.medium.xi = coolSourcePTJ.medium.xi "Mass fraction Ethylen Glycol in solution";
Real coolSourcePTJ.CpII.j(quantity = "MassFlowRate", unit = "kg/s") "Mass flow rate, define towards interface";
Real coolSourcePTJ.CpII.p(quantity = "Pressure", unit = "Pa", displayUnit = "bar", start = 100000.0) "Fluid pressure";
Real coolSourcePTJ.CpII.T(quantity = "ThermodynamicTemperature", unit = "K", displayUnit = "degC", min = 0.0, start = 293.0, nominal = 300.0) "Fluid temperature";
parameter Real Boundary.medium.A[1] = 651.9132675 "Model parameters density";
parameter Real Boundary.medium.A[2] = -54.2668599 "Model parameters density";
parameter Real Boundary.medium.A[3] = 658.0692657 "Model parameters density";
parameter Real Boundary.medium.A[4] = 230.3987895 "Model parameters density";
parameter Real Boundary.medium.A[5] = -319.3904439 "Model parameters density";
parameter Real Boundary.medium.B[1] = 5.23037775 "Model parameters spec. heat cap. const. pres.";
parameter Real Boundary.medium.B[2] = 0.76891425 "Model parameters spec. heat cap. const. pres.";
parameter Real Boundary.medium.B[3] = -2.52525975 "Model parameters spec. heat cap. const. pres.";
parameter Real Boundary.medium.B[4] = -2.66357325 "Model parameters spec. heat cap. const. pres.";
parameter Real Boundary.medium.B[5] = 1.4016502499999999 "Model parameters spec. heat cap. const. pres.";
parameter Real Boundary.medium.C[1] = -4.2598208 "Model parameters dyn. viscosity";
parameter Real Boundary.medium.C[2] = -1.9763164 "Model parameters dyn. viscosity";
parameter Real Boundary.medium.C[3] = -11.6849752 "Model parameters dyn. viscosity";
parameter Real Boundary.medium.C[4] = 4.9729312000000006 "Model parameters dyn. viscosity";
parameter Real Boundary.medium.C[5] = 10.110708 "Model parameters dyn. viscosity";
parameter Real Boundary.medium.xi = 0.5 "Mass fraction Ethylen Glycol in solution";
Real Boundary.p(quantity = "Pressure", unit = "Pa", displayUnit = "bar") "Sink pressure";
Real Boundary.T(quantity = "ThermodynamicTemperature", unit = "K", displayUnit = "degC", min = 0.0, start = 288.15, nominal = 300.0) "Sink temperature";
parameter Real Boundary.CpI.medium.A[1] = Boundary.medium.A[1] "Model parameters density";
parameter Real Boundary.CpI.medium.A[2] = Boundary.medium.A[2] "Model parameters density";
parameter Real Boundary.CpI.medium.A[3] = Boundary.medium.A[3] "Model parameters density";
parameter Real Boundary.CpI.medium.A[4] = Boundary.medium.A[4] "Model parameters density";
parameter Real Boundary.CpI.medium.A[5] = Boundary.medium.A[5] "Model parameters density";
parameter Real Boundary.CpI.medium.B[1] = Boundary.medium.B[1] "Model parameters spec. heat cap. const. pres.";
parameter Real Boundary.CpI.medium.B[2] = Boundary.medium.B[2] "Model parameters spec. heat cap. const. pres.";
parameter Real Boundary.CpI.medium.B[3] = Boundary.medium.B[3] "Model parameters spec. heat cap. const. pres.";
parameter Real Boundary.CpI.medium.B[4] = Boundary.medium.B[4] "Model parameters spec. heat cap. const. pres.";
parameter Real Boundary.CpI.medium.B[5] = Boundary.medium.B[5] "Model parameters spec. heat cap. const. pres.";
parameter Real Boundary.CpI.medium.C[1] = Boundary.medium.C[1] "Model parameters dyn. viscosity";
parameter Real Boundary.CpI.medium.C[2] = Boundary.medium.C[2] "Model parameters dyn. viscosity";
parameter Real Boundary.CpI.medium.C[3] = Boundary.medium.C[3] "Model parameters dyn. viscosity";
parameter Real Boundary.CpI.medium.C[4] = Boundary.medium.C[4] "Model parameters dyn. viscosity";
parameter Real Boundary.CpI.medium.C[5] = Boundary.medium.C[5] "Model parameters dyn. viscosity";
parameter Real Boundary.CpI.medium.xi = Boundary.medium.xi "Mass fraction Ethylen Glycol in solution";
Real Boundary.CpI.j(quantity = "MassFlowRate", unit = "kg/s") "Mass flow rate, define towards interface";
Real Boundary.CpI.p(quantity = "Pressure", unit = "Pa", displayUnit = "bar", start = 100000.0) "Fluid pressure";
Real Boundary.CpI.T(quantity = "ThermodynamicTemperature", unit = "K", displayUnit = "degC", min = 0.0, start = 293.0, nominal = 300.0) "Fluid temperature";
equation
p.y = p.k;
T.y = T.k;
j_p.y = j_p.k;
0.0 = (-coolSourcePTJ.CpII.j) - coolSourcePTJ.j;
0.0 = coolSourcePTJ.p - coolSourcePTJ.CpII.p;
0.0 = coolSourcePTJ.T - coolSourcePTJ.CpII.T;
0.0 = Boundary.p - Boundary.CpI.p;
0.0 = Boundary.T - Boundary.CpI.T;
assert(coolSourcePTJ.CpII.medium.xi == Boundary.CpI.medium.xi,"automatically generated from connect");
coolSourcePTJ.CpII.j + Boundary.CpI.j = 0.0;
coolSourcePTJ.j = j_p.y;
coolSourcePTJ.p = p.y;
T.y = coolSourcePTJ.T;
Boundary.CpI.medium.A[1] = coolSourcePTJ.CpII.medium.A[1];
Boundary.CpI.medium.A[2] = coolSourcePTJ.CpII.medium.A[2];
Boundary.CpI.medium.A[3] = coolSourcePTJ.CpII.medium.A[3];
Boundary.CpI.medium.A[4] = coolSourcePTJ.CpII.medium.A[4];
Boundary.CpI.medium.A[5] = coolSourcePTJ.CpII.medium.A[5];
Boundary.CpI.medium.B[1] = coolSourcePTJ.CpII.medium.B[1];
Boundary.CpI.medium.B[2] = coolSourcePTJ.CpII.medium.B[2];
Boundary.CpI.medium.B[3] = coolSourcePTJ.CpII.medium.B[3];
Boundary.CpI.medium.B[4] = coolSourcePTJ.CpII.medium.B[4];
Boundary.CpI.medium.B[5] = coolSourcePTJ.CpII.medium.B[5];
Boundary.CpI.medium.C[1] = coolSourcePTJ.CpII.medium.C[1];
Boundary.CpI.medium.C[2] = coolSourcePTJ.CpII.medium.C[2];
Boundary.CpI.medium.C[3] = coolSourcePTJ.CpII.medium.C[3];
Boundary.CpI.medium.C[4] = coolSourcePTJ.CpII.medium.C[4];
Boundary.CpI.medium.C[5] = coolSourcePTJ.CpII.medium.C[5];
Boundary.CpI.p = coolSourcePTJ.CpII.p;
Boundary.CpI.T = coolSourcePTJ.CpII.T;
end PemFcSysLib.Test.CoolPort.TestSource;
// ------------------------------------------------------------------------------------------------------------------------------------------------------------
Re: Translation Error: Connection Equations for Parameters
Hi Markus,
It seems like we only generate asserts for constant or parameter arrays in connectors, which is wrong. Looks fairly easy to fix. I've opened a ticket here: https://trac.openmodelica.org/OpenModelica/ticket/2154 . You can add yourself as Cc if you wish to be notified when it's fixed.
Regards,
Per Östlund
- perost
- 114 Posts
- Index
- » Developer
- » OpenModelica development
- » Translation Error: Connection...