blockStagingParameters
Information
This block pre-computes all staging parameters for a plant with nHP standard reversible heat pumps and nPHP polyvalent heat pumps (capable of simultaneous heating and cooling, SHC).
Fundamental assumptions
Within each equipment set (reversible HPs and polyvalent HPs), all units are assumed to be equally sized and are treated as lead/lag alternates. Adding one unit of either type therefore contributes one additional stage of capacity, so the maximum number of plant stages is nSta = nHP + nPHP. Heating and cooling stages are tracked independently, each ranging over {0, …, nSta}, since the same pool of units can serve either load.
For each combination of active heating and cooling stages (iHea, iCoo) with iHea, iCoo ∈ {0, …, nSta}, the block resolves how many units operate in each mode by applying the following assignment rules in order.
1. SHC assignment
Polyvalent HPs are assigned to simultaneous heating and cooling first, saturating at the available count and at the smaller of the two stage indices (since each SHC unit satisfies one heating stage and one cooling stage simultaneously):
nSHCPHP = min(min(iHea, iCoo), nPHP)
The residual heating and cooling stages after SHC assignment are:
iresHea = iHea - nSHCPHP, iresCoo = iCoo - nSHCPHP
2. Heating assignment
Standard HPs cover the residual heating stage first:
nHeaHP = min(iresHea, nHP)
Any remaining residual heating stage is covered by polyvalent HPs operating in heating-only mode (drawn from those not already in SHC):
nHeaPHP = min(iresHea - nHeaHP, nPHP - nSHCPHP)
3. Cooling assignment
Standard HPs not used for heating are assigned to the residual cooling stage:
nCooHP = min(iresCoo, nHP - nHeaHP)
Remaining polyvalent HPs (neither in SHC nor heating-only) cover any unmet cooling stage:
nCooPHP = min(iresCoo - nCooHP, nPHP - nSHCPHP - nHeaPHP)
Feasibility
A stage combination is feasible if and only if both residual stages are fully covered by the assigned units:
iresHea = nHeaHP + nHeaPHP and iresCoo = nCooHP + nCooPHP
Combinations that cannot be satisfied with the available equipment (e.g.,
requiring more simultaneous heating and cooling stages than there are
polyvalent HPs) are flagged in is_feasible and receive zero
weights in the staging matrices.
Staging matrices
The parameters staCoo and staHea pack feasible
stage combinations into matrices consumed by the equipment enable logic.
Each has (nSta + 1) × nSta rows (one per
non-zero stage transition) and
nHP + 2 nPHP columns, ordered as: standard
HPs | polyvalent HPs (cooling- or heating-only) | polyvalent HPs (SHC).
For staCoo, row r corresponds to
iHea = ⌊(r - 1) / nSta⌋
(outer index, 0 ≤ iHea ≤ nSta) and
iCoo = (r - 1) mod nSta + 1
(inner index, 1 ≤ iCoo ≤ nSta). Column values are normalized fractions, as specified in the
documentation of
Buildings.Templates.Plants.Controls.StagingRotation.EquipmentEnable.:
- Columns 1 … nHP: nCooHP / max(nHP, 1)
- Columns nHP + 1 … nHP + nPHP: nCooPHP / max(nPHP, 1)
- Columns nHP + nPHP + 1 … nHP + 2 nPHP: nSHCPHP / max(nPHP, 1)
A row of zeros indicates an infeasible stage combination.
staHea follows the same column layout but with
iCoo as the outer index and iHea
as the inner index, and the heating counts substituted for the cooling
counts.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | nHp | Number of HP (excluding polyvalent HP) | |
| Integer | nPhp | Number of polyvalent HP | |
| Integer | nSta | nHp + nPhp | Number of cooling or heating stages (excluding stage 0) |
| Integer[nSta + 1,nSta + 1] | staPhp | {min(iHea, iCoo) for iCoo in 0:nSta, iHea in 0:nSta} | Minimum between cooling and heating stage |
| Integer[nSta + 1,nSta + 1] | staHeaRes | {iHea - nPhpShc[iHea + 1, iCoo + 1] for iCoo in 0:nSta, iHea in 0:nSta} | Residual heating stage count after SHC assignment |
| Integer[nSta + 1,nSta + 1] | staCooRes | {iCoo - nPhpShc[iHea + 1, iCoo + 1] for iCoo in 0:nSta, iHea in 0:nSta} | Residual cooling stage count after SHC assignment |
| Integer[nSta + 1,nSta + 1] | nHpAva | {nHp - nHpHea[iHea + 1, iCoo + 1] for iCoo in 0:nSta, iHea in 0:nSta} | Number of HP still available after heating assignment |
| Integer[nSta + 1,nSta + 1] | nPhpAva | {nPhp - nPhpShc[iHea + 1, iCoo + 1] for iCoo in 0:nSta, iHea in 0:nSta} | Number of polyvalent HP still available after SHC assignment |
| Integer[nSta + 1,nSta + 1] | nHpHea | {min(staHeaRes[iHea + 1, iCoo + 1], nHp) for iCoo in 0:nSta, iHea in 0:nSta} | Number of HP in heating mode |
| Integer[nSta + 1,nSta + 1] | nHpCoo | {min(staCooRes[iHea + 1, iCoo + 1], nHpAva[iHea + 1, iCoo + 1]) for iCoo in 0:nSta, iHea in 0:nSta} | Number of HP in cooling mode |
| Integer[nSta + 1,nSta + 1] | nPhpHea | {min(staHeaRes[iHea + 1, iCoo + 1] - nHpHea[iHea + 1, iCoo + 1], nPhpAva[iHea + 1, iCoo + 1]) for iCoo in 0:nSta, iHea in 0:nSta} | Number of polyvalent HP in heating-only mode |
| Integer[nSta + 1,nSta + 1] | nPhpCoo | {min(staCooRes[iHea + 1, iCoo + 1] - nHpCoo[iHea + 1, iCoo + 1], nPhpAva[iHea + 1, iCoo + 1] - nPhpHea[iHea + 1, iCoo + 1]) for iCoo in 0:nSta, iHea in 0:nSta} | Number of polyvalent HP in cooling-only mode |
| Integer[nSta + 1,nSta + 1] | nPhpShc | {min(staPhp[iHea + 1, iCoo + 1], nPhp) for iCoo in 0:nSta, iHea in 0:nSta} | Number of polyvalent HP in SHC mode |
| Boolean[nSta + 1,nSta + 1] | is_feasible | {(staHeaRes[iHea + 1, iCoo + 1] - nHpHea[iHea + 1, iCoo + 1] - nPhpHea[iHea + 1, iCoo + 1] == 0) and (staCooRes[iHea + 1, iCoo + 1] - nHpCoo[iHea + 1, iCoo + 1] - nPhpCoo[iHea + 1, iCoo + 1] == 0) for iCoo in 0:nSta, iHea in 0:nSta} | True if the stage combination is achievable |
| Real[(nSta + 1)*nSta,nHp + 2*nPhp] | staCoo | {(if not is_feasible[div(r - 1, nSta) + 1, mod(r - 1, nSta) + 2] then 0 elseif iEqu <= nHp then nHpCoo[div(r - 1, nSta) + 1, mod(r - 1, nSta) + 2]/max(nHp, 1) elseif iEqu <= nHp + nPhp then nPhpCoo[div(r - 1, nSta) + 1, mod(r - 1, nSta) + 2]/max(nPhp, 1) else nPhpShc[div(r - 1, nSta) + 1, mod(r - 1, nSta) + 2]/max(nPhp, 1)) for iEqu in 1:nHp + 2*nPhp, r in 1:(nSta + 1)*nSta} | Cooling staging matrix – row-major over (0≤iHea outer, 1≤iCoo inner), 0 if infeasible |
| Real[(nSta + 1)*nSta,nHp + 2*nPhp] | staHea | {(if not is_feasible[mod(r - 1, nSta) + 2, div(r - 1, nSta) + 1] then 0 elseif iEqu <= nHp then nHpHea[mod(r - 1, nSta) + 2, div(r - 1, nSta) + 1]/max(nHp, 1) elseif iEqu <= nHp + nPhp then nPhpHea[mod(r - 1, nSta) + 2, div(r - 1, nSta) + 1]/max(nPhp, 1) else nPhpShc[mod(r - 1, nSta) + 2, div(r - 1, nSta) + 1]/max(nPhp, 1)) for iEqu in 1:nHp + 2*nPhp, r in 1:(nSta + 1)*nSta} | Heating staging matrix – row-major over (0≤iCoo outer, 1≤iHea inner), 0 if infeasible |
Revisions
-
July 10, 2026, by Antoine Gautier:
First implementation.