Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue615 enhance hp model #630

Merged
merged 11 commits into from
Oct 11, 2018
3 changes: 2 additions & 1 deletion AixLib/Controls/HeatPump/HPControl.mo
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ model HPControl

TSetToNSet ConvTSetToNSet annotation (Placement(transformation(extent={{44,-8},
{76,26}})));
Modelica.Blocks.Routing.RealPassThrough realPasThrAntLeg "No Anti Legionella"
Modelica.Blocks.Routing.RealPassThrough realPasThrAntLeg if not use_antLeg
"No Anti Legionella"
annotation (
choicesAllMatching=true, Placement(
transformation(extent={{-10,38},{6,54}})));
Expand Down
4 changes: 4 additions & 0 deletions AixLib/Controls/HeatPump/SecurityControls/AntiFreeze.mo
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@ equation
extent={{-6,3},{-6,3}},
horizontalAlignment=TextAlignment.Right));

connect(greaterThreshold.y, not1.u) annotation (Line(points={{-34.7,-7},{-21,
-7},{-21,-63}}, color={255,0,255}));
connect(booConAntFre.y, not1.u) annotation (Line(points={{16.7,-29},{36,-29},
{36,-56},{-22,-56},{-22,-60},{-21,-63}}, color={255,0,255}));
end AntiFreeze;
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@ block BoundaryMap
0,
2) "Table matrix (grid = first column; e.g., table=[0,2])"
annotation (Dialog(enable=not use_opeEnvFroRec));

Modelica.Blocks.Interfaces.BooleanOutput noErr
Modelica.Blocks.Interfaces.BooleanOutput noErr
"If an error occurs, this will be false"
annotation (Placement(transformation(extent={{100,-10},{120,10}})));
Modelica.Blocks.Interfaces.RealInput x_in "Current value of x-Axis"
annotation (Placement(transformation(extent={{-128,46},{-100,74}})));
Modelica.Blocks.Interfaces.RealInput y_in "Current value on y-Axis"
annotation (Placement(transformation(extent={{-128,-74},{-100,-46}})));

