Skip to content

Commit

Permalink
Merge pull request #1345 from kldjonge/project_itz_fixes_v2_kdj
Browse files Browse the repository at this point in the history
KDJ fixes for Project itz fixes v2
  • Loading branch information
jelgerjansen authored Feb 20, 2024
2 parents 84f8eb2 + 0b3d875 commit 82c6d3a
Show file tree
Hide file tree
Showing 13 changed files with 328 additions and 58 deletions.
2 changes: 1 addition & 1 deletion IDEAS/Airflow/Multizone/BaseClasses/DoorDiscretized.mo
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ partial model DoorDiscretized
Modelica.Units.SI.Velocity vBot "Velocity at bottom of opening from A to B";

protected
parameter Modelica.Units.SI.Length dh=hOpe/nCom "Height of each compartment";
parameter Modelica.Units.SI.Length dh=hOpeVert/nCom "Height of each compartment";

parameter Medium.ThermodynamicState sta_default=Medium.setState_pTX(
T=Medium.T_default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ partial model TwoWayFlowElementBuoyancy
parameter Modelica.Units.SI.Length hOpe=2.1 "Height of opening"
annotation (Dialog(group="Geometry"));

parameter Modelica.Units.SI.Angle inc=Modelica.Constants.pi/2 "inclination angle (vertical=pi/2)";
final parameter Modelica.Units.SI.Length hOpeVert=sin(inc)*hOpe "Height of opening projected to the vertical plane";

parameter Modelica.Units.SI.Length hA=2.7/2
"Height of reference pressure zone A" annotation (Dialog(group="Geometry"));
parameter Modelica.Units.SI.Length hB=2.7/2
Expand Down
55 changes: 32 additions & 23 deletions IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,40 @@ model CrackOrOperableDoor

parameter BoundaryConditions.Types.InterZonalAirFlow interZonalAirFlowType
"Interzonal air flow type";
parameter Modelica.Units.SI.PressureDifference dpCloRat(
min=0,
displayUnit="Pa") = 50 "Pressure drop at rating condition of closed door"
final parameter Modelica.Units.SI.PressureDifference dpCloRat(displayUnit="Pa")=50
"Pressure drop at rating condition of closed door"
annotation (Dialog(group="Rating conditions"));

parameter Modelica.Units.SI.Length h_b1 "Height at port b1";
parameter Modelica.Units.SI.Length h_b2 = 0 "Height at port b2";
parameter Modelica.Units.SI.Length h_a1 = 0 "Height at port a1";
parameter Modelica.Units.SI.Length h_a2 "Height at port a2";
parameter Modelica.Units.SI.Length h_b1 "Height at port b1 (hasCavity=false)";
parameter Modelica.Units.SI.Length h_b2 = 0 "Height at port b2(hasCavity=false)";
parameter Modelica.Units.SI.Length h_a1 = 0 "Height at port a1(hasCavity=false)";
parameter Modelica.Units.SI.Length h_a2 "Height at port a2(hasCavity=false)";

parameter SI.Length hA=(h_a1 + h_b2)/2
"Height of reference pressure at port a1 for opening (hasCavity=true) model";
parameter SI.Length hB=(h_a2 + h_b1)/2
"Height of reference pressure at port b1 for opening (hasCavity=true) model";

parameter Real CDCloRat(min=0, max=1)=1
final parameter Real CDCloRat(min=0, max=1)=1
"Discharge coefficient at rating conditions of closed door"
annotation (Dialog(group="Rating conditions"));
parameter Modelica.Units.SI.Area A_q50 "Surface area for leakage computation (closed door)";
parameter Real q50(unit="m3/(h.m2)") "Surface air tightness";

parameter Modelica.Units.SI.Area LClo(min=0) = q50*A_q50*1.2/3600 *(1.2/2/dpCloRat)^mClo/CDClo
"Effective leakage area of closed door"
annotation (Dialog(group="Closed door"));
final parameter Modelica.Units.SI.Area LClo(min=0) = ((q50*A_q50/3600)/(dpCloRat)^mClo)/(((dpCloRat)^(0.5-mClo))*sqrt(2/1.2041))
"Effective leakage area of internal wall (when door is fully closed)"
annotation (Dialog(group="Crack or Closed door"));

parameter Real CDOpe=0.65 "Discharge coefficient of open door"
parameter Real CDOpe=0.78 "Discharge coefficient of open door"
annotation (Dialog(group="Open door"));
parameter Real CDClo=0.65 "Discharge coefficient of closed door"
annotation (Dialog(group="Closed door"));


parameter Real mOpe = 0.5 "Flow exponent for door of open door"
annotation (Dialog(group="Open door"));
parameter Real mClo= 0.65 "Flow exponent for crack of closed door"
annotation (Dialog(group="Closed door"));
parameter Real mClo= 0.65 "Flow exponent for crack or crack of closed door"
annotation (Dialog(group="Crack or Closed door"));

parameter Integer nCom=if abs(hOpe)<Modelica.Constants.small then 2 else 4 "Number of compartments for the discretization";
parameter Integer nCom=if abs(hOpe*sin(inc)) < 0.01 then 2 else max(2,integer(abs(hOpe*sin(inc))/4)) "Number of compartments for the discretization";

parameter Boolean useDoor = false "=true, to use operable door instead of a crack";
parameter Boolean use_y = true "=true, to use control input";
Expand All @@ -74,7 +77,10 @@ model CrackOrOperableDoor
redeclare package Medium = Medium,
dpMea_nominal = dpCloRat,
forceErrorControlOnFlow = false,
mMea_flow_nominal = if openDoorOnePort and interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.OnePort then wOpe*hOpe*1.2*CDClo*(2*dpCloRat/1.2)^mClo else (if interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts then LClo/2 else LClo)*CDClo*(2*dpCloRat/1.2)^mClo,
mMea_flow_nominal=if openDoorOnePort and interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.OnePort
then wOpe*hOpe*1.2*CDCloRat*(2*dpCloRat/1.2)^mClo else (if
interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts
then 0.5 else 1)*(q50/3600*1.2041)*A_q50,
m = if openDoorOnePort and interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.OnePort then mOpe else mClo,
useDefaultProperties = false) if not useDoor or (useDoor and interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.OnePort) "Pressure drop equation" annotation (
Placement(visible = true, transformation(origin = {0, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Expand All @@ -91,18 +97,18 @@ model CrackOrOperableDoor
dpMea_nominal = dpCloRat,
forceErrorControlOnFlow = false,
m = mClo,
mMea_flow_nominal = LClo/2*CDClo*(2*dpCloRat/1.2)^mClo,
mMea_flow_nominal = (q50/3600*1.2041)*A_q50*0.5,
useDefaultProperties = false) if not useDoor and interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts "Pressure drop equation" annotation (
Placement(visible = true, transformation(origin = {0, -60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
IDEAS.Airflow.Multizone.DoorDiscretizedOperable doo(
redeclare package Medium = Medium,
final hA = (h_a1+h_b2)/2,
final hB = (h_a2+h_b1)/2,
final forceErrorControlOnFlow=false,
inc=inc,
final hA=hA,
final hB=hB,
dp_turbulent=dp_turbulent,
nCom=nCom,
CDOpe=CDOpe,
CDClo=CDClo,
CDClo=CDCloRat,
mOpe=mOpe,
mClo=mClo,
CDCloRat=CDCloRat,
Expand All @@ -122,6 +128,9 @@ model CrackOrOperableDoor
if not use_y
"Door constantly opened" annotation (
Placement(visible = true, transformation(origin = {-54, -14}, extent = {{-6, -6}, {6, 6}}, rotation = 0)));

parameter SI.Angle inc=Modelica.Constants.pi/2
"inclination angle (vertical=pi/2)";
initial equation
assert( not (interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts and useDoor and use_y),
"In " +getInstanceName() + ": Cannot use a controllable door unless interZonalAirFlowType == TwoPorts.");
Expand Down
3 changes: 3 additions & 0 deletions IDEAS/BoundaryConditions/Interfaces/PartialSimInfoManager.mo
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ partial model PartialSimInfoManager
annotation(Dialog(enable=interZonalAirFlowType<>
IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None or unify_n50,group="Interzonal airflow"));

parameter Boolean use_sim_Cs =true "if checked, the default Cs of each surface in the building is sim.Cs"
annotation(choices(checkBox=true),Dialog(group="Wind"));

parameter Modelica.Units.SI.Length H=10 "Building or roof height"
annotation (Dialog(group="Wind"));
parameter Real A0=0.6 "Local terrain constant. 0.6 for Suburban,0.35 for Urban and 1 for Unshielded (Ashrae 1993) "
Expand Down
7 changes: 4 additions & 3 deletions IDEAS/Buildings/Components/Interfaces/PartialSurface.mo
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@ partial model PartialSurface "Partial model for building envelope component"
redeclare package Medium = Medium,
h_a1=0.25*hVertical,
h_b2=- 0.25*hVertical,
h_b1 = 0.75*hVertical + hRelSurfBot_a,
h_a2 = 0.25*hVertical + hRelSurfBot_a,
interZonalAirFlowType = sim.interZonalAirFlowType) if add_door and sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None annotation(
h_b1=-0.5*hzone_a + 0.75*hVertical + hRelSurfBot_a,
h_a2=-0.5*hzone_a + 0.25*hVertical + hRelSurfBot_a,
interZonalAirFlowType = sim.interZonalAirFlowType,
inc=inc) if add_door and sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None annotation (
Placement(visible = true, transformation(origin = {30, -52}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.RealExpression AExp(y = A) "Area expression" annotation(
Placement(transformation(origin = {0, 20}, extent = {{-10, -10}, {10, 10}})));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ within IDEAS.Buildings.Components.Interfaces;
partial model RectangularZoneTemplateInterface
"Rectangular zone including walls, floor and ceiling"
extends IDEAS.Buildings.Components.Interfaces.PartialZone(
redeclare replaceable package Medium = IDEAS.Media.Air,
calculateViewFactor=false,
final nSurf=indWinCei+nSurfExt,
final V=A*h,
Expand Down
19 changes: 14 additions & 5 deletions IDEAS/Buildings/Components/InternalWall.mo
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ model InternalWall "interior opaque wall between two zones"
final QTra_design = U_value*A*(TRef_a - TRef_b),
q50_zone(v50_surf = 0),
crackOrOperableDoor(
h_a1=-0.5*hzone_b + 0.75*hVertical + hRelSurfBot_b,
h_b2=-0.5*hzone_b + 0.25*hVertical + hRelSurfBot_b,
hA=0.5*hzone_b - hRelSurfBot_b - hRelOpeBot_b,
hB=0.5*hzone_a - hRelSurfBot_a - hRelOpeBot_a,
openDoorOnePort=true,
useDoor=hasCavity,
use_y=use_y_doo,
wOpe=w,
hOpe=h,
CDOpe=CD,
h_a1=-0.5*hzone_b + 0.25*hVertical + hRef_b,
h_b2=-0.5*hzone_b + 0.75*hVertical + hRef_b));
CDOpe=CD));
//using custom q50 since this model is not an external component
parameter Boolean linIntCon_b = sim.linIntCon
"= true, if convective heat transfer should be linearised" annotation(
Expand All @@ -39,6 +41,9 @@ model InternalWall "interior opaque wall between two zones"
parameter Modelica.Units.SI.Length w = 1
"Width of (rectangular) cavity in wall"
annotation(Dialog(enable=hasCavity,group="Cavity or open door"));

parameter Modelica.Units.SI.Length hRelOpeBot_a=0 "Vertical distance at propsbus a between the bottom of the surface that contains an (operable) opening and the bottom of the opening" annotation(Dialog(group="Cavity or open door"));
parameter Modelica.Units.SI.Length hRelOpeBot_b=0 "Vertical distance at propsbus b between the bottom of the surface that contains an (operable) opening and the bottom of the opening" annotation(Dialog(group="Cavity or open door"));
parameter Modelica.Units.SI.Acceleration g = Modelica.Constants.g_n
"Gravity, for computation of buoyancy"
annotation(Dialog(enable=hasCavity,group="Cavity or open door",tab="Advanced"));
Expand Down Expand Up @@ -75,13 +80,17 @@ model InternalWall "interior opaque wall between two zones"
annotation(Dialog(group="Cavity or open door",tab="Advanced"));
final parameter Real hzone_b(fixed=false);
final parameter Real hfloor_b(fixed=false);
parameter Real hRef_b=if IDEAS.Utilities.Math.Functions.isAngle(inc, Modelica.Constants.pi) then hzone_b else 0


parameter Modelica.Units.SI.Length hRelSurfBot_b=if
IDEAS.Utilities.Math.Functions.isAngle(inc, IDEAS.Types.Tilt.Floor)
then hzone_b else 0
"Height above the zone floor at propsbus_b. Height where the surface starts. e.g. 0 for walls at floor level and floors. ";
Modelica.Blocks.Interfaces.RealInput y_doo(min = 0, max = 1) if use_y_doo and useDooOpe
"Control input for the door" annotation(
Placement(visible = true, transformation(origin = {-80, 90}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-64, 88}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
protected
parameter Real Ope_hvert = sin(inc)*h "Vertical opening height, height of the surface projected to the vertical, 0 for openings in horizontal floors and ceilings" annotation(
parameter Real Ope_hvert = sin(inc)*h "Vertical opening height, height of the surface projected to the vertical, 0 for openings in horizontal floors and ceilings" annotation (
Dialog(enable=hasCavity,group="Cavity or open door"));
final parameter Real U_value = 1/(1/8 + sum(constructionType.mats.R) + 1/8) "Wall U-value";
constant Real r = 287 "Gas constant";
Expand Down
13 changes: 8 additions & 5 deletions IDEAS/Buildings/Components/OuterWall.mo
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ model OuterWall "Opaque building envelope construction"
parameter Boolean use_custom_Cs = false
"if checked, Cs will be used instead of the default related to the interzonal airflow type "
annotation(Evaluate=true, choices(checkBox=true),Dialog(enable=true,tab="Airflow", group="Wind Pressure"));

parameter Boolean use_sim_Cs =sim.use_sim_Cs "if checked, the default Cs of each surface in the building is sim.Cs"
annotation(choices(checkBox=true),Dialog(enable=not use_custom_Cs,tab="Airflow", group="Wind Pressure"));

parameter Real Cs=sim.Cs
"Wind speed modifier"
annotation (Dialog(enable=use_custom_Cs,tab="Airflow", group="Wind Pressure"));
Expand Down Expand Up @@ -104,11 +108,10 @@ protected
final table=coeffsCp,
final azi=aziInt,
Cs=if not use_custom_Cs and sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts
then sim.Cs_coeff*(Habs^(2*sim.a))
elseif not use_custom_Cs
then sim.Cs
else Cs,
Habs=Habs,
and not use_sim_Cs then sim.Cs_coeff*(Habs^(2*sim.a)) elseif not
use_custom_Cs then sim.Cs else Cs,
Habs=if sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts
then Habs else sim.HPres,
nPorts=if sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.OnePort
then 1 else 2)
if sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None
Expand Down
118 changes: 118 additions & 0 deletions IDEAS/Buildings/Components/Validations/AirflowBoxModel.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
within IDEAS.Buildings.Components.Validations;
model AirflowBoxModel
extends Modelica.Icons.Example;


Box_Sim Energy_Only(sim(interZonalAirFlowType=IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None)) annotation (Placement(transformation(rotation=0, extent={{-82,18},{-22,78}})));
Box_Sim Energy_n50Corr(sim(interZonalAirFlowType=IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None, unify_n50=true)) annotation (Placement(transformation(rotation=0,
extent={{20,20},{80,80}})));
Box_Sim IAQ_1port(sim(interZonalAirFlowType=IDEAS.BoundaryConditions.Types.InterZonalAirFlow.OnePort), winD(
use_trickle_vent=true,
m_flow_nominal=50*1.2041/3600,
dp_nominal=2)) annotation (Placement(transformation(rotation=0,extent={{-80,-80},{-20,-20}})));
Box_Sim IAQ_2Port(sim(interZonalAirFlowType=IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts),
use_operable_window=true,
winD(crackOrOperableDoor(nCom=2),
use_trickle_vent=true,
m_flow_nominal=50*1.2041/3600,
dp_nominal=2),
winD_position(y=1),
Con(G=10000000),
Rad(G=10000000)) annotation (Placement(transformation(rotation=0,
extent={{20,-80},{80,-20}})));
protected
model Box_Sim
inner BoundaryConditions.SimInfoManager sim(interZonalAirFlowType=IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts,
n50=1)
annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
parameter Boolean use_operable_window=false
"= true, to enable window control input";

RectangularZoneTemplate BoxModel(
T_start=291.15,
bouTypA=IDEAS.Buildings.Components.Interfaces.BoundaryType.OuterWall,
bouTypB=IDEAS.Buildings.Components.Interfaces.BoundaryType.OuterWall,
bouTypC=IDEAS.Buildings.Components.Interfaces.BoundaryType.OuterWall,
bouTypD=IDEAS.Buildings.Components.Interfaces.BoundaryType.External,
bouTypFlo=IDEAS.Buildings.Components.Interfaces.BoundaryType.BoundaryWall,
bouTypCei=IDEAS.Buildings.Components.Interfaces.BoundaryType.OuterWall,
nExtD=2,
hasWinC=true,
aziOpt=3,
l=5,
w=5,
h=5,
A_winA=2,
A_winB=2,
A_winC=2,
A_winD=2,
h_winA=2,
h_winB=2,
h_winC=2,
h_winD=2,
redeclare IDEAS.Buildings.Validation.Data.Constructions.LightRoof
conTypCei,
redeclare IDEAS.Buildings.Data.Constructions.FloorOnGround conTypFlo,
redeclare IDEAS.Buildings.Data.Glazing.Ins2Ar2020 glazingC,
redeclare IDEAS.Buildings.Data.Frames.AluminumInsulated fraTypC)
annotation (Placement(transformation(extent={{-80,40},{-60,60}})));

Modelica.Thermal.HeatTransfer.Components.ThermalConductor Con(G=100000)
annotation (Placement(transformation(extent={{-40,52},{-20,72}})));
Modelica.Thermal.HeatTransfer.Celsius.FixedTemperature fixedTemperature(T=
18) annotation (Placement(transformation(extent={{20,40},{0,60}})));
Modelica.Thermal.HeatTransfer.Components.ThermalConductor Rad(G=100000)
annotation (Placement(transformation(extent={{-40,26},{-20,46}})));
OuterWall outD(
redeclare IDEAS.Buildings.Data.Constructions.CavityWall constructionType,
incOpt=1,
aziOpt=2,
A=23) annotation (Placement(transformation(extent={{-106,46},{-94,66}})));
Window winD(
redeclare IDEAS.Buildings.Data.Glazing.Ins2Ar2020 glazing,
A=2,
hWin=2,
redeclare IDEAS.Buildings.Data.Frames.AluminumInsulated fraType,
use_operable_window=use_operable_window)
annotation (Placement(transformation(extent={{-106,22},{-94,42}})));
Modelica.Blocks.Sources.RealExpression winD_position(y=0) if use_operable_window
annotation (Placement(transformation(extent={{-140,0},{-120,20}})));

equation
connect(BoxModel.gainCon, Con.port_a) annotation (Line(points={{-60,47},{
-46,47},{-46,62},{-40,62}}, color={191,0,0}));
connect(fixedTemperature.port, Con.port_b) annotation (Line(points={{0,50},
{-14,50},{-14,62},{-20,62}}, color={191,0,0}));
connect(BoxModel.gainRad, Rad.port_a) annotation (Line(points={{-60,44},{
-46,44},{-46,36},{-40,36}}, color={191,0,0}));
connect(Rad.port_b, fixedTemperature.port) annotation (Line(points={{-20,36},
{-14,36},{-14,50},{0,50}}, color={191,0,0}));
connect(outD.propsBus_a, BoxModel.proBusD[1]) annotation (Line(
points={{-95,58},{-88,58},{-88,42.5},{-79.6,42.5}},
color={255,204,51},
thickness=0.5));
connect(winD.propsBus_a, BoxModel.proBusD[2]) annotation (Line(
points={{-95,34},{-88,34},{-88,43.5},{-79.6,43.5}},
color={255,204,51},
thickness=0.5));
connect(winD_position.y, winD.y_window)
annotation (Line(points={{-119,10},{-102,10},{-102,22}}, color={0,0,127}));
annotation (Icon(graphics={Rectangle(
extent={{-60,60},{60,-60}},
lineColor={28,108,200},
fillColor={215,215,215},
fillPattern=FillPattern.Solid), Text(
extent={{-100,-60},{98,-100}},
textColor={28,108,200},
textString="%name")}));
end Box_Sim;
annotation (experiment(
StopTime=1209600,
Interval=3600.00288,
Tolerance=1e-07,
__Dymola_fixedstepsize=15,
__Dymola_Algorithm="Dassl"), Documentation(info="<html>
This model runs the 4 possible interzonal airflow configurations of a simple box model. Temperature is kept constant at 18° degrees
</html>"));
end AirflowBoxModel;
Loading

0 comments on commit 82c6d3a

Please sign in to comment.