Buildings.Utilities.IO.BCVTB.Examples

Collection of models that illustrate model use and test models

Information


This package contains examples for the use of models
that can be found in 
Buildings.Utilities.IO.BCVTB.

Extends from Buildings.BaseClasses.BaseIconExamples (Icon for Examples packages).

Package Content

NameDescription
MoistAir Model with interfaces for media with moist air that will be linked to the BCVTB which models the response of the room
TwoRooms Thermal model of two rooms that will be linked to the BCVTB which models the controls


Buildings.Utilities.IO.BCVTB.Examples.MoistAir

Model with interfaces for media with moist air that will be linked to the BCVTB which models the response of the room

Buildings.Utilities.IO.BCVTB.Examples.MoistAir

Information


This example illustrates the use of Modelica with the Building Controls Virtual Test Bed.

The model represents an air-based heating system with an ideal heater and an ideal humidifier in the supply duct. The heater and humidifier are controlled with a feedback loop that tracks the room air temperature and room air humidity. These quantities are simulated in the EnergyPlus simulation program through the Building Controls Virtual Test Bed. The component bouBCVTB models the boundary between the domain that models the air system (in Modelica) and the room response (in EnergyPlus).

This model is implemented in bcvtb\examples\dymolaEPlusXY-singleZone, where XY denotes the EnergyPlus version number.



Parameters

TypeNameDefaultDescription
MassFlowRatem_flow_nominal259.2*6/1.2/3600Nominal mass flow rate [kg/s]

Modelica definition

model MoistAir 
  "Model with interfaces for media with moist air that will be linked to the BCVTB which models the response of the room"
  import Buildings;
 package Medium = Modelica.Media.Air.MoistAir;
  parameter Modelica.Media.Interfaces.PartialMedium.MassFlowRate m_flow_nominal
    = 259.2*6/1.2/3600 "Nominal mass flow rate";
  Buildings.Fluid.FixedResistances.FixedResistanceDpM dp1(
    redeclare package Medium = Medium,
    m_flow_nominal=m_flow_nominal,
    dp_nominal=200);
  Buildings.Fluid.Sources.Boundary_pT sou1(
    nPorts=1,
    redeclare package Medium = Medium,
    use_p_in=false,
    p(displayUnit="Pa") = 101325 + 4*200,
    use_T_in=true,
    use_X_in=true,
    T=293.15);
  inner Modelica.Fluid.System system;
  Buildings.Fluid.Sources.Boundary_pT sou2(
    nPorts=1,
    redeclare package Medium = Medium,
    use_p_in=false,
    p=101325,
    T=293.15);
  Buildings.Fluid.FixedResistances.FixedResistanceDpM dp2(
    redeclare package Medium = Medium,
    m_flow_nominal=m_flow_nominal,
    dp_nominal=200);
  Buildings.Utilities.IO.BCVTB.MoistAirInterface bouBCVTB(
    nPorts=2,
    redeclare package Medium = Medium,
    m_flow=0,
    use_m_flow_in=false);
  Buildings.Fluid.MassExchangers.HumidifierPrescribed hum(
    m_flow_nominal=m_flow_nominal,
    dp_nominal=200,
    redeclare package Medium = Medium,
    mWat0_flow=0.01*m_flow_nominal) "Humidifier";
  Buildings.Fluid.HeatExchangers.HeaterCoolerPrescribed hex(
    m_flow_nominal=m_flow_nominal,
    dp_nominal=200,
    redeclare package Medium = Medium,
    Q_flow_nominal=m_flow_nominal*50*1006) "Heat exchanger";
  Modelica.Blocks.Sources.Constant TWat(k=293.15);
  Buildings.Fluid.Sensors.Temperature TRet(redeclare package Medium = Medium) 
    "Return air temperature";
  Buildings.Fluid.Sensors.MassFraction XiWat(redeclare package Medium = Medium) 
    "Measured air humidity";
  Modelica.Blocks.Sources.Constant XSet(k=0.005) "Set point for humidity";
  Modelica.Blocks.Sources.Constant TRooSet(k=273.15 + 20) 
    "Set point for room air temperature";
  Modelica.Blocks.Continuous.LimPID PIDHea(
    yMax=1,
    yMin=0,
    controllerType=Modelica.Blocks.Types.SimpleController.PI,
    Ti=600,
    Td=1,
    k=0.1) "Controller for heating";
  Modelica.Blocks.Continuous.LimPID PIDHum(
    yMax=1,
    yMin=0,
    controllerType=Modelica.Blocks.Types.SimpleController.PI,
    k=20,
    Ti=60) "Controller for humidifier";
  Buildings.Utilities.IO.BCVTB.BCVTB bcvtb(
    samplePeriod=60,
    xmlFileName="socket.cfg",
    nDblRea=4,
    nDblWri=5,
    flaDblWri={1,1,1,1,1});
  Modelica.Blocks.Routing.DeMultiplex4 deMultiplex2_1(
    n1=1,
    n2=1,
    n3=1,
    n4=1);
  Modelica.Blocks.Sources.Constant uniCon(k=273.15) "Unit conversion";
  Modelica.Blocks.Math.Add add;
  Modelica.Blocks.Math.Add add1;
  Buildings.Utilities.Psychrometrics.ToTotalAir toTotalAir;
  Buildings.Utilities.Psychrometrics.ToTotalAir toTotalAir1;
  Modelica.Blocks.Routing.Multiplex5 mul;
  Buildings.Fluid.Sensors.Temperature TSup(redeclare package Medium = Medium) 
    "Supply air temperature";
  Modelica.Blocks.Math.Add add2(k2=-1);
