Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

An independent subset of the model has imbalanced number of equations (66) and variables (67).

Hello everyone, I'm a beginner and while studying a simple building model and introducing air circulation, I keep getting an error "An independent subset of the model has imbalanced number of equations (66) and variables (67)."I have been struggling with this problem and I'm hoping for some guidance to help me find a solution.

 model AHU
 Parameter Modelica.Units.SI.MassFlowRate mq_Liq = 73.819;
  parameter Modelica.Units.SI.MassFlowRate mq_Air = 13.61;
  parameter Modelica.Units.SI.MassFlowRate mWat_flow = 0.15;
  replaceable package MediumAir = Buildings.Media.Air;
  replaceable package MediumLiq = Buildings.Media.Water;
  Buildings.Fluid.Movers.Preconfigured.FlowControlled_dp fan(redeclare package Medium = MediumAir, 
 m_flow_nominal = mq_Air, dp(start = 249), m_flow(start = mq_Air), dp_nominal = 750, addPowerToMedium = true) 
  Modelica.Blocks.Sources.Ramp ramp1(duration = 20, startTime = 0) 
RoomTest31 roomTest31(nports = 2) 
  connect(ramp1.y, fan.dp_in) 
connect(fan.port_b, roomTest31.ports[1]) 
connect(roomTest31.ports[2], fan.port_a) 
end AHU;




model RoomTest31
  replaceable package MediumAir = Buildings.Media.Air;
  parameter Modelica.Units.SI.MassFlowRate mq_Air = 13.61;
  parameter Integer nports = 0 "Number of parts" annotation(
    Evaluate = true,
    Dialog(connectorSizing = true, tab = "General", group = "Ports"));
  Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir VolumeMoistAir(nPorts = nports, redeclare package Medium = MediumAir, V = 500, m_flow_nominal = mq_Air) annotation(
    Placement(transformation(
    origin = {38, 54}, extent = {{-10, -10}, {10, 10}})));
   Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow HeatFlow(T_ref = 298.15) annotation(
   Placement(transformation(origin = {-6, 50}, extent = {{-10, -10}, {10, 10}})));
  Modelica.Blocks.Sources.CombiTimeTable DataTable(table = [0.0, 0.015, 1000; 0.25, 0.020, 1250; 0.5, 0.030, 1300; 0.75, 0.040, 800; 1, 0.01, 1200; 1.25, 0.02, 1000; 1.5, 0.015, 1100]) annotation(
    Placement(transformation(origin = {-44, 62}, extent = {{-10, -10}, {10, 10}})));
  Modelica.Fluid.Vessels.BaseClasses.VesselFluidPorts_b ports[nports](redeclare each package Medium = MediumAir) annotation(
    Placement(transformation(origin = {35, 4}, extent = {{-21, -8}, {21, 8}}), iconTransformation(origin = {-39.7368, 0.818182}, extent = {{-21.1818, -12.2632}, {21.1818, 12.2632}}, rotation = -90)));
equation
  connect(HeatFlow.port, VolumeMoistAir.heatPort) annotation(
    Line(points = {{4, 50}, {11, 50}, {11, 54}, {28, 54}}, color = {191, 0, 0}));
  connect(DataTable.y[2], HeatFlow.Q_flow) annotation(
    Line(points = {{-33, 62}, {-33, 50}, {-16, 50}}, color = {0, 0, 127}));
 connect(DataTable.y[1], VolumeMoistAir.mWat_flow) annotation(
    Line(points = {{-33, 62}, {26, 62}}, color = {0, 0, 127}));
  connect(VolumeMoistAir.ports, ports) annotation(
    Line(points = {{38, 44}, {30, 44}, {30, 6}, {34.5, 6}, {34.5, 4}, {35, 4}}, color = {0, 127, 255}));
  annotation(
    Diagram(coordinateSystem(extent = {{-60, 80}, {120, 0}})),
    Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(origin = {2, -1}, extent = {{-54, 47}, {54, -47}}), Line(origin = {1.99477, 62.4348}, points = {{-53.9948, -16.7353}, {-1.99477, 17.2647}, {54.0052, -16.7353}, {54.0052, -16.7353}})}));

end RoomTest31;

