Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is for #290
- Loading branch information
Showing
7 changed files
with
290 additions
and
0 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
Buildings/Fluid/HeatExchangers/RadiantSlabs/BaseClasses/Functions/Examples/HeatFlowRate.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
within Buildings.Fluid.HeatExchangers.RadiantSlabs.BaseClasses.Functions.Examples; | ||
model HeatFlowRate "Test model for the heat flow rate function" | ||
extends Modelica.Icons.Example; | ||
parameter Modelica.SIunits.Temperature T_a = 273.15+45 | ||
"Temperature at port_a"; | ||
parameter Modelica.SIunits.Temperature T_b = 273.15+42 | ||
"Temperature at port_b"; | ||
Modelica.SIunits.Temperature T_s "Temperature of solid"; | ||
parameter Modelica.SIunits.Temperature T_f = 273.15+24 | ||
"Temperature of control volume"; | ||
|
||
parameter Modelica.SIunits.SpecificHeatCapacity c_p= 4200 | ||
"Specific heat capacity"; | ||
parameter Modelica.SIunits.ThermalConductance UA = 1 "UA value"; | ||
|
||
parameter Modelica.SIunits.MassFlowRate m_flow_nominal= 0.1 | ||
"Nominal mass flow rate from port_a to port_b"; | ||
|
||
Modelica.SIunits.MassFlowRate m_flow "Mass flow rate from port_a to port_b"; | ||
|
||
Modelica.SIunits.HeatFlowRate Q_flow "Heat flow rate"; | ||
|
||
parameter Modelica.SIunits.HeatCapacity C=0.001 | ||
"Heat capacity of solid state"; | ||
|
||
initial equation | ||
T_s = 273.15+25; | ||
equation | ||
m_flow = 2*(time-0.5)*m_flow_nominal; | ||
Q_flow = Buildings.Fluid.HeatExchangers.RadiantSlabs.BaseClasses.Functions.heatFlowRate( | ||
T_a=T_a, | ||
T_b=T_b, | ||
T_s=T_s, | ||
T_f=T_f, | ||
c_p=c_p, | ||
UA=UA, | ||
m_flow=m_flow, | ||
m_flow_nominal=m_flow_nominal); | ||
C*der(T_s) = -Q_flow; | ||
annotation(__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/Fluid/HeatExchangers/RadiantSlabs/BaseClasses/Functions/Examples/HeatFlowRate.mos" | ||
"Simulate and plot"), | ||
Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-120}, | ||
{100,100}})), | ||
Documentation(info="<html> | ||
<p> | ||
This example tests the function that computes the heat flow rate between | ||
the water and the slab as the water flow rate transitions from negative | ||
to positive. | ||
The parameters, including the temperatures, are selected in an unrealistic way | ||
that has been used to test the proper functionality of this function. | ||
</p> | ||
</html>", | ||
revisions="<html> | ||
<ul> | ||
<li> | ||
October 7, 2014, by Michael Wetter:<br/> | ||
First implementation. | ||
</li> | ||
</ul> | ||
</html>"), | ||
experiment( | ||
StopTime=1, | ||
Tolerance=1e-05)); | ||
end HeatFlowRate; |
13 changes: 13 additions & 0 deletions
13
Buildings/Fluid/HeatExchangers/RadiantSlabs/BaseClasses/Functions/Examples/package.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
within Buildings.Fluid.HeatExchangers.RadiantSlabs.BaseClasses.Functions; | ||
package Examples "Collection of models that illustrate model use and test models" | ||
extends Modelica.Icons.ExamplesPackage; | ||
|
||
|
||
annotation (preferredView="info", Documentation(info="<html> | ||
<p> | ||
This package contains examples for the use of models that can be found in | ||
<a href=\"modelica://Buildings.Fluid.HeatExchangers.RadiantSlabs.BaseClasses.Functions\"> | ||
Buildings.Fluid.HeatExchangers.RadiantSlabs.BaseClasses.Functions</a>. | ||
</p> | ||
</html>")); | ||
end Examples; |
1 change: 1 addition & 0 deletions
1
Buildings/Fluid/HeatExchangers/RadiantSlabs/BaseClasses/Functions/Examples/package.order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
HeatFlowRate |
59 changes: 59 additions & 0 deletions
59
Buildings/Fluid/HeatExchangers/RadiantSlabs/BaseClasses/Functions/heatFlowRate.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
within Buildings.Fluid.HeatExchangers.RadiantSlabs.BaseClasses.Functions; | ||
function heatFlowRate "Heat flow rate for epsilon-NTU model" | ||
extends Modelica.Icons.Function; | ||
input Modelica.SIunits.Temperature T_a "Temperature at port_a"; | ||
input Modelica.SIunits.Temperature T_b "Temperature at port_b"; | ||
input Modelica.SIunits.Temperature T_s "Temperature of solid"; | ||
input Modelica.SIunits.Temperature T_f "Temperature of fluid control volume"; | ||
|
||
input Modelica.SIunits.SpecificHeatCapacity c_p "Specific heat capacity"; | ||
input Modelica.SIunits.ThermalConductance UA "UA value"; | ||
input Modelica.SIunits.MassFlowRate m_flow | ||
"Mass flow rate from port_a to port_b"; | ||
input Modelica.SIunits.MassFlowRate m_flow_nominal | ||
"Nominal mass flow rate from port_a to port_b"; | ||
|
||
output Modelica.SIunits.HeatFlowRate Q_flow "Heat flow rate"; | ||
protected | ||
Modelica.SIunits.MassFlowRate m_abs_flow "Absolute value of mass flow rate"; | ||
Modelica.SIunits.Temperature T_in "Inlet fluid temperature"; | ||
Real eps "Heat transfer effectiveness"; | ||
|
||
algorithm | ||
m_abs_flow :=noEvent(abs(m_flow)); | ||
T_in :=smooth(1, noEvent(if m_flow >= 0 then T_a else T_b)); | ||
if m_abs_flow > 0.15*m_flow_nominal then | ||
// High flow rate. Use epsilon-NTU formula. | ||
eps := 1-Modelica.Math.exp(-UA/m_abs_flow/c_p); | ||
Q_flow :=eps*(T_s-T_in)*m_abs_flow*c_p; | ||
elseif (m_abs_flow < 0.05*m_flow_nominal) then | ||
// Low flow rate. Use heat conduction to temperature of the control volume. | ||
Q_flow :=UA*(T_s-T_f); | ||
else | ||
// Transition. Use a once continuously differentiable transition between the | ||
// above regimes. | ||
eps := 1-Modelica.Math.exp(-UA/m_abs_flow/c_p); | ||
Q_flow := Buildings.Utilities.Math.Functions.spliceFunction( | ||
pos=eps*(T_s-T_in)*m_abs_flow*c_p, | ||
neg=UA*(T_s-T_f), | ||
x=m_abs_flow/m_flow_nominal-0.1, | ||
deltax=0.05); | ||
end if; | ||
|
||
annotation ( | ||
smoothOrder=1, | ||
Documentation(info="<html> | ||
<p> | ||
fixme | ||
</p> | ||
</html> | ||
", | ||
revisions="<html> | ||
<ul> | ||
<li> | ||
October 7, 2014, by Michael Wetter:<br/> | ||
First implementation. | ||
</li> | ||
</ul> | ||
</html>")); | ||
end heatFlowRate; |
139 changes: 139 additions & 0 deletions
139
Buildings/Fluid/HeatExchangers/RadiantSlabs/BaseClasses/PipeToSlabConductance.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
within Buildings.Fluid.HeatExchangers.RadiantSlabs.BaseClasses; | ||
model PipeToSlabConductance | ||
"Convective heat transfer in pipes and fictitious resistance to average slab temperature" | ||
replaceable package Medium = | ||
Modelica.Media.Interfaces.PartialMedium "Medium in the component" | ||
annotation (choicesAllMatching = true); | ||
parameter Boolean use_epsilon_NTU = false | ||
"Set to true to use an epsilon-NTU model for the heat conduction"; | ||
parameter Modelica.SIunits.Area APip "Pipe inside surface area"; | ||
|
||
parameter | ||
Modelica.Fluid.Dissipation.HeatTransfer.StraightPipe.kc_overall_IN_con | ||
kc_IN_con "Parameters for convective heat transfer calculation" | ||
annotation (Placement(transformation(extent={{-90,84},{-78,96}}))); | ||
|
||
Modelica.Fluid.Dissipation.HeatTransfer.StraightPipe.kc_overall_IN_var | ||
kc_IN_var( | ||
cp=Medium.specificHeatCapacityCp(fluSta), | ||
eta=Medium.dynamicViscosity(fluSta), | ||
lambda=Medium.thermalConductivity(fluSta), | ||
rho=Medium.density(fluSta), | ||
m_flow=m_flow) "Variables for convective heat transfer calculation" | ||
annotation (Placement(transformation(extent={{-90,68},{-78,80}}))); | ||
|
||
parameter Modelica.SIunits.ThermalResistance RFic | ||
"Average fictitious thermal resistance between pipe surface and plane that contains pipe"; | ||
parameter Modelica.SIunits.ThermalResistance RWal | ||
"Thermal resistance through the pipe wall"; | ||
|
||
parameter Modelica.SIunits.MassFlowRate m_flow_nominal | ||
"Nominal mass flow rate"; | ||
|
||
Modelica.Blocks.Interfaces.RealInput m_flow(unit="kg/s") | ||
"Fluid mass flow rate from port_a to port_b" | ||
annotation (Placement(transformation(extent={{-118,32},{-100,50}}), | ||
iconTransformation(extent={{-120,30},{-100,50}}))); | ||
Modelica.Blocks.Interfaces.RealInput T_a(unit="K") | ||
"Temperature at fluid port_a" | ||
annotation (Placement(transformation(extent={{-118,92},{-100,110}}), | ||
iconTransformation(extent={{-120,90},{-100,110}}))); | ||
Modelica.Blocks.Interfaces.RealInput T_b(unit="K") | ||
"Temperature at fluid port_b" | ||
annotation (Placement(transformation(extent={{-118,62},{-100,80}}), | ||
iconTransformation(extent={{-120,60},{-100,80}}))); | ||
|
||
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a solid | ||
"Heat port at solid interface" | ||
annotation ( | ||
Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=0), | ||
iconTransformation(extent={{-114,-10},{-94,10}}))); | ||
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b fluid | ||
"Heat port at fluid interface" | ||
annotation ( | ||
Placement(transformation(extent={{90,-10},{110,10}}, rotation=0), | ||
iconTransformation(extent={{86,-10},{106,10}}))); | ||
|
||
Modelica.SIunits.TemperatureDifference dT "= solid.T - fluid.T"; | ||
|
||
Modelica.SIunits.CoefficientOfHeatTransfer hCon | ||
"Convective heat transfer coefficient"; | ||
Modelica.SIunits.ThermalResistance RTot | ||
"Thermal resistance between the fluid and the fictious plane of heat transfer"; | ||
|
||
Modelica.SIunits.HeatFlowRate Q_flow "Heat flow rate from solid -> fluid"; | ||
|
||
protected | ||
Medium.ThermodynamicState fluSta = Medium.setState_pTX(p=Medium.p_default, T=fluid.T, X=Medium.X_default) | ||
"State of the medium"; | ||
Modelica.SIunits.SpecificHeatCapacity c_p = Medium.specificHeatCapacityCp(fluSta) | ||
"Specific heat capacity of the fluid"; | ||
equation | ||
hCon = Modelica.Fluid.Dissipation.HeatTransfer.StraightPipe.kc_overall_KC( | ||
IN_con=kc_IN_con, IN_var=kc_IN_var); | ||
RTot = 1/hCon/APip + RFic + RWal; | ||
|
||
if use_epsilon_NTU then | ||
Q_flow = Functions.heatFlowRate(T_a=T_a, | ||
T_b=T_b, | ||
T_s=solid.T, | ||
T_f=fluid.T, | ||
c_p=c_p, | ||
UA=1/RTot, | ||
m_flow=m_flow, | ||
m_flow_nominal=m_flow_nominal); | ||
else | ||
Q_flow = dT/RTot; | ||
end if; | ||
|
||
dT = solid.T - fluid.T; | ||
solid.Q_flow = Q_flow; | ||
fluid.Q_flow = -Q_flow; | ||
|
||
annotation (Icon(graphics={ | ||
Rectangle( | ||
extent={{-66,80},{94,-80}}, | ||
lineColor={255,255,255}, | ||
fillColor={255,255,255}, | ||
fillPattern=FillPattern.Solid), | ||
Rectangle( | ||
extent={{-88,80},{2,-82}}, | ||
lineColor={0,0,0}, | ||
fillColor={192,192,192}, | ||
fillPattern=FillPattern.Backward), | ||
Line(points={{96,0},{96,0}}, color={0,127,255}), | ||
Line(points={{-64,20},{72,20}}, color={191,0,0}), | ||
Line(points={{-64,-20},{72,-20}}, color={191,0,0}), | ||
Line(points={{36,80},{36,-80}}, color={0,127,255}), | ||
Line(points={{72,80},{72,-80}}, color={0,127,255}), | ||
Line(points={{52,-30},{72,-20}}, color={191,0,0}), | ||
Line(points={{52,-10},{72,-20}}, color={191,0,0}), | ||
Line(points={{52,10},{72,20}}, color={191,0,0}), | ||
Line(points={{52,30},{72,20}}, color={191,0,0}), | ||
Text( | ||
extent={{-145,140},{155,100}}, | ||
lineColor={0,0,255}, | ||
textString="%name")}), | ||
Documentation(info="<html> | ||
<p> | ||
Model to compute the convective heat transfer inside a straight pipe. | ||
The convective heat transfer coefficient is computed as a function of the mass flow rate | ||
using the function | ||
<a href=\"modelica://Modelica.Fluid.Dissipation.HeatTransfer.StraightPipe.kc_overall_KC\"> | ||
Modelica.Fluid.Dissipation.HeatTransfer.StraightPipe.kc_overall_KC</a>. | ||
</p> | ||
</html> | ||
", | ||
revisions="<html> | ||
<ul> | ||
<li> | ||
April 5, 2012, by Michael Wetter:<br/> | ||
Revised implementation. | ||
</li> | ||
<li> | ||
April 3, 2012, by Xiufeng Pang:<br/> | ||
First implementation. | ||
</li> | ||
</ul> | ||
</html>")); | ||
end PipeToSlabConductance; |
1 change: 1 addition & 0 deletions
1
...ildings_Fluid_HeatExchangers_RadiantSlabs_BaseClasses_Functions_Examples_HeatFlowRate.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
last-generated=2014-10-07 |
13 changes: 13 additions & 0 deletions
13
.../Dymola/Fluid/HeatExchangers/RadiantSlabs/BaseClasses/Functions/Examples/HeatFlowRate.mos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Script generated by Dymola Tue Oct 7 14:56:25 2014 | ||
// Plot commands | ||
simulateModel("Buildings.Fluid.HeatExchangers.RadiantSlabs.BaseClasses.Functions.Examples.HeatFlowRate", method="dassl", tolerance=1e-05, resultFile="HeatFlowRate"); | ||
createPlot(id=1, position={15, 10, 866, 489}, | ||
x="m_flow", | ||
y={"Q_flow"}, | ||
range={-0.1, 0.1, -5.0, 20.0}, grid=true, filename="HeatFlowRate.mat", leftTitleType=1, bottomTitleType=1, colors={{0,0,255}}); | ||
createPlot(id=1, | ||
position={15, 10, 866, 241}, | ||
x="m_flow", | ||
y={"T_s", "T_a", "T_b", "T_f"}, | ||
range={-0.1, 0.1, 20.0, 50.0}, grid=true, subPlot=2, leftTitleType=1, bottomTitleType=1, colors={{0,0,255}, {255,0,0}, {0,128,0}, {255,0,255}}); | ||
|