equation 
  connect(sou2.ports[1], dp2.port_b);
  connect(dp1.port_b, bouBCVTB.ports[1]);
  connect(dp2.port_a, bouBCVTB.ports[2]);
  connect(TWat.y, hum.T_in);
  connect(sou1.ports[1], hex.port_a);
  connect(dp1.port_a, hum.port_b);
  connect(TRet.port, dp2.port_b);
  connect(XiWat.port, dp2.port_b);
  connect(hex.port_b, hum.port_a);
  connect(PIDHea.u_s, TRooSet.y);
  connect(TRet.T, PIDHea.u_m);
  connect(PIDHea.y, hex.u);
  connect(XSet.y, PIDHum.u_s);
  connect(XiWat.X, PIDHum.u_m);
  connect(PIDHum.y, hum.u);
  connect(bcvtb.yR, deMultiplex2_1.u);
  connect(uniCon.y, add.u1);
  connect(add.y, sou1.T_in);
  connect(deMultiplex2_1.y1[1], add.u2);
  connect(deMultiplex2_1.y2[1], add1.u2);
  connect(uniCon.y, add1.u1);
  connect(add1.y, bouBCVTB.T_in);
  connect(toTotalAir.XiTotalAir, bouBCVTB.XWat_totAir);
  connect(toTotalAir.XiDry, deMultiplex2_1.y4[1]);
  connect(toTotalAir1.XiTotalAir, sou1.X_in[1]);
  connect(toTotalAir1.XNonVapor, sou1.X_in[2]);
  connect(toTotalAir1.XiDry, deMultiplex2_1.y3[1]);
  connect(mul.y, bcvtb.uR);
  connect(PIDHum.y, mul.u4[1]);
  connect(PIDHea.y, mul.u3[1]);
  connect(mul.u1[1], bouBCVTB.HSen_flow);
  connect(bouBCVTB.HLat_flow, mul.u2[1]);
  connect(TSup.port, dp1.port_b);
  connect(add2.u1, TSup.T);
  connect(uniCon.y, add2.u2);
  connect(add2.y, mul.u5[1]);
end MoistAir;

Buildings.Utilities.IO.BCVTB.Examples.TwoRooms

Thermal model of two rooms that will be linked to the BCVTB which models the controls

Buildings.Utilities.IO.BCVTB.Examples.TwoRooms

Information


This example illustrates the use of Modelica with the Building Controls Virtual Test Bed.

