Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.Validation

Information

This package contains validation models.

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

Package Content

Name Description
Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.Validation.AssertMinimumRuntime AssertMinimumRuntime Validation model for the assertion of minimum runtime and off-time
Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.Validation.ExtractStagingMatrix ExtractStagingMatrix  
Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.Validation.ModeAlternation ModeAlternation Validation model for SHC and single mode alternation

Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.Validation.AssertMinimumRuntime Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.Validation.AssertMinimumRuntime

Validation model for the assertion of minimum runtime and off-time

Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.Validation.AssertMinimumRuntime

Information

This model validates Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.AssertMinimumRuntime for the following configurations, each with a minimum runtime or off-time dt_min=15 s.

Modelica definition

model AssertMinimumRuntime "Validation model for the assertion of minimum runtime and off-time" Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.AssertMinimumRuntime assRunTim( use_runTim=true, nUni=2, dt_min=15) "Assert minimum runtime"; Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable u1Hea( table=[0, 1, 0; 8, 0, 1; 40, 1, 0; 70, 0, 0], timeScale=1, period=100) "Polyvalent HP heating on/off command"; Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable u1Coo( table=[0, 0, 1; 20, 1, 1; 50, 0, 0], timeScale=1, period=100) "Polyvalent HP cooling on/off command"; Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.AssertMinimumRuntime assOffTim( use_runTim=false, nUni=1, dt_min=15) "Assert minimum off-time"; Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable u1HeaOff( table=[0, 1; 20, 0; 30, 1; 50, 0], timeScale=1, period=100) "Polyvalent HP heating on/off command"; Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable u1CooOff( table=[0, 0; 25, 1; 70, 0], timeScale=1, period=100) "Polyvalent HP cooling on/off command"; equation connect(u1Hea.y, assRunTim.u1Hea); connect(u1Coo.y, assRunTim.u1Coo); connect(u1HeaOff.y, assOffTim.u1Hea); connect(u1CooOff.y, assOffTim.u1Coo); end AssertMinimumRuntime;

Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.Validation.ExtractStagingMatrix Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.Validation.ExtractStagingMatrix


Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.Validation.ExtractStagingMatrix

Information

This model validates Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.StagingParameters and Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.ExtractStagingMatrix in a configuration with two reversible heat pumps and two polyvalent heat pumps.

The parameters staHea and staCoo independently reconstruct, from the equipment count matrices computed by StagingParameters, the per-mode staging matrices. At initialization, these matrices are compared against the ones internally computed by StagingParameters for every feasible combination of heating and cooling stage, and against each other, which validates the internal consistency of StagingParameters.

The heating stage index is cycled through every stage over the course of the simulation, and is used to extract the cooling staging matrix and its transpose at the current heating stage. At initialization, i.e., at heating stage 0, the extracted matrices are compared against the independently reconstructed reference staCoo, which validates ExtractStagingMatrix for both the direct and the transposed extraction.

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

Parameters

