blockExtractStagingMatrix

Extract staging matrix at current stage index of opposite operating mode

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

TypeNameDefaultDescription
Real[:,:]staPartially flattened (2D) staging matrix [(nSta+1)*nSta, nEqu], row-major over (iHea, iCoo)
Booleanis_transposefalseSet to true to output the transpose of the staging matrix
IntegernRowsize(sta, 1)Number of rows
IntegernEqusize(sta, 2)Equipment count
IntegernStainteger((1 + sqrt(1 + 4*nRow))/2) - 1Number of stage
IntegernOutnEqu*nStaIntermediary parameter for matrix operations

Connectors

TypeNameDefaultDescription
Buildings.Controls.OBC.CDL.Interfaces.IntegerInputuStage 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

TypeNameDefaultDescription
Buildings.Controls.OBC.CDL.Reals.Sources.Constant[nOut,nRow]conStaCooPer-output column of sta (selected by iEqu)
Buildings.Controls.OBC.CDL.Routing.RealExtractor[nOut]extIndReaScalar extraction along the row dimension
Buildings.Controls.OBC.CDL.Integers.Sources.ConstantnStaCst
Buildings.Controls.OBC.CDL.Integers.MultiplymulInt(u-1)*nSta
Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicatorintScaRep
Buildings.Controls.OBC.CDL.Integers.Sources.Constant[nOut]offCstPer-output iCoo (row within heating stage)
Buildings.Controls.OBC.CDL.Integers.Add[nOut]addIntAdd offset to stage index
Buildings.Controls.OBC.CDL.Routing.RealExtractSignal[if is_transpose then nEqu else nSta]extReaSigExtract staging matrix
Buildings.Controls.OBC.CDL.Routing.RealVectorReplicatorreaVecRepReplicate for extraction at next step

Revisions

  • July 10, 2026, by Antoine Gautier:
    First implementation.