Buildings.Fluid.CHPs.Validation

Validation of the main model

Information

This package contains models that validate the model Buildings.Fluid.CHPs.ThermalElectricalFollowing.

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

Package Content

Name Description
Buildings.Fluid.CHPs.Validation.ElectricalFollowing ElectricalFollowing Validate model ElectricalFollowing
Buildings.Fluid.CHPs.Validation.ThermalFollowing ThermalFollowing Validate model ThermalElectricalFollowing

Buildings.Fluid.CHPs.Validation.ElectricalFollowing Buildings.Fluid.CHPs.Validation.ElectricalFollowing

Validate model ElectricalFollowing

Buildings.Fluid.CHPs.Validation.ElectricalFollowing

Information

This example validates Buildings.Fluid.CHPs.ThermalElectricalFollowing for the CHP unit simulation with the electricity demand priority.

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

Modelica definition

model ElectricalFollowing "Validate model ElectricalFollowing" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water; Buildings.Fluid.CHPs.ThermalElectricalFollowing eleFol( redeclare package Medium = Medium, redeclare Data.ValidationData3 per, m_flow_nominal=0.4, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, switchThermalElectricalFollowing=false, TEngIni=273.15 + 69.55, waitTime=0) "CHP unit with the electricity demand priority"; Modelica.Blocks.Sources.BooleanTable avaSig( startValue=true, table={172800}) "Plant availability signal"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, p(displayUnit="Pa"), nPorts=1) "Cooling water sink"; Buildings.Fluid.Sources.MassFlowSource_T cooWat( redeclare package Medium = Medium, use_m_flow_in=true, use_T_in=true, nPorts=1) "Cooling water source"; Buildings.Controls.OBC.CDL.Reals.Subtract dPEleNet "Absolute error for electric power generaton"; Buildings.Controls.OBC.CDL.Reals.Subtract dQGen "Absolute error for heat generaton"; Buildings.Controls.OBC.CDL.Reals.Subtract dQWat "Absolute error for heat transfer to water control volume"; Buildings.Controls.OBC.CDL.Reals.Subtract dQLos "Absolute error for heat loss to the surroundings"; Buildings.Controls.OBC.CDL.Reals.Subtract dTWatOut "Absolute error for water outlet temperature"; Buildings.Controls.OBC.CDL.Reals.Subtract dTEng "Absolute error for engine temperature"; Modelica.Blocks.Sources.RealExpression PEleNet( final y=eleFol.PEleNet) "Electric power generation"; Modelica.Blocks.Sources.RealExpression QGen(final y=eleFol.eneCon.QGen_flow) "Heat generation"; Modelica.Blocks.Sources.RealExpression QWat( final y=eleFol.QWat_flow) "Heat transfer to the water control volume"; Modelica.Blocks.Sources.RealExpression QLos( final y=eleFol.QLos.Q_flow) "Heat loss to the surrounding"; Modelica.Blocks.Sources.RealExpression TWatOut( final y=eleFol.vol.T) "Water outlet temperature"; Modelica.Blocks.Sources.RealExpression TEng( final y=eleFol.eng.TEng) "Engine temperature"; Buildings.HeatTransfer.Sources.PrescribedTemperature preTem "Variable temperature boundary condition in Kelvin"; Modelica.Blocks.Sources.CombiTimeTable valDat( tableOnFile=true, tableName="tab1", extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic, y(unit={"W", "kg/s", "degC", "degC", "W", "W", "W", "W", "W", "degC", "degC", "degC"}), offset={0,0,0,0,0,0,0,0,0,0,0,0}, columns={2,3,4,5,6,7,8,9,10,11,12,13}, smoothness=Modelica.Blocks.Types.Smoothness.MonotoneContinuousDerivative1, fileName=ModelicaServices.ExternalReferences.loadResource( "modelica://Buildings/Resources/Data/Fluid/CHPs/Validation/MicroCogeneration.mos")) "Validation data from EnergyPlus simulation"; Buildings.Controls.OBC.UnitConversions.From_degC TWatIn "Convert cooling water inlet temperature from degC to kelvin"; Buildings.Controls.OBC.UnitConversions.From_degC TRoo "Convert zone temperature from degC to kelvin"; Buildings.Controls.OBC.UnitConversions.From_degC TWatOutVal "Convert cooling water outplet temperature from degC to kelvin"; Buildings.Controls.OBC.UnitConversions.From_degC TEngVal "Convert engine temperature from degC to kelvin"; Modelica.Blocks.Routing.RealPassThrough PEleNetVal "Validation data for power output"; Modelica.Blocks.Routing.RealPassThrough QGenVal_flow "Validation data for heat generation rate"; Modelica.Blocks.Routing.RealPassThrough QWatVal_flow "Validation data for heat flow rate to water"; Modelica.Blocks.Routing.RealPassThrough QLosVal_flow "Validation data for heat flow rate to ambient"; Modelica.Blocks.Continuous.Integrator EEle(y(unit="J")) "Electrical energy generated"; Modelica.Blocks.Continuous.Integrator EThe(y(unit="J")) "Thermal energy recovered"; Modelica.Blocks.Continuous.Integrator EEleVal(y(unit="J")) "Validation data for electrical energy generated"; Modelica.Blocks.Continuous.Integrator ETheVal(y(unit="J")) "Validation data for thermal energy recovered"; equation connect(eleFol.port_b, sin.ports[1]); connect(avaSig.y, eleFol.avaSig); connect(cooWat.ports[1], eleFol.port_a); connect(PEleNet.y, dPEleNet.u1); connect(QGen.y, dQGen.u1); connect(QWat.y, dQWat.u1); connect(QLos.y, dQLos.u1); connect(TWatOut.y, dTWatOut.u1); connect(dTEng.u1, TEng.y); connect(preTem.port, eleFol.TRoo); connect(valDat.y[2], cooWat.m_flow_in); connect(valDat.y[3], TWatIn.u); connect(TWatIn.y, cooWat.T_in); connect(valDat.y[4], TRoo.u); connect(TRoo.y, preTem.T); connect(valDat.y[10], TWatOutVal.u); connect(valDat.y[11], TEngVal.u); connect(TWatOutVal.y, dTWatOut.u2); connect(TEngVal.y, dTEng.u2); connect(valDat.y[1], eleFol.PEleDem); connect(QGenVal_flow.y, dQGen.u2); connect(PEleNetVal.y, dPEleNet.u2); connect(valDat.y[5], PEleNetVal.u); connect(valDat.y[7], QGenVal_flow.u); connect(QWatVal_flow.y, dQWat.u2); connect(valDat.y[8], QWatVal_flow.u); connect(QLosVal_flow.y, dQLos.u2); connect(valDat.y[9], QLosVal_flow.u); connect(eleFol.PEleNet, EEle.u); connect(eleFol.QWat_flow, EThe.u); connect(QWatVal_flow.y, ETheVal.u); connect(PEleNetVal.y, EEleVal.u); end ElectricalFollowing;

