Example models to test base classes
Information
Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).
Package Content
Name |
Description |
BoreholeSegment
|
Model that tests a basic segment that is used to build a borehole |
ConvectionResistance
|
Model that tests a basic segment that is used to build a borehole |
ExchangeValues
|
Test problem for the function that exchanges values |
HexInternalElement
|
Model that tests the basic element that is used to built borehole models |
SingleUTubeBoundaryCondition
|
Test model the temperature boundary condition of a single U tube heat exchanger |
SingleUTubeResistances
|
Model that tests the resistances in the borehole |
Model that tests a basic segment that is used to build a borehole
Information
This example illustrates modeling a segment of a borehole heat exchanger.
It simulates the behavior of the borehole on a single horizontal section including the ground and the
boundary condition.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
Bentonite | bento | | Borehole filling material |
Modelica definition
model BoreholeSegment
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Water ;
parameter Buildings.HeatTransfer.Data.BoreholeFillings.Bentonite bento
;
Buildings.Fluid.Geothermal.Boreholes.BaseClasses.BoreholeSegment seg(
redeclare package Medium = Medium,
matFil=bento,
m_flow_nominal=0.2,
dp_nominal=5,
rTub=0.02,
eTub=0.002,
rBor=0.1,
rExt=3,
nSta=9,
samplePeriod=604800,
kTub=0.5,
hSeg=10,
xC=0.05,
redeclare Buildings.HeatTransfer.Data.Soil.Concrete matSoi,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyStateInitial,
TFil_start=283.15,
TExt_start=283.15) ;
Fluid.Sources.Boundary_pT sou_1(
redeclare package Medium = Medium,
nPorts=1,
use_T_in=false,
p=101340,
T=303.15) ;
Buildings.Fluid.Sources.Boundary_pT sin_2(
redeclare package Medium = Medium,
use_p_in=false,
use_T_in=false,
nPorts=1,
p=101330,
T=283.15) ;
equation
connect(sou_1.ports[1], seg.port_a1);
connect(seg.port_b1, seg.port_a2);
connect(seg.port_b2, sin_2.ports[1]);
end BoreholeSegment;
Model that tests a basic segment that is used to build a borehole
Information
This example tests the function for the convective thermal resistance
inside the pipe.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
SpecificHeatCapacity | cpMed | Medium.specificHeatCapacityC... | Specific heat capacity of the fluid [J/(kg.K)] |
ThermalConductivity | kMed | Medium.thermalConductivity(M... | Thermal conductivity of the fluid [W/(m.K)] |
DynamicViscosity | mueMed | Medium.dynamicViscosity(Medi... | Dynamic viscosity of the fluid [Pa.s] |
MassFlowRate | m_flow_nominal | 3000/10/4200 | Nominal mass flow rate [kg/s] |
Modelica definition
model ConvectionResistance
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Water ;
parameter Modelica.SIunits.SpecificHeatCapacity cpMed=
Medium.specificHeatCapacityCp(
Medium.setState_pTX(
Medium.p_default,
Medium.T_default,
Medium.X_default)) ;
parameter Modelica.SIunits.ThermalConductivity kMed=
Medium.thermalConductivity(
Medium.setState_pTX(
Medium.p_default,
Medium.T_default,
Medium.X_default)) ;
parameter Modelica.SIunits.DynamicViscosity mueMed=
Medium.dynamicViscosity(
Medium.setState_pTX(
Medium.p_default,
Medium.T_default,
Medium.X_default)) ;
parameter Modelica.SIunits.MassFlowRate m_flow_nominal=
3000/10/4200 ;
Modelica.SIunits.MassFlowRate m_flow ;
Modelica.SIunits.ThermalResistance R
;
protected
constant Real conv(unit="1/s")=1 ;
equation
m_flow =m_flow_nominal*(time - 0.5)*2*conv;
R =
Buildings.Fluid.Geothermal.Boreholes.BaseClasses.convectionResistance(
hSeg=10,
rTub=0.02,
kMed=kMed,
mueMed=mueMed,
cpMed=cpMed,
m_flow=m_flow,
m_flow_nominal=m_flow_nominal);
end ConvectionResistance;
Test problem for the function that exchanges values
Information
This example tests the function
Buildings.Fluid.Geothermal.Boreholes.BaseClasses.exchangeValues by
assigning and reading different elements of the array.
The assert statements check whether the returned values is correct.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
Real | x | 3 | |
Modelica definition
model ExchangeValues
extends Modelica.Icons.Example;
parameter Real x = 3;
Real y;
Buildings.Fluid.Geothermal.Boreholes.BaseClasses.ExtendableArray table=
Buildings.Fluid.Geothermal.Boreholes.BaseClasses.ExtendableArray()
;
algorithm
y :=
Buildings.Fluid.Geothermal.Boreholes.BaseClasses.exchangeValues(
table=table, iX=1, x=x, iY=1);
assert(
abs(y-3) < 1E-10, "Error in implementation of exchangeVaules.");
y :=
Buildings.Fluid.Geothermal.Boreholes.BaseClasses.exchangeValues(
table=table, iX=2, x=4*x, iY=1);
assert(
abs(y-3) < 1E-10, "Error in implementation of exchangeVaules.");
y :=
Buildings.Fluid.Geothermal.Boreholes.BaseClasses.exchangeValues(
table=table, iX=2, x=4*x, iY=2);
assert(
abs(y-12) < 1E-10, "Error in implementation of exchangeVaules.");
y :=
Buildings.Fluid.Geothermal.Boreholes.BaseClasses.exchangeValues(
table=table, iX=200, x=5*x, iY=1);
assert(
abs(y-3) < 1E-10, "Error in implementation of exchangeVaules.");
y :=
Buildings.Fluid.Geothermal.Boreholes.BaseClasses.exchangeValues(
table=table, iX=10, x=6*x, iY=200);
assert(
abs(y-15) < 1E-10, "Error in implementation of exchangeVaules.");
y :=
Buildings.Fluid.Geothermal.Boreholes.BaseClasses.exchangeValues(
table=table, iX=10, x=6*x, iY=1);
assert(
abs(y-3) < 1E-10, "Error in implementation of exchangeVaules.");
end ExchangeValues;
Model that tests the basic element that is used to built borehole models
Information
This example illustrates modeling the internal part of a borehole heat exchanger.
The borehole is constitued with two pipes that are symetricaly spaced in the borehole.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Modelica definition
model HexInternalElement
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Water ;
Buildings.Fluid.Geothermal.Boreholes.BaseClasses.HexInternalElement hex(
redeclare package Medium = Medium,
m1_flow_nominal=0.3,
m2_flow_nominal=0.3,
rTub=0.02,
kTub=0.5,
rBor=0.1,
xC=0.025,
kSoi=3.1,
dp1_nominal=5,
dp2_nominal=5,
hSeg=20,
redeclare parameter Buildings.HeatTransfer.Data.BoreholeFillings.Bentonite matFil,
redeclare parameter Buildings.HeatTransfer.Data.Soil.Sandstone matSoi,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
TFil_start=283.15);
Buildings.Fluid.Sources.Boundary_pT sou_1(
redeclare package Medium = Medium,
nPorts=1,
use_T_in=false,
p=101340,
T=303.15);
Buildings.Fluid.Sources.Boundary_pT sin_2(
redeclare package Medium = Medium,
nPorts=1,
use_p_in=false,
use_T_in=false,
p=101330,
T=283.15);
equation
connect(sou_1.ports[1], hex.port_a1);
connect(hex.port_b1, hex.port_a2);
connect(hex.port_b2, sin_2.ports[1]);
end HexInternalElement;
Test model the temperature boundary condition of a single U tube heat exchanger
Information
This example tests the temperature boundary condition at the external part of a cylinder.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
HeatFlowRate | Q_flow | -50 | Heat flow rate extracted at center of cylinder [W] |
Modelica definition
model SingleUTubeBoundaryCondition
extends Modelica.Icons.Example;
parameter Modelica.SIunits.HeatFlowRate Q_flow=-50
;
Buildings.Fluid.Geothermal.Boreholes.BaseClasses.SingleUTubeBoundaryCondition
TBouSte(
final rExt=3,
final samplePeriod=604800,
hSeg=1,
redeclare final Buildings.HeatTransfer.Data.Soil.Sandstone matSoi,
TExt_start=293.15) ;
Modelica.Blocks.Sources.Step step(
height=Q_flow,
offset=0,
startTime=0);
Buildings.Fluid.Geothermal.Boreholes.BaseClasses.SingleUTubeBoundaryCondition
TBouCon(
final rExt=3,
final samplePeriod=604800,
hSeg=1,
redeclare final Buildings.HeatTransfer.Data.Soil.Sandstone matSoi,
TExt_start=293.15) ;
Modelica.Blocks.Sources.Constant con(k=Q_flow);
Buildings.Fluid.Geothermal.Boreholes.BaseClasses.SingleUTubeBoundaryCondition
TBouPul(
final rExt=3,
final samplePeriod=604800,
hSeg=1,
redeclare final Buildings.HeatTransfer.Data.Soil.Sandstone matSoi,
TExt_start=293.15) ;
Modelica.Blocks.Sources.Pulse pulse(
offset=0,
startTime=0,
amplitude=2*Q_flow,
period=7200);
equation
connect(con.y, TBouCon.Q_flow);
connect(step.y, TBouSte.Q_flow);
connect(pulse.y, TBouPul.Q_flow);
end SingleUTubeBoundaryCondition;
Model that tests the resistances in the borehole
Information
This example tests the thermal resistances in the borehole.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Parameters
Type | Name | Default | Description |
Height | hSeg | 1 | Height of the element [m] |
Radius | rBor | 0.2 | Radius of the borehole [m] |
ThermalResistance | Rgb | Rgb( ... | Thermal resistance between grout zone and borehole wall [K/W] |
ThermalResistance | Rgg | Rgg( ... | Thermal resistance between the two grout zones [K/W] |
ThermalResistance | RCondGro | RCondGro( ... | Thermal resistance of the pipe wall [K/W] |
Real | x | x( fixed=fa... | Capacity location |
Soil |
Granite | matSoi | redeclare parameter Building... | Thermal properties of soil |
Filling material |
Bentonite | matFil | redeclare parameter Building... | Thermal properties of the filling material |
Tubes |
Radius | rTub | 0.02 | Radius of the tubes [m] |
ThermalConductivity | kTub | 0.5 | Thermal conductivity of the tube [W/(m.K)] |
Length | eTub | 0.002 | Thickness of a tube [m] |
Borehole |
Length | xC | 0.05 | Shank spacing, defined as the distance between the center of a pipe and the center of the borehole [m] |
Modelica definition
model SingleUTubeResistances
extends Modelica.Icons.Example;
package Medium =
Buildings.Media.Water ;
replaceable parameter Buildings.HeatTransfer.Data.Soil.Granite matSoi
;
replaceable parameter Buildings.HeatTransfer.Data.BoreholeFillings.Bentonite matFil
;
parameter Modelica.SIunits.Height hSeg=1 ;
parameter Modelica.SIunits.Radius rBor=0.2 ;
parameter Modelica.SIunits.Radius rTub=0.02 ;
parameter Modelica.SIunits.ThermalConductivity kTub=0.5
;
parameter Modelica.SIunits.Length eTub=0.002 ;
parameter Modelica.SIunits.Length xC=0.05
;
parameter Modelica.SIunits.ThermalResistance Rgb(fixed=false)
;
parameter Modelica.SIunits.ThermalResistance Rgg(fixed=false)
;
parameter Modelica.SIunits.ThermalResistance RCondGro(fixed=false)
;
parameter Real x(fixed=false) ;
initial equation
(Rgb, Rgg, RCondGro, x) =
Buildings.Fluid.Geothermal.Boreholes.BaseClasses.singleUTubeResistances(
hSeg=hSeg,
rBor=rBor,
rTub=rTub,
eTub=eTub,
xC=xC,
kSoi=matSoi.k,
kFil=matFil.k,
kTub=kTub);
end SingleUTubeResistances;