Skip to content

Commit

Permalink
Cleaned up code
Browse files Browse the repository at this point in the history
  • Loading branch information
mwetter committed Nov 17, 2017
1 parent bc1f838 commit 15d1158
Show file tree
Hide file tree
Showing 18 changed files with 133 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ equation
connect(dp4.port_b, sin.ports[1])
annotation (Line(points={{40,-40},{76,-40},{76,42},{82,42}},
color={0,127,255}));

for i in 1:numPum loop
end for;
connect(y.y, pumPar2.u) annotation (Line(points={{-71,80},{-28,80},{-28,-36},
{-20,-36}}, color={0,0,127}));
connect(dp2.port_b, sin.ports[2])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@ within Buildings.Applications.DataCenters.ChillerCooled.Equipment;
package Validation "Collection of models that validate the Buildings.Applications.DataCenters.ChillerCooled package"
extends Modelica.Icons.ExamplesPackage;








annotation (preferredView="info", Documentation(info="<html>
<p>
This package contains validation models for the classes in
<a href=\"modelica://Buildings.Applications.DataCenters.ChillerCooled.Equipment\">
Buildings.Applications.DataCenters.ChillerCooled.Equipment</a>.
</p>
<p>
Note that most validation models contain simple input data
which may not be realistic, but for which the correct
output can be obtained through an analytic solution.
The examples plot various outputs, which have been verified against these
solutions. These model outputs are stored as reference data and
used for continuous validation whenever models in the library change.
</p>
</html>"));

end Validation;
7 changes: 3 additions & 4 deletions Buildings/Controls/OBC/CDL/Types/Day.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ type Day = enumeration(
WorkingDay "Working day, such as Monday through Friday",
NonWorkingDay "Non-working day, such as week-ends, but not holidays",
Holiday "Holiday") "Enumeration for the day types" annotation (
Documentation(info = "<html>
Documentation(info="<html>
<p>
Enumeration for the type of days.
The possible values are
The possible values are:
</p>
<ol>
<li>
Expand All @@ -19,8 +19,7 @@ NonWorkingDay
Holiday
</li>
</ol>
</html>",
revisions="<html>
</html>", revisions="<html>
<ul>
<li>
February 27, 2017 by Milica Grahovac:<br/>
Expand Down
31 changes: 28 additions & 3 deletions Buildings/Controls/OBC/CDL/Types/Extrapolation.mo
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
within Buildings.Controls.OBC.CDL.Types;
type Extrapolation = enumeration(
HoldLastPoint
"Hold the first/last table point outside of the table scope",
HoldLastPoint "Hold the first/last table point outside of the table scope",

LastTwoPoints
"Extrapolate by using the derivative at the first/last table points outside of the table scope",

Periodic "Repeat the table scope periodically")
"Enumeration defining the extrapolation of time table interpolation";
"Enumeration defining the extrapolation of time table interpolation"
annotation (Documentation(info="<html>
<p>
Enumeration for the type of extrapolation that is used when reading data from a table.
The possible values are:
</p>

<table border=\"1\" summary=\"Explanation of the enumeration\">
<tr>
<th>Enumeration</th>
<th>Description</th></tr>
<tr><td><code>HoldLastPoint</code></td>
<td>
Hold the first or last point outside of the table scope.
</td></tr>
<tr><td><code>LastTwoPoints</code></td>
<td>
Extrapolate by using the derivative at the first or last table points outside of the table scope.
</td></tr>
<tr><td><code>Periodic</code></td>
<td>
Repeat the table scope periodically.
</td></tr>
</table>
</html>"));
29 changes: 15 additions & 14 deletions Buildings/Controls/OBC/CDL/Types/Init.mo
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
within Buildings.Controls.OBC.CDL.Types;
type Init = enumeration(
NoInit
"No initialization (start values are used as guess values with fixed=false)",
NoInit "No initialization (start values are used as guess values)",
InitialState "Initialization with initial states",
InitialOutput
"Initialization with initial outputs (and steady state of the states if possible)")
InitialOutput "Initialization with initial outputs")
"Enumeration defining initialization of a block" annotation (Evaluate=true,
Documentation(info="<html>
<p>The following initialization alternatives are available:</p>
Documentation(info="<html>
<p>
Enumeration for the type of initialization that is used for state variables.
The possible values are:
</p>
<table summary=\"summary\" border=\"1\">
<tr><td><code><strong>NoInit</strong></code></td><td>No initialization (start values are used as guess values with <code>fixed=false</code>)</td></tr>
<tr><td><code><strong>SteadyState</strong></code></td><td>Steady state initialization (derivatives of states are zero)</td></tr>
<tr><td><code><strong>InitialState</strong></code></td><td>Initialization with initial states</td></tr>
<tr><td><code><strong>InitialOutput</strong></code></td><td>Initialization with initial outputs (and steady state of the states if possible)</td></tr>
<tr><td><code>NoInit</code></td><td>No initialization (start values are used as guess values with <code>fixed=false</code>).
</td></tr>
<tr><td><code>InitialState</code></td>
<td>Initialization with initial states.</td></tr>
<tr><td><code>InitialOutput</code></td>
<td>Initialization with initial outputs (and steady state of the states if possible).
</td></tr>
</table>
<br/>
</html>", revisions="<html>
</html>", revisions="<html>
<ul>
<li>
April 25, 2017, by Jianjun Hu:<br/>
Expand Down
18 changes: 8 additions & 10 deletions Buildings/Controls/OBC/CDL/Types/Reset.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,30 @@ within Buildings.Controls.OBC.CDL.Types;
type Reset = enumeration(
Disabled "Disabled",
Parameter "Use parameter value",
Input "Use input signal") "Options for integrator reset"
annotation (
Documentation(info="<html>
Input "Use input signal") "Options for integrator reset" annotation (
Documentation(info="<html>
<p>
Enumeration to define the choice of integrator reset
(to be selected via choices menu):
Enumeration to define the choice of integrator reset.
Possible values are:
</p>
<table border=\"1\" summary=\"Explanation of the enumeration\">
<tr>
<th>Enumeration</th>
<th>Description</th></tr>
<tr><td>Disabled</td>
<tr><td><code>Disabled</code></td>
<td>
Use this setting to disable the integrator reset.
</td></tr>
<tr><td>Parameter</td>
<tr><td><code>Parameter</code></td>
<td>
Use this setting to use reset the integrator to the value of the parameter.
</td></tr>
<tr><td>Input</td>
<tr><td><code>Input</code></td>
<td>Use this setting to reset the integrator to the value obtained
from the input signal.
</td></tr>
</table>
</html>",
revisions="<html>
</html>", revisions="<html>
<ul>
<li>
March 23, 2017, by Jianjun Hu:<br/>
Expand Down
35 changes: 34 additions & 1 deletion Buildings/Controls/OBC/CDL/Types/SimpleController.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,37 @@ type SimpleController = enumeration(
PD "PD controller",
PID "PID controller")
"Enumeration defining P, PI, PD, or PID simple controller type" annotation (
Evaluate=true);
Evaluate=true, Documentation(info="<html>
<p>
Enumeration to define the type of the controller.
Possible values are:
</p>
<table border=\"1\" summary=\"Explanation of the enumeration\">
<tr>
<th>Enumeration</th>
<th>Description</th></tr>
<tr><td><code>P</code></td>
<td>
Controller with proportional term.
</td></tr>
<tr><td><code>PI</code></td>
<td>
Controller with proportional and integral terms.
</td></tr>
<tr><td><code>PD</code></td>
<td>
Controller with proportional and derivative term.
</td></tr>
<tr><td><code>PID</code></td>
<td>
Controller with proportional, integral and derivative terms.
</td></tr>
</table>
</html>", revisions="<html>
<ul>
<li>
March 23, 2017, by Jianjun Hu:<br/>
First implementation.
</li>
</ul>
</html>"));
22 changes: 21 additions & 1 deletion Buildings/Controls/OBC/CDL/Types/Smoothness.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,24 @@ type Smoothness = enumeration(
LinearSegments "Table points are linearly interpolated",
ConstantSegments
"Table points are not interpolated, but the previous tabulated value is returned")
"Enumeration defining the smoothness of table interpolation";
"Enumeration defining the smoothness of table interpolation" annotation (
Documentation(info="<html>
<p>
Enumeration for the type of smoothness that is used when interpolating data from a table.
The possible values are:
</p>
<table border=\"1\" summary=\"Explanation of the enumeration\">
<tr>
<th>Enumeration</th>
<th>Description</th></tr>
<tr><td><code>LinearSegments</code></td>
<td>
Linearly interpolate table points.
</td></tr>
<tr><td><code>ConstantSegments</code></td>
<td>
Do not interpolate, but rather use the previously tabulated value.
</td></tr>
</table>
</html>"));
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
within Buildings.Examples.DualFanDualDuct.Controls.Examples;
model RoomMixingBox "Test model for room mixing box"
import Buildings;
extends Modelica.Icons.Example;
Buildings.Examples.DualFanDualDuct.Controls.RoomMixingBox conMix(m_flow_min=1)
"Controller for mixing box"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
within Buildings.Examples.DualFanDualDuct.Controls;
block RoomMixingBox "Controller for room mixing box"
import Buildings;
extends Modelica.Blocks.Icons.Block;
parameter Modelica.SIunits.MassFlowRate m_flow_min "Minimum mass flow rate";
Buildings.Controls.OBC.CDL.Continuous.LimPID conHea(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
within Buildings.Examples.DualFanDualDuct.ThermalZones;
model SupplyBranch "Supply branch of a dual duct system"
import Buildings;
replaceable package MediumA = Modelica.Media.Interfaces.PartialMedium
"Medium model for air" annotation (choicesAllMatching=true);
Modelica.Fluid.Interfaces.FluidPort_a port_aHot(redeclare package Medium =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ equation
48},{-161.636,48},{-146,48},{-146,163.2},{12.6,163.2}}, color={255,0,
255}));
annotation (
experiment(StopTime=604800, Tolerance=1e-06,__Dymola_Algorithm="Radau"),
experiment(StopTime=604800, Tolerance=1e-06),
__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/Examples/ScalableBenchmarks/BuildingVAV/Examples/OneFloor_OneZone.mos"
"Simulate and plot"),
Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-360,-120},{140,200}})),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ model TwoFloor_TwoZone "Closed-loop model with 2 zone in 2 floor"
nZon=2);

annotation (
experiment(StopTime=604800, Tolerance=1e-06,__Dymola_Algorithm="Radau"),
experiment(StopTime=604800, Tolerance=1e-06),
__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/Examples/ScalableBenchmarks/BuildingVAV/Examples/TwoFloor_TwoZone.mos"
"Simulate and plot"),
Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-360,-120},{140,200}})),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ equation
thickness=0.5));

annotation (
experiment(StopTime=604800, Tolerance=1e-06, __Dymola_Algorithm="Radau"),
experiment(StopTime=604800, Tolerance=1e-06),
__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/Examples/ScalableBenchmarks/BuildingVAV/ThermalZones/Validation/MultiZone.mos"
"Simulate and plot"),
Documentation(info="<html>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ equation
color={255,204,51}, thickness=0.5));

annotation (
experiment(StopTime=604800, Tolerance=1e-06, __Dymola_Algorithm="Radau"),
experiment(StopTime=604800, Tolerance=1e-06),
__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/Examples/ScalableBenchmarks/BuildingVAV/ThermalZones/Validation/ThermalZone.mos"
"Simulate and plot"),
Documentation(info="<html>
Expand Down
6 changes: 3 additions & 3 deletions Buildings/Examples/VAVReheat/ASHRAE2006.mo
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
within Buildings.Examples.VAVReheat;
model ASHRAE2006
"Variable air volume flow system with terminal reheat and five thermal zones"
import Buildings;
extends Modelica.Icons.Example;
extends Buildings.Examples.VAVReheat.BaseClasses.PartialOpenLoop(heaCoi(
show_T=true), cooCoi(show_T=true));
extends Buildings.Examples.VAVReheat.BaseClasses.PartialOpenLoop(
heaCoi(show_T=true),
cooCoi(show_T=true));

Modelica.Blocks.Sources.Constant TSupSetHea(y(
final quantity="ThermodynamicTemperature",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
within Buildings.Fluid.HeatPumps.Examples;
model ScrollWaterToWater_OneRoomRadiator
"7th part of the system model, which implements the on/off control using a state machine"
"Heat pump with scroll compressor connected to a simple room model with radiator"
extends Modelica.Icons.Example;
replaceable package MediumA =
Buildings.Media.Air "Medium model for air";
Expand All @@ -15,7 +15,7 @@ model ScrollWaterToWater_OneRoomRadiator
"Radiator nominal return water temperature";

parameter Modelica.SIunits.MassFlowRate mHeaPum_flow_nominal=
Q_flow_nominal/4200/(5)
Q_flow_nominal/4200/5
"Heat pump nominal mass flow rate";
//------------------------------------------------------------------------------//

Expand Down
3 changes: 0 additions & 3 deletions Buildings/HeatTransfer/Conduction/SingleLayer.mo
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,9 @@ equation
end for;
else
// Regular material
// when sample(0, 2*60) then // fixme: remove for final release
for i in 1:nSta loop
// T[i] = pre(T[i]) + 2*60 * (pre(Q_flow[i])-pre(Q_flow[i+1]))*CInv[i];
der(T[i]) = (Q_flow[i]-Q_flow[i+1])*CInv[i];
end for;
// end when;
for i in 1:nSta loop
u[i]=0; // u is not required in this case
end for;
Expand Down

0 comments on commit 15d1158

Please sign in to comment.