An independent subset of the model has imbalanced number of equations (66) and variables (67).

Hello everyone, I'm a beginner and while studying a simple building model and introducing air circulation, I keep getting an error "An independent subset of the model has imbalanced number of equations (66) and variables (67)."I have been struggling with this problem and I'm hoping for some guidance to help me find a solution.

 model AHU
 Parameter Modelica.Units.SI.MassFlowRate mq_Liq = 73.819;
  parameter Modelica.Units.SI.MassFlowRate mq_Air = 13.61;
  parameter Modelica.Units.SI.MassFlowRate mWat_flow = 0.15;
  replaceable package MediumAir = Buildings.Media.Air;
  replaceable package MediumLiq = Buildings.Media.Water;
  Buildings.Fluid.Movers.Preconfigured.FlowControlled_dp fan(redeclare package Medium = MediumAir, 
 m_flow_nominal = mq_Air, dp(start = 249), m_flow(start = mq_Air), dp_nominal = 750, addPowerToMedium = true) 
  Modelica.Blocks.Sources.Ramp ramp1(duration = 20, startTime = 0) 
RoomTest31 roomTest31(nports = 2) 
  connect(ramp1.y, fan.dp_in) 
connect(fan.port_b, roomTest31.ports[1]) 
connect(roomTest31.ports[2], fan.port_a) 
end AHU;




model RoomTest31
  replaceable package MediumAir = Buildings.Media.Air;
  parameter Modelica.Units.SI.MassFlowRate mq_Air = 13.61;
  parameter Integer nports = 0 "Number of parts" annotation(
    Evaluate = true,
    Dialog(connectorSizing = true, tab = "General", group = "Ports"));
  Buildings.Fluid.MixingVolumes.MixingVolumeMoistAir VolumeMoistAir(nPorts = nports, redeclare package Medium = MediumAir, V = 500, m_flow_nominal = mq_Air) annotation(
    Placement(transformation(
    origin = {38, 54}, extent = {{-10, -10}, {10, 10}})));
   Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow HeatFlow(T_ref = 298.15) annotation(
   Placement(transformation(origin = {-6, 50}, extent = {{-10, -10}, {10, 10}})));
  Modelica.Blocks.Sources.CombiTimeTable DataTable(table = [0.0, 0.015, 1000; 0.25, 0.020, 1250; 0.5, 0.030, 1300; 0.75, 0.040, 800; 1, 0.01, 1200; 1.25, 0.02, 1000; 1.5, 0.015, 1100]) annotation(
    Placement(transformation(origin = {-44, 62}, extent = {{-10, -10}, {10, 10}})));
  Modelica.Fluid.Vessels.BaseClasses.VesselFluidPorts_b ports[nports](redeclare each package Medium = MediumAir) annotation(
    Placement(transformation(origin = {35, 4}, extent = {{-21, -8}, {21, 8}}), iconTransformation(origin = {-39.7368, 0.818182}, extent = {{-21.1818, -12.2632}, {21.1818, 12.2632}}, rotation = -90)));
equation
  connect(HeatFlow.port, VolumeMoistAir.heatPort) annotation(
    Line(points = {{4, 50}, {11, 50}, {11, 54}, {28, 54}}, color = {191, 0, 0}));
  connect(DataTable.y[2], HeatFlow.Q_flow) annotation(
    Line(points = {{-33, 62}, {-33, 50}, {-16, 50}}, color = {0, 0, 127}));
 connect(DataTable.y[1], VolumeMoistAir.mWat_flow) annotation(
    Line(points = {{-33, 62}, {26, 62}}, color = {0, 0, 127}));
  connect(VolumeMoistAir.ports, ports) annotation(
    Line(points = {{38, 44}, {30, 44}, {30, 6}, {34.5, 6}, {34.5, 4}, {35, 4}}, color = {0, 127, 255}));
  annotation(
    Diagram(coordinateSystem(extent = {{-60, 80}, {120, 0}})),
    Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(origin = {2, -1}, extent = {{-54, 47}, {54, -47}}), Line(origin = {1.99477, 62.4348}, points = {{-53.9948, -16.7353}, {-1.99477, 17.2647}, {54.0052, -16.7353}, {54.0052, -16.7353}})}));

end RoomTest31;