Skip to content

Commit

Permalink
make reverse models conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
FWuellhorst committed Jan 11, 2024
1 parent 22b9281 commit b3f932a
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ model RefrigerantCycle "Refrigerant cycle model of a chiller"
extends
IBPSA.Fluid.HeatPumps.ModularReversible.BaseClasses.PartialModularRefrigerantCycle;
replaceable model RefrigerantCycleChillerCooling =
IBPSA.Fluid.Chillers.ModularReversible.RefrigerantCycle.BaseClasses.NoCooling(
useInChi=true)
IBPSA.Fluid.Chillers.ModularReversible.RefrigerantCycle.BaseClasses.NoCooling
( useInChi=true)
constrainedby
IBPSA.Fluid.Chillers.ModularReversible.RefrigerantCycle.BaseClasses.PartialChillerCycle
"Replaceable model for refrigerant cycle of a chiller in main operation mode"
annotation (choicesAllMatching=true);

replaceable model RefrigerantCycleChillerHeating =
IBPSA.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.NoHeating(
useInHeaPum=true)
IBPSA.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.NoHeating
( useInHeaPum=true)
constrainedby
IBPSA.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.PartialHeatPumpCycle
"Replaceable model for refrigerant cycle of a chiller in reversed operation mode"
Expand All @@ -21,7 +21,7 @@ model RefrigerantCycle "Refrigerant cycle model of a chiller"
RefrigerantCycleChillerCooling refCycChiCoo
"Refrigerant cycle instance for cooling"
annotation (Placement(transformation(extent={{21,40},{60,80}}, rotation=0)));
RefrigerantCycleChillerHeating refCycChiHea
RefrigerantCycleChillerHeating refCycChiHea if use_rev
"Refrigerant cycle instance for heating"
annotation (Placement(transformation(extent={{-60,38},{-19,80}}, rotation=0)));

Expand Down Expand Up @@ -88,6 +88,18 @@ equation
36.25},{-53.1667,-8},{-58,-8}}, color={0,0,127}));
connect(refCycChiHea.QEva_flow, swiQCon.u3) annotation (Line(points={{-25.8333,
36.25},{-25.8333,-8},{58,-8}}, color={0,0,127}));
connect(QEva_flow, refCycChiCoo.QEva_flow) annotation (Line(
points={{-110,0},{-90,0},{-90,24},{54,24},{54,38.3333},{53.5,38.3333}},
color={0,0,127},
pattern=LinePattern.Dash));
connect(refCycChiCoo.QCon_flow, QCon_flow) annotation (Line(
points={{27.5,38.3333},{27.5,20},{92,20},{92,0},{110,0}},
color={0,0,127},
pattern=LinePattern.Dash));
connect(refCycChiCoo.PEle, PEle) annotation (Line(
points={{40.5,38.3333},{40.5,-90},{0,-90},{0,-110.5},{0.5,-110.5}},
color={0,0,127},
pattern=LinePattern.Dash));
annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={
Rectangle(
extent={{-100,100},{100,-100}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ partial model PartialModularRefrigerantCycle
Modelica.Blocks.Logical.Switch swiQEva(
u1(final unit="W", final displayUnit="kW"),
u3(final unit="W", final displayUnit="kW"),
y(final unit="W", final displayUnit="kW"))
y(final unit="W", final displayUnit="kW")) if use_rev
"Routing block that picks the component acting as evaporator"
annotation (Placement(transformation(extent={{-60,-10},{-80,10}})));
Modelica.Blocks.Logical.Switch swiQCon(
y(final unit="W", final displayUnit="kW"),
u1(final unit="W", final displayUnit="kW"),
u3(final unit="W", final displayUnit="kW"))
u3(final unit="W", final displayUnit="kW")) if use_rev
"Routing block that picks the component acting as condenser"
annotation (Placement(transformation(extent={{60,-10},{80,10}})));
Modelica.Blocks.Interfaces.RealOutput PEle(final unit="W", final displayUnit="kW")
Expand All @@ -40,7 +40,7 @@ partial model PartialModularRefrigerantCycle
Modelica.Blocks.Logical.Switch swiPEle(
u1(final unit="W", final displayUnit="kW"),
u3(final unit="W", final displayUnit="kW"),
y(final unit="W", final displayUnit="kW"))
y(final unit="W", final displayUnit="kW")) if use_rev
"Whether to use cooling or heating power output" annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
within IBPSA.Fluid.HeatPumps.ModularReversible.BaseClasses;
model RefrigerantCycle
"Refrigerant cycle model of a heat pump"
extends IBPSA.Fluid.HeatPumps.ModularReversible.BaseClasses.PartialModularRefrigerantCycle;
extends
IBPSA.Fluid.HeatPumps.ModularReversible.BaseClasses.PartialModularRefrigerantCycle;
replaceable model RefrigerantCycleHeatPumpHeating =
IBPSA.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.NoHeating(
useInHeaPum=true)
IBPSA.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.NoHeating
( useInHeaPum=true)
constrainedby
IBPSA.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.PartialHeatPumpCycle
"Replaceable model for refrigerant cycle of a heat pump in main operation mode"
annotation (choicesAllMatching=true);

