Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples

Example models to test base classes

Information

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

Package Content

NameDescription
Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.BoreholeSegment BoreholeSegment Model that tests a basic segment that is used to built a borehole
Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.Factorial Factorial Test the function factorial
Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.HexInternalElement HexInternalElement Model that tests the basic element that is used to built borehole models
Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.SingleUTubeBoundaryCondition SingleUTubeBoundaryCondition Test model the temperature boundary condition of a single U tube heat exchanger
Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.ExchangeValues ExchangeValues Test problem for the function that exchanges values


Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.BoreholeSegment Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.BoreholeSegment

Model that tests a basic segment that is used to built a borehole

Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.BoreholeSegment

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).

Modelica definition

model BoreholeSegment 
  "Model that tests a basic segment that is used to built a borehole"
  import Buildings;
  extends Modelica.Icons.Example;
   inner Modelica.Fluid.System system;
 package Medium = Buildings.Media.ConstantPropertyLiquidWater;
 Buildings.HeatTransfer.Data.BoreholeFilling.Bentonite                    bento;
 Buildings.Fluid.HeatExchangers.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,
    B0=17.44,
    B1=-0.605,
    nSta=9,
    samplePeriod=604800,
    kTub=0.5,
    hSeg=10,
    xC=0.05,
    redeclare Buildings.HeatTransfer.Data.Soil.Concrete matSoi,
    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);
 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;

Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.Factorial Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.Factorial

Test the function factorial

Information

This example tests the function Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.factorial.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Integerx[:]{1,2,3,4,5} 

Modelica definition

model Factorial "Test the function factorial"
 extends Modelica.Icons.Example;
  parameter Integer x[:] = {1, 2, 3, 4, 5};
  Integer y[5];
equation 
  y = Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.factorial(x);
  assert(abs(120-y[5]) < 1E-10, "Error: Factorial function yields wrong result.");
end Factorial;

Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.HexInternalElement Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.HexInternalElement

Model that tests the basic element that is used to built borehole models

Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.HexInternalElement

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 
  "Model that tests the basic element that is used to built borehole models"
  extends Modelica.Icons.Example;
  inner Modelica.Fluid.System system;
  import Buildings;
  package Medium = Buildings.Media.ConstantPropertyLiquidWater;
  Buildings.Fluid.HeatExchangers.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,
    B0=21.91,
    B1=-0.3796,
    dp1_nominal=5,
    dp2_nominal=5,
    hSeg=20,
    redeclare Buildings.HeatTransfer.Data.BoreholeFilling.Bentonite matFil,
    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;

Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.SingleUTubeBoundaryCondition Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.SingleUTubeBoundaryCondition

Test model the temperature boundary condition of a single U tube heat exchanger

Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.SingleUTubeBoundaryCondition

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

TypeNameDefaultDescription
HeatFlowRateQ_flow-50Heat flow rate extracted at center of cylinder [W]

Modelica definition

model SingleUTubeBoundaryCondition 
  "Test model the temperature boundary condition of a single U tube heat exchanger"
  extends Modelica.Icons.Example;
  import Buildings;
  parameter Modelica.SIunits.HeatFlowRate  Q_flow=-50 
    "Heat flow rate extracted at center of cylinder";
  Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.SingleUTubeBoundaryCondition
                                                TBouSte(
  final rExt=3,
  final samplePeriod=604800,
    hSeg=1,
    redeclare final Buildings.HeatTransfer.Data.Soil.Sandstone matSoi,
    TExt_start=293.15) "Boundary condition";
 Modelica.Blocks.Sources.Step step(
    height=Q_flow,
    offset=0,
    startTime=0);
  Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.SingleUTubeBoundaryCondition
    TBouCon(
    final rExt=3,
    final samplePeriod=604800,
    hSeg=1,
    redeclare final Buildings.HeatTransfer.Data.Soil.Sandstone matSoi,
    TExt_start=293.15) "Boundary condition";
 Modelica.Blocks.Sources.Constant con(k=Q_flow);
  Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.SingleUTubeBoundaryCondition
    TBouPul(
    final rExt=3,
    final samplePeriod=604800,
    hSeg=1,
    redeclare final Buildings.HeatTransfer.Data.Soil.Sandstone matSoi,
    TExt_start=293.15) "Boundary condition";
 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;

Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.ExchangeValues Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.Examples.ExchangeValues

Test problem for the function that exchanges values

Information

This example tests the function Buildings.Fluid.HeatExchangers.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

TypeNameDefaultDescription
Realx3 

Modelica definition

model ExchangeValues 
  "Test problem for the function that exchanges values"
 extends Modelica.Icons.Example;
  parameter Real x = 3;
  Real y;
  Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.ExtendableArray table=
    Buildings.Fluid.HeatExchangers.Boreholes.BaseClasses.ExtendableArray() 
    "Extentable array, used to store history of rate of heat flows";

algorithm 
  y := Buildings.Fluid.HeatExchangers.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.HeatExchangers.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.HeatExchangers.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.HeatExchangers.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.HeatExchangers.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.HeatExchangers.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;

Automatically generated Fri Nov 4 08:27:31 2011.