Modelica.Blocks.Tables.CombiTable1Ds uppCombiTable1Ds(final table=tableUpp_internal, smoothness=
Modelica.Blocks.Tables.CombiTable1Ds uppCombiTable1Ds(final table=tableUpp, smoothness=
Modelica.Blocks.Types.Smoothness.LinearSegments)
annotation (Placement(transformation(extent={{-52,50},{-32,70}})));
Modelica.Blocks.Tables.CombiTable1Ds lowCombiTable1Ds(final smoothness=Modelica.Blocks.Types.Smoothness.LinearSegments,
table=tableLow_internal)
table=tableLow)
annotation (Placement(transformation(extent={{-52,16},{-32,36}})));
Modelica.Blocks.MathBoolean.Nor
nor1(
Expand All @@ -47,19 +46,32 @@ block BoundaryMap
annotation (Placement(transformation(extent={{-50,-46},{-38,-34}})));
Modelica.Blocks.Sources.Constant conXMax(k=xMax)
annotation (Placement(transformation(extent={{-50,-76},{-38,-64}})));

protected
parameter Real tableLow_internal[:,2] = if use_opeEnvFroRec then dataTable.tableLowBou else tableLow;
parameter Real tableUpp_internal[:,2] = if use_opeEnvFroRec then dataTable.tableUppBou else tableUpp;
parameter Real xMax=min(tableLow_internal[end, 1], tableUpp_internal[end, 1])
"Minimal value of lower and upper table data";
parameter Real xMin=max(tableLow_internal[1, 1], tableUpp_internal[1, 1])
"Maximal value of lower and upper table data";
parameter Real yMax=max(tableUpp_internal[:, 2])
"Minimal value of lower and upper table data";
parameter Real yMin=min(tableLow_internal[:, 2])
"Maximal value of lower and upper table data";
final Real[size(scaledX, 1), 2] points=transpose({unScaledX,unScaledY}) annotation(Hide=false);
Real tableMerge[:,2] = [tableLow_internal[1,1],tableLow_internal[1,2];tableUpp_internal;[Modelica.Math.Vectors.reverse(tableLow_internal[:,1]),Modelica.Math.Vectors.reverse(tableLow_internal[:,2])]];
input Real scaledX[:] = tableMerge[:,1];
input Real scaledY[:] = tableMerge[:,2];
Real unScaledX[size(scaledX, 1)](min=-100, max=100);
Real unScaledY[size(scaledX, 1)](min=-100, max=100);
Real iconMin = -70;
Real iconMax = 70;
initial equation
assert(tableLow_internal[end,1]==tableUpp_internal[end,1],"The boundary values have to be the same. For now the value to the safe operational side has been selected.", level = AssertionLevel.error);
assert(tableLow_internal[1,1]==tableUpp_internal[1,1],"The boundary values have to be the same. For now the value to the safe operational side has been selected.", level = AssertionLevel.error);

equation
scaledX = (unScaledX-fill(iconMin, size(scaledX,1)))*(xMax - xMin)/(iconMax-iconMin) + fill(xMin, size(scaledX, 1));
scaledY = (unScaledY-fill(iconMin, size(scaledX,1)))*(yMax - yMin)/(iconMax-iconMin) + fill(yMin, size(scaledY, 1));
connect(x_in, uppCombiTable1Ds.u)
annotation (Line(points={{-114,60},{-54,60}}, color={0,0,127}));
connect(x_in, lowCombiTable1Ds.u) annotation (Line(points={{-114,60},{-72,60},{-72,26},
Expand Down Expand Up @@ -90,24 +102,31 @@ equation
-68},{-8,-68}}, color={0,0,127}));
connect(conXMin.y, lessLef.u2) annotation (Line(points={{-37.4,-40},{-24,-40},{-24,
-38},{-8,-38}}, color={0,0,127}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-120,-100},{100,
100}}), graphics={
annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},
{100,100}}), graphics={
Rectangle(
extent={{-100,100},{100,-100}},
lineColor={28,108,200},
fillColor={255,255,255},
fillPattern=FillPattern.Solid), Line(points=DynamicSelect({{-76,-74},{-76,46},{-44,66},
{70,66},{70,-74},{-76,-74}},points), color={238,46,47},
thickness=0.5),
Text(
extent={{-100,100},{100,84}},
lineColor={28,108,200},
textString="%name"),
Polygon(
points={{-90,90},{-96,68},{-84,68},{-90,90}},
lineColor={95,95,95},
fillColor={95,95,95},
fillPattern=FillPattern.Solid),
Polygon(
points={{98,-86},{76,-80},{76,-92},{98,-86}},
lineColor={95,95,95},
fillColor={95,95,95},
fillPattern=FillPattern.Solid),
Line(points={{-88,74},{-88,-42},{-88,-88},{86,-88},{82,-86},{86,-88},{
82,-90}}, color={28,108,200}),
Line(points={{-88,74},{-90,70},{-88,74},{-86,70}}, color={28,108,200}),
Line(points={{-74,48},{-74,-60},{-46,-80},{46,-80},{82,-64},{82,42}},
color={28,108,200}),
Line(points={{-74,48},{-68,58},{-50,70},{-36,70},{-20,70},{18,70},{46,
70},{72,64},{82,42}}, color={28,108,200}),
Line(points={{-96,74},{-94,70}}, color={28,108,200}),
Line(points={{-92,74},{-96,66}}, color={28,108,200}),
Line(points={{84,-92},{88,-98}}, color={28,108,200}),
Line(points={{88,-92},{84,-98}}, color={28,108,200})}), Diagram(
Line(points={{-90,68},{-90,-92}}, color={95,95,95}),
Line(points={{-98,-86},{80,-86}}, color={95,95,95})}), Diagram(
coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}})),
Documentation(info="<html>
<p>Given an input of the x and y-Axis, the block returns true if the given point is outside of the given envelope.</p><p>The maximal and minmal y-value depend on the x-Value and are defined by the upper and lower boundaries in form of 1Ds-Tables. The maximal and minimal x-values are obtained trough the table and are constant.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,39 @@ partial block PartialSecurityControl "Base Block"
annotation (Placement(transformation(extent={{120,-30},{140,-10}})));
Modelica.Blocks.Interfaces.BooleanInput modeSet "Set value of HP mode"
annotation (Placement(transformation(extent={{-152,-36},{-120,-4}})));
Modelica.Blocks.MathInteger.TriggeredAdd disErr(
y_start=0,
use_reset=false,
use_set=false)
"Used to show if the error was triggered" annotation (Placement(
transformation(
extent={{-8,-8},{8,8}},
rotation=270,
origin={0,-80})));
Modelica.Blocks.Interfaces.IntegerOutput ERR annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={0,-110})));
Modelica.Blocks.Logical.Not not1 annotation (Placement(transformation(
extent={{-5,-5},{5,5}},
rotation=270,
origin={-21,-69})));
Modelica.Blocks.Sources.IntegerConstant intConOne(final k=1)
"Used for display of current error"
annotation (Placement(transformation(extent={{36,-70},{24,-58}})));
equation
connect(conZer.y,swiErr. u3) annotation (Line(points={{70.6,-18},{78,-18},
{78,-8},{84,-8}}, color={0,0,127}));
connect(swiErr.y, nOut)
annotation (Line(points={{107,0},{118,0},{118,20},{130,20}},
color={0,0,127}));
connect(disErr.y, ERR) annotation (Line(points={{-1.77636e-15,-89.6},{
-1.77636e-15,-100},{0,-100},{0,-110}}, color={255,127,0}));
connect(not1.y, disErr.trigger) annotation (Line(points={{-21,-74.5},{-21,
-75.2},{-9.6,-75.2}}, color={255,0,255}));
connect(intConOne.y, disErr.u) annotation (Line(points={{23.4,-64},{0,-64},{0,
-68.8}}, color={255,127,0}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{
-120,-100},{120,100}}), graphics={
Polygon(
Expand Down
16 changes: 10 additions & 6 deletions AixLib/Controls/HeatPump/SecurityControls/OperationalEnvelope.mo
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ block OperationalEnvelope
use_opeEnv
annotation (Placement(transformation(extent={{10,-36},{24,-22}})));
equation
connect(boundaryMap.noErr, swiErr.u2) annotation (Line(points={{-1.36364,-3},
{42,-3},{42,0},{84,0}}, color={255,0,255}));
connect(boundaryMap.noErr, swiErr.u2) annotation (Line(points={{-1.1,-3},{42,
-3},{42,0},{84,0}}, color={255,0,255}));
connect(nSet,swiErr.u1) annotation (Line(points={{-136,20},{32,20},{32,8},
{84,8}},color={0,0,127}));
connect(booConOpeEnv.y, swiErr.u2) annotation (Line(
Expand All @@ -48,9 +48,9 @@ equation
extent={{-6,3},{-6,3}},
horizontalAlignment=TextAlignment.Right));
connect(boundaryMap.x_in, toDegCT_flow_ev.y)
annotation (Line(points={{-60.4182,12},{-69.4,12}}, color={0,0,127}));
annotation (Line(points={{-66.06,12},{-69.4,12}}, color={0,0,127}));
connect(boundaryMap.y_in, toDegCT_ret_co.y)
annotation (Line(points={{-60.4182,-18},{-69.4,-18}}, color={0,0,127}));
annotation (Line(points={{-66.06,-18},{-69.4,-18}}, color={0,0,127}));
connect(sigBusHP.T_ret_co, toDegCT_ret_co.u) annotation (Line(
points={{-134.915,-68.925},{-98,-68.925},{-98,-18},{-83.2,-18}},
color={255,204,51},
Expand All @@ -59,6 +59,10 @@ equation
index=-1,
extent={{-6,3},{-6,3}},
horizontalAlignment=TextAlignment.Right));
annotation (Diagram(coordinateSystem(extent={{-120,-120},{120,100}})), Icon(
coordinateSystem(extent={{-120,-120},{120,100}})));
connect(boundaryMap.noErr, not1.u) annotation (Line(points={{-1.1,-3},{42,-3},
{42,-56},{-21,-56},{-21,-63}}, color={255,0,255}));
connect(booConOpeEnv.y, not1.u) annotation (Line(points={{24.7,-29},{42,-29},
{42,-56},{-21,-56},{-21,-63}}, color={255,0,255}));
annotation (Diagram(coordinateSystem(extent={{-120,-100},{120,100}})), Icon(
coordinateSystem(extent={{-120,-100},{120,100}})));
end OperationalEnvelope;
42 changes: 31 additions & 11 deletions AixLib/Controls/HeatPump/SecurityControls/SecurityControl.mo
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ block SecurityControl "Block including all security levels"
use_runPerHou=use_runPerHou,
maxRunPerHou=maxRunPerHou,
pre_n_start=pre_n_start)
annotation (Placement(transformation(extent={{-62,-16},{-26,20}})));
annotation (Placement(transformation(extent={{-62,-18},{-26,18}})));

DefrostControl defrostControl(
final minIceFac=minIceFac,
Expand All @@ -93,23 +93,35 @@ block SecurityControl "Block including all security levels"
not use_deFro
"No 2. Layer" annotation (Placement(transformation(extent={{-92,-50},{-76,
-34}})), choicesAllMatching=true);
Modelica.Blocks.Interfaces.IntegerOutput ERR_opeEnv if
use_opeEnv annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={60,-110})));
Modelica.Blocks.Interfaces.IntegerOutput ERR_antFre if
use_antFre annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={100,-110})));
equation
connect(conTru.y,swiErr.u2)
annotation (Line(points={{70.6,0},{84,0}}, color={255,0,255}));
connect(onOffController.nOut, operationalEnvelope.nSet) annotation (Line(
points={{-24.5,3.63636},{-24,3.63636},{-24,4},{-11.6,4}}, color=
points={{-24.5,1.63636},{-24,1.63636},{-24,3.2},{-11.6,3.2}}, color=
{0,0,127}));

