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

removed checkBoundary for #1 #3

Merged
merged 17 commits into from
Dec 10, 2019
22 changes: 22 additions & 0 deletions IbpsaMpc/.copiedFiles.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Do not edit this file unless you know what you are doing.
# This file is used by the IBPSA merge script and generated by BuildingsPy.
IbpsaMpc/Fluid/Interfaces/PartialTwoPort.mo
IbpsaMpc/Fluid/Interfaces/package.mo
IbpsaMpc/Fluid/Sources/BaseClasses/PartialPropertySource.mo
IbpsaMpc/Fluid/Sources/BaseClasses/PartialSource.mo
IbpsaMpc/Fluid/Sources/BaseClasses/PartialSource_Xi_C.mo
IbpsaMpc/Fluid/Sources/BaseClasses/package.mo
IbpsaMpc/Fluid/Sources/Boundary_pT.mo
IbpsaMpc/Fluid/Sources/Boundary_ph.mo
IbpsaMpc/Fluid/Sources/MassFlowSource_T.mo
IbpsaMpc/Fluid/Sources/MassFlowSource_h.mo
IbpsaMpc/Fluid/Sources/PropertySource_T.mo
IbpsaMpc/Fluid/Sources/PropertySource_h.mo
IbpsaMpc/Fluid/Sources/package.mo
IbpsaMpc/Fluid/package.mo
IbpsaMpc/Media/Air.mo
IbpsaMpc/Media/package.mo
IbpsaMpc/Utilities/Psychrometrics/Constants.mo
IbpsaMpc/Utilities/Psychrometrics/package.mo
IbpsaMpc/Utilities/package.mo
# Sha of last merge: 1b3b2a6e23d7de10cb62634a2dea57069cc74ab9
110 changes: 110 additions & 0 deletions IbpsaMpc/Fluid/Interfaces/PartialTwoPort.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
within IbpsaMpc.Fluid.Interfaces;
partial model PartialTwoPort "Partial component with two ports"
replaceable package Medium =
Modelica.Media.Interfaces.PartialMedium "Medium in the component"
annotation (choices(
choice(redeclare package Medium = IbpsaMpc.Media.Air "Moist air"),
choice(redeclare package Medium = IbpsaMpc.Media.Water "Water"),
choice(redeclare package Medium =
IbpsaMpc.Media.Antifreeze.PropyleneGlycolWater (
property_T=293.15,
X_a=0.40)
"Propylene glycol water, 40% mass fraction")));

parameter Boolean allowFlowReversal = true
"= false to simplify equations, assuming, but not enforcing, no flow reversal"
annotation(Dialog(tab="Assumptions"), Evaluate=true);

Modelica.Fluid.Interfaces.FluidPort_a port_a(
redeclare final package Medium = Medium,
m_flow(min=if allowFlowReversal then -Modelica.Constants.inf else 0),
h_outflow(start = Medium.h_default, nominal = Medium.h_default))
"Fluid connector a (positive design flow direction is from port_a to port_b)"
annotation (Placement(transformation(extent={{-110,-10},{-90,10}})));
Modelica.Fluid.Interfaces.FluidPort_b port_b(
redeclare final package Medium = Medium,
m_flow(max=if allowFlowReversal then +Modelica.Constants.inf else 0),
h_outflow(start = Medium.h_default, nominal = Medium.h_default))
"Fluid connector b (positive design flow direction is from port_a to port_b)"
annotation (Placement(transformation(extent={{110,-10},{90,10}})));