replaceable model RefrigerantCycleHeatPumpCooling =
IBPSA.Fluid.Chillers.ModularReversible.RefrigerantCycle.BaseClasses.NoCooling(
useInChi=true)
IBPSA.Fluid.Chillers.ModularReversible.RefrigerantCycle.BaseClasses.NoCooling
( useInChi=true)
constrainedby
IBPSA.Fluid.Chillers.ModularReversible.RefrigerantCycle.BaseClasses.PartialChillerCycle
"Replaceable model for refrigerant cycle of a heat pump in reversed operation mode"
Expand All @@ -21,7 +22,7 @@ model RefrigerantCycle
RefrigerantCycleHeatPumpHeating refCycHeaPumHea
"Refrigerant cycle instance for heating"
annotation (Placement(transformation(extent={{20,40},{60,80}}, rotation=0)));
RefrigerantCycleHeatPumpCooling refCycHeaPumCoo
RefrigerantCycleHeatPumpCooling refCycHeaPumCoo if use_rev
"Refrigerant cycle instance for cooling"
annotation (Placement(transformation(extent={{-60,40},{-19,80}}, rotation=0)));
protected
Expand Down Expand Up @@ -71,10 +72,10 @@ equation
index=1,
extent={{6,3},{6,3}},
horizontalAlignment=TextAlignment.Left));
connect(refCycHeaPumHea.QCon_flow, swiQCon.u1) annotation (Line(points={{
26.6667,38.3333},{26.6667,8},{58,8}}, color={0,0,127}));
connect(refCycHeaPumHea.QEva_flow, swiQEva.u1) annotation (Line(points={{
53.3333,38.3333},{53.3333,28},{-12,28},{-12,8},{-58,8}}, color={0,0,127}));
connect(refCycHeaPumHea.QCon_flow, swiQCon.u1) annotation (Line(points={{26.6667,
38.3333},{26.6667,8},{58,8}}, color={0,0,127}));
connect(refCycHeaPumHea.QEva_flow, swiQEva.u1) annotation (Line(points={{53.3333,
38.3333},{53.3333,28},{-12,28},{-12,8},{-58,8}}, color={0,0,127}));
connect(refCycHeaPumCoo.QEva_flow, swiQCon.u3) annotation (Line(points={{
-25.8333,38.3333},{-25.8333,-8},{58,-8}}, color={0,0,127}));
connect(refCycHeaPumCoo.QCon_flow, swiQEva.u3) annotation (Line(points={{
Expand All @@ -83,6 +84,18 @@ equation
38.3333},{-39.5,-48},{-8,-48},{-8,-58}}, color={0,0,127}));
connect(refCycHeaPumHea.PEle, swiPEle.u1) annotation (Line(points={{40,38.3333},
{40,-48},{8,-48},{8,-58}}, color={0,0,127}));
connect(refCycHeaPumHea.QCon_flow, QCon_flow) annotation (Line(
points={{26.6667,38.3333},{26.6667,22},{92,22},{92,0},{110,0}},
color={0,0,127},
pattern=LinePattern.Dash));
connect(refCycHeaPumHea.QEva_flow, QEva_flow) annotation (Line(
points={{53.3333,38.3333},{53.3333,28},{-90,28},{-90,0},{-110,0}},
color={0,0,127},
pattern=LinePattern.Dash));
connect(refCycHeaPumHea.PEle, PEle) annotation (Line(
points={{40,38.3333},{40,-86},{0.5,-86},{0.5,-110.5}},
color={0,0,127},
pattern=LinePattern.Dash));
annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={
Ellipse(
extent={{-24,88},{22,44}},
Expand Down

0 comments on commit b3f932a

Please sign in to comment.