TypeNameDefaultDescription
IntegernHp2Number of HP (excluding polyvalent HP)
IntegernPhp2Number of polyvalent HP
RealcapHeaHp_nominal1E5Design heating capacity - Each heat pump (excluding polyvalent HP)
RealcapCooHp_nominal(1 - 1/Buildings.Templates.D...Design cooling capacity - Each heat pump (excluding polyvalent HP)
RealcapHeaPhp_nominal1.3E5Design heating capacity - Each polyvalent heat pump
RealcapCooPhp_nominal(1 - 1/Buildings.Templates.D...Design cooling capacity - Each polyvalent heat pump
RealcapHeaShcPhp_nominalBuildings.Templates.Data.Def...Design heating capacity in SHC mode - Each polyvalent heat pump
RealcapCooShcPhp_nominal(1 - 1/Buildings.Templates.D...Design cooling capacity in SHC mode - Each polyvalent heat pump
RealcapCooSta_nominal[nSta + 1, nSta + 1]staPhp.nHpCoo*capCooHp_nomin...Cooling capacity at each stage
RealcapHeaSta_nominal[nSta + 1, nSta + 1]staPhp.nHpHea*capHeaHp_nomin...Heating capacity at each stage
RealstaCoo[nSta + 1, nSta, nHp + 2*nPhp]{cat(1, fill(staPhp.nHpCoo[i...Cooling staging matrix – Varies with heating stage
RealstaHea[nSta + 1, nSta, nHp + 2*nPhp]{cat(1, fill(staPhp.nHpHea[i...Heating staging matrix – Varies with cooling stage

Modelica definition

model ExtractStagingMatrix extends Modelica.Icons.Example; parameter Integer nHp = 2 "Number of HP (excluding polyvalent HP)"; parameter Integer nPhp = 2 "Number of polyvalent HP"; final parameter Integer nSta = nHp + nPhp "Number of cooling or heating stages (excluding stage 0)"; parameter Real capHeaHp_nominal = 1E5 "Design heating capacity - Each heat pump (excluding polyvalent HP)"; parameter Real capCooHp_nominal = (1 - 1 / Buildings.Templates.Data.Defaults.COPHpAwHea) * capHeaHp_nominal "Design cooling capacity - Each heat pump (excluding polyvalent HP)"; parameter Real capHeaPhp_nominal = 1.3E5 "Design heating capacity - Each polyvalent heat pump"; parameter Real capCooPhp_nominal = (1 - 1 / Buildings.Templates.Data.Defaults.COPHpAwHea) * capHeaPhp_nominal "Design cooling capacity - Each polyvalent heat pump"; parameter Real capHeaShcPhp_nominal = Buildings.Templates.Data.Defaults.COPHpWwHea / Buildings.Templates.Data.Defaults.COPHpAwHea * capHeaPhp_nominal "Design heating capacity in SHC mode - Each polyvalent heat pump"; parameter Real capCooShcPhp_nominal = (1 - 1 / Buildings.Templates.Data.Defaults.COPHpWwHea) * capHeaShcPhp_nominal "Design cooling capacity in SHC mode - Each polyvalent heat pump"; parameter Real capCooSta_nominal[nSta + 1, nSta + 1] = staPhp.nHpCoo * capCooHp_nominal .+ staPhp.nPhpCoo * capCooPhp_nominal .+ staPhp.nPhpShc * capCooShcPhp_nominal "Cooling capacity at each stage"; parameter Real capHeaSta_nominal[nSta + 1, nSta + 1] = staPhp.nHpHea * capHeaHp_nominal .+ staPhp.nPhpHea * capHeaPhp_nominal .+ staPhp.nPhpShc * capHeaShcPhp_nominal "Heating capacity at each stage"; // Columns are for equipment tags, duplicating polyvalent units for cooling-only and SHC mode indexing // NOT CDL compliant because 3D array! parameter Real staCoo[nSta + 1, nSta, nHp + 2 * nPhp] = {cat( 1, fill(staPhp.nHpCoo[iHea, iCoo + 1] / max(nHp, 1), nHp), fill(staPhp.nPhpCoo[iHea, iCoo + 1] / max(nPhp, 1), nPhp), fill( staPhp.nPhpShc[iHea, iCoo + 1] / max(nPhp, 1), nPhp)) for iCoo in 1:nSta, iHea in 1:nSta + 1} "Cooling staging matrix – Varies with heating stage"; parameter Real staHea[nSta + 1, nSta, nHp + 2 * nPhp] = {cat( 1, fill(staPhp.nHpHea[iHea + 1, iCoo] / max(nHp, 1), nHp), fill(staPhp.nPhpHea[iHea + 1, iCoo] / max(nPhp, 1), nPhp), fill( staPhp.nPhpShc[iHea + 1, iCoo] / max(nPhp, 1), nPhp)) for iHea in 1:nSta, iCoo in 1:nSta + 1} "Heating staging matrix – Varies with cooling stage"; Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.StagingParameters staPhp( final nHp=nHp, final nPhp=nPhp) "Staging parameters"; Buildings.Controls.OBC.CDL.Integers.Sources.TimeTable iHea( table={{i * iHea.timeScale, i} for i in 0:nSta}, timeScale=1 / (nSta + 1), period=1); Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.ExtractStagingMatrix extSta( final sta=staPhp.staCoo) "Extract cooling staging matrix at given heating stage"; Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.ExtractStagingMatrix extStaTra( final sta=staPhp.staCoo, is_transpose=true) "Extract transpose of cooling staging matrix at given heating stage"; initial algorithm for iOut in 1:nSta + 1, iInn in 1:nSta, iEqu in 1:nHp + 2 * nPhp loop if staPhp.is_feasible[iOut, iInn + 1] then assert( abs( staPhp.staCoo[(iOut - 1) * nSta + iInn, iEqu] - staCoo[iOut, iInn, iEqu]) < Modelica.Constants.small, "Mismatch"); assert( abs( staPhp.staHea[(iOut - 1) * nSta + iInn, iEqu] - staHea[iOut, iInn, iEqu]) < Modelica.Constants.small, "Mismatch"); assert( abs(staHea[iOut, iInn, iEqu] - staCoo[iOut, iInn, iEqu]) < Modelica.Constants.small, "Mismatch"); end if; end for; for iCoo in 1:nSta, iEqu in 1:nHp + 2 * nPhp loop assert( abs(staCoo[iHea.y[1] + 1, iCoo, iEqu] - extSta.y[iCoo, iEqu]) < Modelica.Constants.small, "Mismatch"); assert( abs(staCoo[iHea.y[1] + 1, iCoo, iEqu] - extStaTra.y[iEqu, iCoo]) < Modelica.Constants.small, "Mismatch"); end for; equation connect(iHea.y[1], extSta.u); connect(iHea.y[1], extStaTra.u); end ExtractStagingMatrix;

Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.Validation.ModeAlternation Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.Validation.ModeAlternation

Validation model for SHC and single mode alternation

Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.Validation.ModeAlternation

Information

This model validates Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.ModeAlternation in a configuration with two polyvalent heat pumps and a constant runtime order idxSor={1, 2}.

The number of units staged in each mode and the corresponding enable commands of each unit are varied over time to exercise both types of stage transition anticipated by this block.

Parameters

TypeNameDefaultDescription
IntegernPhp2Number of polyvalent units

Modelica definition

model ModeAlternation "Validation model for SHC and single mode alternation" parameter Integer nPhp = 2 "Number of polyvalent units"; Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.ModeAlternation selModPhp( final nPhp=nPhp) "Mode alternation"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant idxSor[nPhp]( k={i for i in 1:nPhp}) "Runtime order"; Buildings.Controls.OBC.CDL.Integers.Sources.TimeTable nHea( table=[0, 0; 20, 1; 40, 2; 60, 1; 80, 0], timeScale=1, period=150) "Number of units staged in heating mode"; Buildings.Controls.OBC.CDL.Integers.Sources.TimeTable nCoo( table=[0, 0; 100, 1; 120, 0], timeScale=1, period=150) "Number of units staged in cooling mode"; Buildings.Controls.OBC.CDL.Integers.Sources.TimeTable nShc( table=[0, 0; 60, 1; 80, 0; 120, 1; 140, 0], timeScale=1, period=150) "Number of units staged in SHC mode"; Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable u1Hea( table=[0, 0, 0; 20, 1, 0; 40, 1, 1; 60, 1, 0; 80, 0, 0], timeScale=1, period=150) "Enable command in heating mode"; Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable u1Coo( table=[0, 0, 0; 100, 1, 0; 120, 0, 0], timeScale=1, period=150) "Enable command in cooling mode"; Buildings.Controls.OBC.CDL.Logical.Sources.TimeTable u1Shc( table=[0, 0, 0; 60, 0, 1; 80, 0, 0; 120, 1, 0; 140, 0, 0], timeScale=1, period=150) "Enable command in SHC mode"; equation connect(idxSor.y, selModPhp.uIdxSor); connect(nHea.y[1], selModPhp.nHea); connect(nCoo.y[1], selModPhp.nCoo); connect(nShc.y[1], selModPhp.nShc); connect(u1Hea.y, selModPhp.u1Hea); connect(u1Coo.y, selModPhp.u1Coo); connect(u1Shc.y, selModPhp.u1Shc); end ModeAlternation;