annotation (
Documentation(info="<html>
<p>
This partial model defines an interface for components with two ports.
The treatment of the design flow direction and of flow reversal are predefined based on the parameter <code>allowFlowReversal</code>.
The component may transport fluid and may have internal storage for a given fluid <code>Medium</code>.
</p>
<h4>Implementation</h4>
<p>
This model is similar to
<a href=\"modelica://Modelica.Fluid.Interfaces.PartialTwoPort\">
Modelica.Fluid.Interfaces.PartialTwoPort</a>
but it does not use the <code>outer system</code> declaration.
This declaration is omitted as in building energy simulation,
many models use multiple media, an in practice,
users have not used this global definition to assign parameters.
</p>
</html>", revisions="<html>
<ul>
<li>
January 18, 2019, by Jianjun Hu:<br/>
Limited the media choice.
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1050\">#1050</a>.
</li>
<li>
July 8, 2018, by Filip Jorissen:<br/>
Added nominal value of <code>h_outflow</code> in <code>FluidPorts</code>.
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/977\">#977</a>.
</li>
<li>
November 19, 2015, by Michael Wetter:<br/>
Removed parameters
<code>port_a_exposesState</code> and
<code>port_b_exposesState</code>
for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/351\">#351</a>
and
<code>showDesignFlowDirection</code>
for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/349\">#349</a>.
</li>
<li>
November 13, 2015, by Michael Wetter:<br/>
Assinged <code>start</code> attribute for leaving
enthalpy at <code>port_a</code> and <code>port_b</code>.
This was done to make the model similar to
<a href=\"modelica://IbpsaMpc.Fluid.Interfaces.PartialFourPort\">
IbpsaMpc.Fluid.Interfaces.PartialFourPort</a>.
</li>
<li>
November 12, 2015, by Michael Wetter:<br/>
Removed import statement.
</li>
<li>
October 21, 2014, by Michael Wetter:<br/>
Revised implementation.
Declared medium in ports to be <code>final</code>.
</li>
<li>
October 20, 2014, by Filip Jorisson:<br/>
First implementation.
</li>
</ul>
</html>"),
Icon(coordinateSystem(
preserveAspectRatio=true,
extent={{-100,-100},{100,100}}), graphics={
Polygon(
points={{20,-70},{60,-85},{20,-100},{20,-70}},
lineColor={0,128,255},
fillColor={0,128,255},
fillPattern=FillPattern.Solid,
visible=not allowFlowReversal),
Line(
points={{55,-85},{-60,-85}},
color={0,128,255},
visible=not allowFlowReversal),
Text(
extent={{-149,-114},{151,-154}},
lineColor={0,0,255},
textString="%name")}));
end PartialTwoPort;
227 changes: 227 additions & 0 deletions IbpsaMpc/Fluid/Interfaces/package.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
within IbpsaMpc.Fluid;
package Interfaces "Package with interfaces for fluid models"
extends Modelica.Icons.InterfacesPackage;


package UsersGuide "User's Guide"
extends Modelica.Icons.Information;
annotation (preferredView="info",
Documentation(info="<html>
<p>
The package <code>IbpsaMpc.Fluid.Interface</code> consists of basic
classes that can be used by developers to create new component models.
</p>
<p>
The classes whose name contains <code>TwoPort</code> or
<code>FourPort</code> can be used for components with
two or four fluid ports, respectively. If a class name contains
<code>Static</code>, then it can only be used for a steady-state model.
Otherwise, it may be used for a steady-state or a dynamic model.
</p>
<p>
The most basic classes are the records
<a href=\"modelica://IbpsaMpc.Fluid.Interfaces.TwoPortFlowResistanceParameters\">
IbpsaMpc.Fluid.Interfaces.TwoPortFlowResistanceParameters</a>,
<a href=\"modelica://IbpsaMpc.Fluid.Interfaces.FourPortFlowResistanceParameters\">
IbpsaMpc.Fluid.Interfaces.FourPortFlowResistanceParameters</a> and
<a href=\"modelica://IbpsaMpc.Fluid.Interfaces.LumpedVolumeDeclarations\">
IbpsaMpc.Fluid.Interfaces.LumpedVolumeDeclarations</a>.
These define parameters that are needed by many fluid flow components.
</p>

<p>
Next, we describe the basic classes. For a more detailed description,
see the <i>info</i> section of the class.
</p>
<table summary=\"summary\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\" style=\"border-collapse:collapse;\">
<tr>
<!-- ============================================== -->
<td><a href=\"modelica://IbpsaMpc.Fluid.Interfaces.ConservationEquation\">
IbpsaMpc.Fluid.Interfaces.ConservationEquation</a>
</td>
<td><p>
This is a basic model for an ideally mixed fluid volume.
It implements conservation equations for mass and energy.
The conservation equations can be dynamic or steady-state.
The model can have an arbitrary number of fluid ports.
Models that instanciate this model need to define the input
<code>fluidVolume</code>, which is the actual volume occupied by the fluid.
For most components, this can be set to a parameter. However, for components such as
expansion vessels, the fluid volume can change in time.
</p>

The model has the following input connectors:<br/>
<ul>
<li>
<code>Q_flow</code>, which is the sensible plus latent heat flow rate added to the medium, and
</li>
<li>
<code>mXi_flow</code>, which is the species mass flow rate added to the medium.
</li>
</ul>

<p>
Models that instanciate this model can used these connectors to interface with the conservation equations.
</p>
</td>
</tr>
<!-- ============================================== -->
<tr>
<td><a href=\"modelica://IbpsaMpc.Fluid.Interfaces.StaticTwoPortConservationEquation\">
IbpsaMpc.Fluid.Interfaces.StaticTwoPortConservationEquation</a>
</td>
<td><p>
This is a basic model for steady-state conservation equations
for mass and energy of a component with two fluid ports.
</p>

The model has the following input connectors:<br/>
<ul>
<li>
<code>Q_flow</code>, which is the sensible plus latent heat flow rate added to the medium, and
</li>
<li>
<code>mXi_flow</code>, which is the species mass flow rate added to the medium.
</li>
</ul>

<p>
Models that instanciate this model can used these connectors to interface with the conservation equations.
</p>
<p>
Compared to
<a href=\"modelica://IbpsaMpc.Fluid.Interfaces.ConservationEquation\">
IbpsaMpc.Fluid.Interfaces.ConservationEquation</a>
this model provides a more efficient implementation of the steady-state conservation equations for
models with two fluid ports.
</p>
</td>
</tr>
<!-- ============================================== -->
<tr>
<td>
<a href=\"modelica://IbpsaMpc.Fluid.Interfaces.PartialFourPort\">
IbpsaMpc.Fluid.Interfaces.PartialFourPort</a>
</td>
<td>
This model defines an interface for components with four ports.
Only parameters and fluid definitions are provided, but no
equations.
The model is identical to
<a href=\"modelica://Modelica.Fluid.Interfaces.PartialTwoPort\">
Modelica.Fluid.Interfaces.PartialTwoPort</a>, except that it has
four ports.
</td>
</tr>
<!-- ============================================== -->
<tr>
<td>
<a href=\"modelica://IbpsaMpc.Fluid.Interfaces.PrescribedOutlet\">
IbpsaMpc.Fluid.Interfaces.PrescribedOutlet</a>
</td>
<td>
This model calculates a prescribed heat flow (e.g. for an ideal heater or cooler),
depending on a set temperature <code>TSet</code>.
</td>
</tr>
<!-- ============================================== -->
<tr>
<td>
<a href=\"modelica://IbpsaMpc.Fluid.Interfaces.PartialTwoPortInterface\">
IbpsaMpc.Fluid.Interfaces.PartialTwoPortInterface</a>
</td>
<td>
This model defines the interface for component models that transport
fluid, and that can exchange heat and mass.
It also defines the port pressure difference as
<i>&Delta;p = p<sub>a</sub>-p<sub>b</sub></i>. However, no equation is
implemented to compute <i>&Delta;p(&sdot;)</i> as a function of the
mass flow rate. The model also implements equations to obtain the
thermodynamic state at the ports.
</td>
</tr>
<!-- ============================================== -->
<tr>
<td>
<a href=\"modelica://IbpsaMpc.Fluid.Interfaces.PartialFourPortInterface\">
IbpsaMpc.Fluid.Interfaces.PartialFourPortInterface</a>
</td>
<td>
This model is identical to
<a href=\"modelica://IbpsaMpc.Fluid.Interfaces.PartialTwoPortInterface\">
IbpsaMpc.Fluid.Interfaces.PartialTwoPortInterface</a>
but it can be used for components with four fluid ports.
</td>
</tr>
<!-- ============================================== -->
<tr>
<td>
<a href=\"modelica://IbpsaMpc.Fluid.Interfaces.StaticTwoPortHeatMassExchanger\">
IbpsaMpc.Fluid.Interfaces.StaticTwoPortHeatMassExchanger</a>
</td>
<td>
This model implements the pressure drop as a function of the mass flow rate.
It also implements the steady-state energy and mass conservation
equations. However, it does not implement an equation that computes
<code>Q_flow</code>, the
sensible and latent heat transfer to the medium flow, nor
does it implement an equation for <code>mXi_flow</code>,
the species mass flow rate added to or removed from the medium.
Models that extend this model need to provide equations
for <code>Q_flow</code> and <code>mXi_flow</code>.
</td>
</tr>
<!-- ============================================== -->
<tr>
<td>
<a href=\"modelica://IbpsaMpc.Fluid.Interfaces.StaticFourPortHeatMassExchanger\">
IbpsaMpc.Fluid.Interfaces.StaticFourPortHeatMassExchanger</a>
</td>
<td>
This model is identical to
<a href=\"modelica://IbpsaMpc.Fluid.Interfaces.StaticTwoPortHeatMassExchanger\">
IbpsaMpc.Fluid.Interfaces.StaticTwoPortHeatMassExchanger</a>
except that it has four ports.
</td>
</tr>
<!-- ============================================== -->
<tr>
<td>
<a href=\"modelica://IbpsaMpc.Fluid.Interfaces.TwoPortHeatMassExchanger\">
IbpsaMpc.Fluid.Interfaces.TwoPortHeatMassExchanger</a>
</td>
<td>
This model implements the pressure drop as a function of the mass flow rate.
It also implements the energy and mass conservation equations, which may be
configured as steady-state or dynamic balances based on a parameter.
</td>
</tr>
<!-- ============================================== -->
<tr>
<td>
<a href=\"modelica://IbpsaMpc.Fluid.Interfaces.FourPortHeatMassExchanger\">
IbpsaMpc.Fluid.Interfaces.FourPortHeatMassExchanger</a>
</td>
<td>
This model is identical to
<a href=\"modelica://IbpsaMpc.Fluid.Interfaces.TwoPortHeatMassExchanger\">
IbpsaMpc.Fluid.Interfaces.TwoPortHeatMassExchanger</a>
except that it has four ports.
</td>
</tr>
</table>

</html>"));

end UsersGuide;


annotation (preferredView="info", Documentation(info="<html>
<p>
This package contains basic classes that are used to build
component models that change the state of the
fluid. The classes are not directly usable, but can
be extended when building a new model.
</p>
</html>"));
end Interfaces;
2 changes: 2 additions & 0 deletions IbpsaMpc/Fluid/Interfaces/package.order
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
UsersGuide
PartialTwoPort
Loading