blockExtractStagingMatrix
Information
Given the pre-computed staging matrix sta (either
staCoo or staHea from
Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.StagingParameters)
and the current stage index u of the opposite operating mode, this
block extracts the corresponding
nSta × nEqu slice of normalized equipment
fractions for all non-zero stages of the primary mode.
The number of stages nSta is recovered from the row count nRow = (nSta + 1) ⋅ nSta by solving the resulting quadratic:
nSta = ⌊(1 + √(1 + 4 ⋅ nRow)) / 2⌋ - 1
nEqu equals the number of columns.
The output matrix corresponds to that specified in the documentation of Buildings.Templates.Plants.Controls.StagingRotation.EquipmentEnable and can therefore be consumed by this block.
If is_transpose = true, the block outputs the transpose of the
staging matrix, with dimensions
nEqu × nSta.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real[:,:] | sta | Partially flattened (2D) staging matrix [(nSta+1)*nSta, nEqu], row-major over (iHea, iCoo) | |
| Boolean | is_transpose | false | Set to true to output the transpose of the staging matrix |
| Integer | nRow | size(sta, 1) | Number of rows |
| Integer | nEqu | size(sta, 2) | Equipment count |
| Integer | nSta | integer((1 + sqrt(1 + 4*nRow))/2) - 1 | Number of stage |
| Integer | nOut | nEqu*nSta | Intermediary parameter for matrix operations |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Buildings.Controls.OBC.CDL.Interfaces.IntegerInput | u | Stage index of opposite mode (from 0 to stage number) | |
| Buildings.Controls.OBC.CDL.Interfaces.RealOutput[if is_transpose then nEqu else nSta,if is_transpose then nSta else nEqu] | y |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Buildings.Controls.OBC.CDL.Reals.Sources.Constant[nOut,nRow] | conStaCoo | Per-output column of sta (selected by iEqu) | |
| Buildings.Controls.OBC.CDL.Routing.RealExtractor[nOut] | extIndRea | Scalar extraction along the row dimension | |
| Buildings.Controls.OBC.CDL.Integers.Sources.Constant | nStaCst | ||
| Buildings.Controls.OBC.CDL.Integers.Multiply | mulInt | (u-1)*nSta | |
| Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator | intScaRep | ||
| Buildings.Controls.OBC.CDL.Integers.Sources.Constant[nOut] | offCst | Per-output iCoo (row within heating stage) | |
| Buildings.Controls.OBC.CDL.Integers.Add[nOut] | addInt | Add offset to stage index | |
| Buildings.Controls.OBC.CDL.Routing.RealExtractSignal[if is_transpose then nEqu else nSta] | extReaSig | Extract staging matrix | |
| Buildings.Controls.OBC.CDL.Routing.RealVectorReplicator | reaVecRep | Replicate for extraction at next step |
Revisions
-
July 10, 2026, by Antoine Gautier:
First implementation.