- Index
- » Programming
- » Modelica Language
- » 5 equation and 6 variables
5 equation and 6 variables
5 equation and 6 variables
I'm trying to program a heat-exchange block between metal and liquid nitrogen. This dependence has been studied and described by equations in the conditional system. Unfortunately, the error message "6 equations and 5 variables" is displayed on the block test. When I delete a condition and give one equation the block works. Please help.
model wymiana
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a super annotation(
Placement(visible = true, transformation(origin = {-100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-102, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b conduct annotation(
Placement(visible = true, transformation(origin = {100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {98, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.SIunits.TemperatureDifference dT;
Modelica.SIunits.HeatFlowRate Q_flow;
equation
dT = super.T - conduct.T;
super.Q_flow = -Q_flow;
conduct.Q_flow = Q_flow;
if (abs(dT)>=0 and abs(dT)<12.8994) then
Q_flow = -0.0027 * dT ^5 + 0.0597 * dT ^ 4 - 0.3163 * dT ^ 3 + 0.9561 * dT ^ 2 + 0.3274 * dT + 0.0455;
elseif (abs(dT)>=12.8994 and abs(dT)< 36.524) then
Q_flow = 0.00009 * dT ^ 5 - 0.0128 * dT ^ 4 + 0.6632 * dT ^ 3 - 15.831 * dT ^ 2 + 159 * dT - 349.47;
elseif abs(dT)>=36.525 then
Q_flow = 0.1663 * dT - 0.8888;
end if;
annotation(
uses(Modelica(version = "3.2.2")),
Icon(graphics = {Line(origin = {-88, 0}, points = {{-12, 0}, {8, 0}}), Line(origin = {92, 0}, points = {{-12, 0}, {8, 0}}), Rectangle(extent = {{-80, 60}, {80, -60}}), Line(points = {{-60, 40}, {-60, -40}, {60, -40}}), Line(origin = {-1.27, -10.39}, points = {{-58.7292, -29.6065}, {-26.7292, 66.3935}, {-10.7292, -19.6065}, {59.2708, 6.39347}}, smooth = Smooth.Bezier)}, coordinateSystem(initialScale = 0.1)),
Diagram,
version = "",
__OpenModelica_commandLineOptions = "");
end wymiana;
- Index
- » Programming
- » Modelica Language
- » 5 equation and 6 variables