Skip to content

Commit

Permalink
added cardinality check on zone.ports for #1029
Browse files Browse the repository at this point in the history
removed icons of port_a and port_b
  • Loading branch information
Mathadon committed Mar 30, 2020
1 parent fde1f58 commit d154428
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
6 changes: 4 additions & 2 deletions IDEAS/Buildings/Components/Interfaces/PartialZone.mo
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ equation
through the zone to/from the surroundings, at ambient temperature.
This may be unintended.", AssertionLevel.warning);
end if;


for i in 1:nSurf loop
connect(sim.weaBus, propsBusInt[i].weaBus) annotation (Line(
points={{-81,93},{-81,92},{-80,92},{-80,66},{-80.1,66},{-80.1,39.9}},
Expand Down Expand Up @@ -389,9 +391,9 @@ end for;
connect(interzonalAirFlow.ports, airModel.ports) annotation (Line(points={{
-29.8,60},{-30,60},{-30,40}}, color={0,127,255}));
connect(interzonalAirFlow.port_b_exterior, port_b) annotation (Line(points={{-36,80},
{-36,92},{-40,92},{-40,100}}, color={0,127,255}));
{-36,92},{-60,92},{-60,100}}, color={0,127,255}));
connect(interzonalAirFlow.port_a_exterior, port_a) annotation (Line(points={{-24,80},
{-24,84},{40,84},{40,100}}, color={0,127,255}));
{-24,84},{60,84},{60,100}}, color={0,127,255}));
connect(ppm, airModel.ppm) annotation (Line(points={{110,0},{52,0},{52,16},{-8,
16},{-8,28},{-19,28}}, color={0,0,127}));
connect(intGaiLig.portRad, gainRad) annotation (Line(points={{20,60},{4,60},{4,
Expand Down
19 changes: 13 additions & 6 deletions IDEAS/Buildings/Components/Interfaces/ZoneInterface.mo
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ partial model ZoneInterface "Partial model for thermal building zones"
"Sensor temperature of the zone, i.e. operative temeprature" annotation (
Placement(transformation(extent={{100,10},{120,30}}), iconTransformation(
extent={{100,10},{120,30}})));

// icons removed to discourage the use of these ports
Modelica.Fluid.Interfaces.FluidPort_b port_b(
redeclare package Medium = Medium,
m_flow(nominal=m_flow_nominal),
h_outflow(nominal=Medium.h_default))
"Port for ventilation connetions, deprecated, use 'ports' instead"
annotation (Placement(transformation(extent={{-70,90},{-50,110}})));
"Port for ventilation connections, deprecated, use 'ports' instead";
Modelica.Fluid.Interfaces.FluidPort_a port_a(
redeclare package Medium = Medium,
m_flow(nominal=m_flow_nominal),
h_outflow(nominal=Medium.h_default))
"Port for ventilation connetions, deprecated, use 'ports' instead"
annotation (Placement(transformation(extent={{50,90},{70,110}})));
"Port for ventilation connections, deprecated, use 'ports' instead";
Modelica.Blocks.Interfaces.RealInput yOcc if useOccNumInput
"Control input for number of occupants, used by Occupants.Input and Occupants.AreaWeightedInput"
annotation (Placement(transformation(extent={{140,20},{100,60}})));
Expand Down Expand Up @@ -84,10 +84,17 @@ initial equation
assert(nSurf>1, "In " + getInstanceName() +
": A minimum of 2 surfaces must be connected to the zone.");
assert(cardinality(port_a)+cardinality(port_b)==2, "In " + getInstanceName() +
": You have made connections to port_a or port_b. These connections will be
": You have made connections to port_a or port_b. These connectors will be
removed in a future release of IDEAS. Use the connector `ports' instead.",
AssertionLevel.warning);

for i in 1:nPorts loop
assert(cardinality(ports[i])<=2,
"Each element of ports should have zero or one external connections but " +
getInstanceName() +".ports[" + String(i) + "] has " + String(cardinality(ports[i]) - 1) + "." +
" This can cause air to mix at the fluid port, without entering the zone, which is usually unintended.
Instead, increase nPorts and create a separate connection.",
level=AssertionLevel.warning);
end for;
equation
connect(sim.Qgai, dummy1);
connect(sim.E, dummy2);
Expand Down

0 comments on commit d154428

Please sign in to comment.