Buildings.Fluid.CHPs.Validation.ThermalFollowing Buildings.Fluid.CHPs.Validation.ThermalFollowing

Validate model ThermalElectricalFollowing

Buildings.Fluid.CHPs.Validation.ThermalFollowing

Information

This example validates Buildings.Fluid.CHPs.ThermalElectricalFollowing for the CHP unit simulation with the thermal demand priority.

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

Modelica definition

model ThermalFollowing "Validate model ThermalElectricalFollowing" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water; Buildings.Fluid.CHPs.ThermalElectricalFollowing theFol( redeclare package Medium = Medium, m_flow_nominal=0.4, redeclare Data.Senertech5_5kW per, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, TEngIni=273.15 + 69.55, waitTime=0) "CHP unit with the thermal demand priority"; Modelica.Blocks.Sources.BooleanTable avaSig( startValue=true, table={172800}) "Plant availability signal"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, p(displayUnit="Pa"), nPorts=2) "Cooling water sink"; Buildings.Fluid.Sources.MassFlowSource_T cooWat( redeclare package Medium = Medium, use_m_flow_in=true, use_T_in=true, nPorts=1) "Cooling water source"; Buildings.Controls.OBC.CDL.Reals.Subtract dPEleNet "Absolute error for electric power generaton"; Buildings.Controls.OBC.CDL.Reals.Subtract dQWat "Absolute error for heat transfer to water control volume"; Buildings.Controls.OBC.CDL.Reals.Subtract dTWatOut "Absolute error for water outlet temperature"; Modelica.Blocks.Sources.RealExpression PEleNet( final y=theFol.PEleNet) "Electric power generation"; Modelica.Blocks.Sources.RealExpression QWat( final y=theFol.QWat_flow) "Heat transfer to the water control volume"; Modelica.Blocks.Sources.RealExpression TWatOut(final y=theFol.TWatOut.T) "Water outlet temperature"; HeatTransfer.Sources.PrescribedTemperature preTem "Variable temperature boundary condition in Kelvin"; Buildings.Controls.OBC.CDL.Reals.Subtract dTEng "Absolute error for engine temperature"; Modelica.Blocks.Sources.RealExpression TEng( final y=theFol.eng.TEng) "Engine temperature"; Buildings.Controls.OBC.CDL.Reals.Subtract dQLos "Absolute error for heat loss to the surroundings"; Modelica.Blocks.Sources.RealExpression QLos( final y=theFol.QLos.Q_flow) "Heat loss to the surrounding"; Buildings.Controls.OBC.CDL.Reals.Subtract dQGen "Absolute error for heat generaton"; Modelica.Blocks.Sources.RealExpression QGen( final y=theFol.eneCon.QGen_flow) "Heat generation"; Modelica.Blocks.Sources.CombiTimeTable valDat( tableOnFile=true, tableName="tab1", extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic, y(unit={"W","kg/s","degC","degC","W","W","W","W","W","degC","degC","degC"}), offset={0,0,0,0,0,0,0,0,0,0,0,0}, columns={2,3,4,5,6,7,8,9,10,11,12,13}, smoothness=Modelica.Blocks.Types.Smoothness.MonotoneContinuousDerivative1, fileName=ModelicaServices.ExternalReferences.loadResource("modelica://Buildings/Resources/Data/Fluid/CHPs/Validation/MicroCogeneration.mos")) "Validation data from EnergyPlus simulation"; Buildings.Controls.OBC.UnitConversions.From_degC TRoo "Convert zone temperature from degC to kelvin"; Buildings.Controls.OBC.UnitConversions.From_degC TWatIn "Convert cooling water inlet temperature from degC to kelvin"; Buildings.Controls.OBC.UnitConversions.From_degC TWatOutSet "Convert outlet water setpoint temperature from degC to kelvin "; Buildings.Controls.OBC.UnitConversions.From_degC TEngVal "Convert engine temperature from degC to kelvin"; Buildings.Controls.OBC.UnitConversions.From_degC TWatOutVal "Convert cooling water outplet temperature from degC to kelvin"; Sources.MassFlowSource_T cooWatNeg( redeclare package Medium = Medium, use_m_flow_in=true, use_T_in=true, nPorts=1) "Cooling water source"; ThermalElectricalFollowing theFolNeg( redeclare package Medium = Medium, m_flow_nominal=0.4, redeclare Data.Senertech5_5kW per, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, TEngIni=273.15 + 69.55, waitTime=0) "CHP unit with the thermal demand priority and negative water mass flow rate"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant mWat_flow_negative( final k=-1) "Negative water mass flow rate for validation only"; Modelica.Blocks.Routing.RealPassThrough PEleNetVal "Validation data for power output"; Modelica.Blocks.Routing.RealPassThrough QGenVal_flow "Validation data for heat generation rate"; Modelica.Blocks.Routing.RealPassThrough QWatVal_flow "Validation data for heat flow rate to water"; Modelica.Blocks.Routing.RealPassThrough QLosVal_flow "Validation data for heat flow rate to ambient"; Modelica.Blocks.Continuous.Integrator EEle(y(unit="J")) "Electrical energy generated"; Modelica.Blocks.Continuous.Integrator EThe(y(unit="J")) "Thermal energy recovered"; Modelica.Blocks.Continuous.Integrator EEleVal(y(unit="J")) "Validation data for electrical energy generated"; Modelica.Blocks.Continuous.Integrator ETheVal(y(unit="J")) "Validation data for thermal energy recovered"; protected Modelica.Blocks.Sources.BooleanExpression theFolSig( final y=true) "Signal for thermal following, set to false if electrical following"; equation connect(theFol.port_b, sin.ports[1]); connect(avaSig.y,theFol. avaSig); connect(cooWat.ports[1],theFol. port_a); connect(PEleNet.y, dPEleNet.u1); connect(QWat.y, dQWat.u1); connect(theFolSig.y,theFol. theFol); connect(preTem.port, theFol.TRoo); connect(QLos.y,dQLos. u1); connect(QGen.y,dQGen. u1); connect(valDat.y[2], cooWat.m_flow_in); connect(valDat.y[3], TWatIn.u); connect(TWatIn.y, cooWat.T_in); connect(valDat.y[4], TRoo.u); connect(TRoo.y, preTem.T); connect(valDat.y[12], TWatOutSet.u); connect(TWatOutSet.y,theFol. TWatOutSet); connect(TWatOutVal.y, dTWatOut.u2); connect(TWatOut.y, dTWatOut.u1); connect(TEng.y, dTEng.u1); connect(TEngVal.y, dTEng.u2); connect(valDat.y[10], TWatOutVal.u); connect(valDat.y[11], TEngVal.u); connect(valDat.y[1],theFol. PEleDem); connect(cooWatNeg.ports[1], theFolNeg.port_a); connect(theFolNeg.port_b, sin.ports[2]); connect(mWat_flow_negative.y, cooWatNeg.m_flow_in); connect(avaSig.y, theFolNeg.avaSig); connect(theFolSig.y, theFolNeg.theFol); connect(valDat.y[1], theFolNeg.PEleDem); connect(TWatOutSet.y, theFolNeg.TWatOutSet); connect(TWatIn.y, cooWatNeg.T_in); connect(valDat.y[5], PEleNetVal.u); connect(PEleNetVal.y, dPEleNet.u2); connect(valDat.y[7], QGenVal_flow.u); connect(QGenVal_flow.y, dQGen.u2); connect(valDat.y[8], QWatVal_flow.u); connect(QWatVal_flow.y, dQWat.u2); connect(valDat.y[9], QLosVal_flow.u); connect(QLosVal_flow.y, dQLos.u2); connect(PEleNetVal.y, EEleVal.u); connect(QWatVal_flow.y, ETheVal.u); connect(theFol.PEleNet, EEle.u); connect(theFol.QWat_flow, EThe.u); end ThermalFollowing;