connect(sigBusHP, onOffController.sigBusHP) annotation (Line(
points={{-135,-69},{-64.25,-69},{-64.25,-7.65455}},
points={{-135,-69},{-64.25,-69},{-64.25,-9.65455}},
color={255,204,51},
thickness=0.5), Text(
string="%first",
index=-1,
extent={{-3,-6},{-3,-6}},
horizontalAlignment=TextAlignment.Right));
connect(sigBusHP, operationalEnvelope.sigBusHP) annotation (Line(
points={{-135,-69},{-11.5,-69},{-11.5,-4.9}},
points={{-135,-69},{-11.5,-69},{-11.5,-6.59}},
color={255,204,51},
thickness=0.5), Text(
string="%first",
Expand All @@ -133,39 +145,41 @@ equation
color={0,0,127},
pattern=LinePattern.Dash));
connect(realPasThrDef.y, onOffController.nSet) annotation (Line(
points={{-75.2,40},{-60,40},{-60,3.63636},{-64.4,3.63636}},
points={{-75.2,40},{-60,40},{-60,1.63636},{-64.4,1.63636}},
color={0,0,127},
pattern=LinePattern.Dash));
connect(modeSet, defrostControl.modeSet) annotation (Line(
points={{-136,-20},{-120,-20},{-120,-2.66667},{-114.88,-2.66667}},
color={255,0,255},
pattern=LinePattern.Dash));
connect(defrostControl.nOut, onOffController.nSet) annotation (Line(
points={{-74.2,4},{-74.2,3.63636},{-64.4,3.63636}},
points={{-74.2,4},{-74.2,1.63636},{-64.4,1.63636}},
color={0,0,127},
pattern=LinePattern.Dash));
connect(defrostControl.modeOut, operationalEnvelope.modeSet) annotation (
Line(
points={{-74.2,-2.66667},{-68,-2.66667},{-68,-32},{-22,-32},{-22,0},{
-11.6,0}},
points={{-74.2,-2.66667},{-68,-2.66667},{-68,-32},{-22,-32},{-22,-1.2},{
-11.6,-1.2}},
color={255,0,255},
pattern=LinePattern.Dash));
connect(modeSet, boolPasThrDef.u) annotation (Line(
points={{-136,-20},{-120,-20},{-120,-42},{-93.6,-42}},
color={255,0,255},
pattern=LinePattern.Dash));
connect(boolPasThrDef.y, operationalEnvelope.modeSet) annotation (Line(
points={{-75.2,-42},{-22,-42},{-22,0},{-11.6,0}},
points={{-75.2,-42},{-22,-42},{-22,-1.2},{-11.6,-1.2}},
color={255,0,255},
pattern=LinePattern.Dash));
connect(defrostControl.Pel_deFro, Pel_deFro) annotation (Line(
points={{-94,19},{-94,28},{-54,28},{-54,80},{130,80}},
color={0,0,127},
pattern=LinePattern.Dash));
connect(antiFreeze.nSet, operationalEnvelope.nOut)
annotation (Line(points={{22.4,4},{15,4}}, color={0,0,127}));
annotation (Line(points={{22.4,4},{18,4},{18,3.2},{15,3.2}},
color={0,0,127}));
connect(antiFreeze.modeSet, operationalEnvelope.modeOut)
annotation (Line(points={{22.4,0},{15,0}}, color={255,0,255}));
annotation (Line(points={{22.4,0},{18,0},{18,-1.2},{15,-1.2}},
color={255,0,255}));
connect(antiFreeze.nOut, swiErr.u1) annotation (Line(points={{49,4},{54,4},{54,
18},{76,18},{76,8},{84,8}}, color={0,0,127}));
connect(antiFreeze.modeOut, modeOut) annotation (Line(points={{49,0},{52,0},{52,
Expand All @@ -178,4 +192,10 @@ equation
index=-1,
extent={{-6,3},{-6,3}},
horizontalAlignment=TextAlignment.Right));
connect(conTru.y, not1.u) annotation (Line(points={{70.6,0},{76,0},{76,-54},{
-21,-54},{-21,-63}}, color={255,0,255}));
connect(antiFreeze.ERR, ERR_antFre) annotation (Line(points={{36,-9},{36,-50},
{100,-50},{100,-110}}, color={255,127,0}));
connect(operationalEnvelope.ERR, ERR_opeEnv) annotation (Line(points={{2,-11.1},
{2,-50},{60,-50},{60,-110}}, color={255,127,0}));
end SecurityControl;
4 changes: 2 additions & 2 deletions AixLib/Controls/SetPoints/Functions/HeatingCurveFunction.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ protected
parameter Real TOffNig = 10 "Delta K for night mode of heating system";
algorithm
if isDay then
TSet := 55 + ((TRoom-55)/(TRoom+20))*(T_oda+20);
TSet := (55) + ((TRoom-(273.15+55))/(TRoom+(273.15+20)))*(T_oda+20);
else
TSet := 55 + ((TRoom-55)/(TRoom+20))*(T_oda+20)-TOffNig;
TSet := (55) + ((TRoom-(273.15+55))/(TRoom+(273.15+20)))*(T_oda+20)-TOffNig;
end if;
end HeatingCurveFunction;
6 changes: 3 additions & 3 deletions AixLib/Controls/SetPoints/HeatingCurve.mo
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ model HeatingCurve "Model of a heating curve"
parameter Real day_hour=6 "Hour of day at which day mode is enabled" annotation(Dialog(group="Night-Mode",descriptionLabel = true));
parameter Real night_hour=22 "Hour of day at which night mode is enabled" annotation (Dialog(group="Night-Mode",descriptionLabel = true));

Modelica.Blocks.Interfaces.RealInput T_oda "Outdoor air temperature"
Modelica.Blocks.Interfaces.RealInput T_oda(unit="K") "Outdoor air temperature"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Modelica.Blocks.Interfaces.RealInput TRoom_in if use_dynTRoom
Modelica.Blocks.Interfaces.RealInput TRoom_in(unit="K") if use_dynTRoom
"Desired room temperature"
annotation (Placement(transformation(extent={{-140,36},{-100,76}})));
Modelica.Blocks.Interfaces.RealOutput TSet
Modelica.Blocks.Interfaces.RealOutput TSet(unit="K")
"Set temperature calculated by heating curve"
annotation (Placement(transformation(extent={{100,-10},{120,10}})));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ model EvaporatorCondenserWithCapacity
parameter Modelica.SIunits.ThermalConductance kAOut_nominal
"Nominal value for thermal conductance to the ambient" annotation (Dialog(group="Heat losses", enable=
use_cap));
parameter Modelica.Blocks.Interfaces.RealOutput kAInn
Modelica.Blocks.Interfaces.RealOutput kAInn
"Formular for calculation of heat transfer coefficient on the inside"
annotation (Dialog(group="Heat losses", enable=
use_cap));
Expand Down