Given a control signal for two heat flow rates, Modelica simulates the thermal response of two first order systems. The two systems may represent a first order approximation of a room. The control signal for the heat flow rate is computed in the Building Controls Virtual Test Bed using a discrete time implementation of a proportional controller. Every 60 seconds, measured temperatures and control signals for the heat flow rates are exchanged between Dymola and the Building Controls Virtual Test Bed.

This model is implemented in bcvtb\examples\dymola-room.



Parameters

TypeNameDefaultDescription
Timetau2*3600Room time constant [s]
HeatFlowRateQ_flow_nom100Nominal heat flow [W]
ThermalConductanceUAQ_flow_nom/20Thermal conductance of room [W/K]

Modelica definition

model TwoRooms 
  "Thermal model of two rooms that will be linked to the BCVTB which models the controls"
  import Buildings;
  parameter Modelica.SIunits.Time tau = 2*3600 "Room time constant";
  parameter Modelica.SIunits.HeatFlowRate Q_flow_nom = 100 "Nominal heat flow";
  parameter Modelica.SIunits.ThermalConductance UA = Q_flow_nom / 20 
    "Thermal conductance of room";
  Modelica.Thermal.HeatTransfer.Components.HeatCapacitor C1(C=tau*UA, T(start=
          283.15)) "Heat capacity of room";
  Modelica.Thermal.HeatTransfer.Components.ThermalConductor UA1(G=UA) 
    "Heat transmission of room";
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature TOut1(T=278.15) 
    "Outside air temperature";
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow Q_flow_1 
    "Heat input into the room";
  Modelica.Blocks.Math.Gain GaiQ_flow_nom1(k=Q_flow_nom) 
    "Gain for nominal heat load";
  Modelica.Thermal.HeatTransfer.Components.ThermalConductor UA2(G=UA) 
    "Heat transmission of room";
  Modelica.Thermal.HeatTransfer.Components.HeatCapacitor C2(C=2*tau*UA, T(start=
         283.15)) "Heat capacity of room";
  Modelica.Thermal.HeatTransfer.Sources.FixedTemperature TOut2(T=278.15) 
    "Outside air temperature";
  Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow Q_flow_2 
    "Heat input into the room";
  Modelica.Blocks.Math.Gain GaiQ_flow_nom2(k=Q_flow_nom) 
    "Gain for nominal heat load";
  Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor TRoo1 
    "Room temperature";
  Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor TRoo2 
    "Room temperature";
  Buildings.Utilities.IO.BCVTB.BCVTB bcvtb(
    samplePeriod=60,
    nDblWri=2,
    nDblRea=2,
    xmlFileName="socket.cfg");
  Modelica.Blocks.Routing.Multiplex2 multiplex2_1;
  Modelica.Blocks.Routing.DeMultiplex2 deMultiplex2_1;
  Modelica.Blocks.Math.Add add;
  Modelica.Blocks.Math.Add add1;
  Modelica.Blocks.Sources.Constant uniCon(k=-273.15) "Unit conversion";
equation 
  connect(TOut1.port, UA1.port_a);
  connect(UA1.port_b, C1.port);
  connect(TOut2.port, UA2.port_a);
  connect(UA2.port_b, C2.port);
  connect(Q_flow_1.port, C1.port);
  connect(Q_flow_2.port, C2.port);
  connect(C1.port, TRoo1.port);
  connect(C2.port, TRoo2.port);
  connect(GaiQ_flow_nom1.y, Q_flow_1.Q_flow);
  connect(GaiQ_flow_nom2.y, Q_flow_2.Q_flow);
  connect(bcvtb.yR, deMultiplex2_1.u);
  connect(deMultiplex2_1.y1[1], GaiQ_flow_nom1.u);
  connect(deMultiplex2_1.y2[1], GaiQ_flow_nom2.u);
  connect(multiplex2_1.y, bcvtb.uR);
  connect(uniCon.y, add.u2);
  connect(uniCon.y, add1.u1);
  connect(TRoo1.T, add.u1);
  connect(TRoo2.T, add1.u2);
  connect(add1.y, multiplex2_1.u2[1]);
  connect(add.y, multiplex2_1.u1[1]);
end TwoRooms;

HTML-documentation generated by Dymola Tue Sep 29 08:10:26 2009.