FB_HVACPowerRangeTable

FB_HVACPowerRangeTable 1:

Application

Application

This function block represents a power range table and serves the sequential control of power generators such as boilers or refrigerating machines. The power steps are determined by the upstream controller FB_HVACI_Ctrl_Step and transferred to the power range table via the input iStep.

All information or parameters relevant to system control are summarized in the power range table ARRAY arrPowerRangeTable. The power range table is a two-dimensional array with the structure ST_HVACPowerRange. The power range table can be compared to a normal table. An individual element is clearly designated by naming line and column. The columns are marked by the field range 1..g_iMaxNumberOfProfiles. This range is called the profile and is addressed via the input variable iProfile. The field range 0..g_iMaxNumberOfSteps represents the lines. This range is called the step and is addressed via the input variable iStep.

The power range table consists of 16 profiles. Each profile can have up to 33 steps, from 0 to 32. Each individual step contains the parameter structure ST_HVACPowerRange needed for system control. The parameters indicated here are transferred via the output structures stI_Ctrl and stAggregate1-6 to the function block FB_HVACI_CtrlStep for controlling the steps and to the function blocks for power generation.

How many steps are in a profile is specified via the output variable iNumberOfStepInProfile.The number depends on the entries in the power range table and on the specification of the selected profile iCurrentProfile.Internally, the selected profile is checked from step 1 to the step in which all variables of the structure ST_HVACPowerRange have the value 0. iNumberOfStepInProfile is always determined for the given profile only. iNumberOfStepInProfile can thus be used as a limitation of the steps in a profile for other function blocks such as for the input iNumberOfStepInProfile of the FB_HVACI_CtrlStep, which could control the individual steps of the FB_HVACPowerRangeTable via its output iStep. The step 0 is not taken into account when evaluating the number of steps via iNumberOfStepInProfile, because the power generators are switched off in this step; it can be considered to be a standby step. The values of the variables of the output structures stAggregate1-6 then output the value 0. In the standby step, the parameters required for starting the power step sequence of the energy generators are transferred to the upstream controller FB_HVACI_Ctrl_Step via the output structure stI_Ctrl.

Table example for the power range table arrPowerRangeTable

Within a profile (table columns), an aggregate is assigned to each power step.
This determines the order in which the power generators are switched on or off within a sequence.
The power of the aggregates is specified from 0 to 6 for stepped power generators or from 0 to 100% for constant power generators.
After switching to a higher or lower power step, the integral component of the upstream function block FB_HVACI_Ctrl_Step is reinitialized. The current values for the step-up and step-down integrals are then transferred to the controller by means of the structure stI_Ctrl.
It is possible to switch to a different profile for a change of order of the aggregates within the sequence. By skilfully entering different orders of the aggregates in the profiles, it is possible to react with the utmost flexibility to all requirements with regard to the control of power generators.
The switching of the power profiles (iCurrentProfile) usually takes place on the basis of time or operating hours so that all power generators in a plant are utilized evenly.
For power generators with different nominal power, the power profile is changed depending on the load.

FB_HVACPowerRangeTable 2:

If an aggregate within a generator group is faulty, it is possible to switch to a profile in which the faulty generator is placed at the end of the power order.


FB_HVACPowerRangeTable 3:


The power range table shows three power profiles. The order of the power generators is entered in each power profile.

Profile 1:
in profile 1, aggregate 1 is switched to the first power step in power step 1. In the second power step, aggregate 2 is added with its first power step.

Profile 2:
in profile 2, aggregate 3 is switched to the first power step in power step 1. In the second power step, aggregate 3 is switched in its second power step. In the third power step, aggregate 1 is added with its first power step.

Profile 3:
in profile 3, aggregate 5 is switched to the first power step in power step 1. In the second power step, aggregate 4 is added with its first power step. In the third power step, aggregate 3 is added with its first power step.

By skillful arrangement of the power profiles, it is possible to react to faults in individual aggregates, the operating-hour dependent change of order or the load-optimized change of power orders.

The relationship between the power range table arrPowerRange and the output structures stAggregate1-6 and stI_Ctrl is to be described in greater detail on the basis of the table example:

  1. The column iCurrentProfile= 1 is intended to represent the first profile of the power range table arrPowerRange. In this profile the output iNumberOfStepInProfile has the value 2, because in the line iCurrentStep= 3 no variable value of the structure ST_HVACPowerRange(marked red) is greater than 0.
    If we assume that the current power step iCurrentStep has the value 2, the variable values are output at the output structures as follows:
  2. arrPowerRangeTable[] iCurrentProfile,iCurrentStep;

    stAggregate1.iAggregateStep :=arrPowerRangeTable[,].iAggregateStep11;
    stAggregate1.rY_Max
    := arrPowerRangeTable[,].rY_Max11;
    stAggregate1.rY_Min
    :=arrPowerRangeTable[,].rY_Min11;
    stAggregate1.bBlock
    := arrPowerRangeTable[,].bBlock11;
  3. stAggregate2.iAggregateStep :=arrPowerRangeTable[,].iAggregateStep12;
    stAggregate2.rY_Max
    := arrPowerRangeTable[,].rY_Max12;
    stAggregate2.rY_Min
    :=arrPowerRangeTable[,].rY_Min12;
    stAggregate2.bBlock
    := arrPowerRangeTable[,].bBlock12;
  4. stI_Ctrl.rIntegralHigh := arrPowerRangeTable[,].rIntegralHigh12;
    stI_Ctrl.rIntegralLow := arrPowerRangeTable[,].rIntegralLow12;
    stI_Ctrl.udiSecDelayHigh :=arrPowerRangeTable[,].udiSecDelayHigh12;
    stI_Ctrl.udiSecDelayLow :=arrPowerRangeTable[,].udiSecDelayLow12;
  5. Contents of the output structures stAggregate1, stAggregate2 and stI_Ctrl. The variables of the output structures stAggregate3-6 have the value 0.
  6. stAggregate1.iAggregateStep :=1;
    stAggregate1.rY_Max
    := 0;
    stAggregate1.rY_Min
    :=0;
    stAggregate1.bBlock
    := FALSE;
  7. stAggregate2.iAggregateStep :=1;
    stAggregate2.rY_Max
    := 0;
    stAggregate2.rY_Min
    :=0;
    stAggregate2.bBlock
    := TRUE;
  8. stI_Ctrl.rIntegralHigh := 10;
    stI_Ctrl.rIntegralLow := 10;
    stI_Ctrl.udiSecDelayHigh :=300;
    stI_Ctrl.udiSecDelayLow :=300;
  9. The column iCurrentProfile= 2 is intended to represent the second profile of the power range table arrPowerRange. In this profile the output iNumberOfStepInProfile has the value 3, because in the line iCurrentStep= 4 no variable value of the structure ST_HVACPowerRange(marked red) is greater than 0.
    If we assume that the current power step iCurrentStep has the value 3, the variable values are output at the output structures as follows:
  10. arrPowerRangeTable[] iCurrentProfile,iCurrentStep;

    stAggregate1.iAggregateStep :=arrPowerRangeTable[,].iAggregateStep23;
    stAggregate1.rY_Max
    := arrPowerRangeTable[,].rY_Max23;
    stAggregate1.rY_Min
    :=arrPowerRangeTable[,].rY_Min23;
    stAggregate1.bBlock
    := arrPowerRangeTable[,].bBlock23;
  11. stAggregate3.iAggregateStep :=arrPowerRangeTable[,.iAggregateStep22];
    stAggregate3.rY_Max
    := arrPowerRangeTable[,].rY_Max22;
    stAggregate3.rY_Min
    :=arrPowerRangeTable[,].rY_Min22;
    stAggregate3.bBlock
    := arrPowerRangeTable[,].bBlock22;
  12. stI_Ctrl.rIntegralHigh := arrPowerRangeTable[,].rIntegralHigh23;
    stI_Ctrl.rIntegralLow := arrPowerRangeTable[,].rIntegralLow23;
    stI_Ctrl.udiSecDelayHigh :=arrPowerRangeTable[,].udiSecDelayHigh23;
    stI_Ctrl.udiSecDelayLow :=arrPowerRangeTable[,].udiSecDelayLow23;
  13. Contents of the output structures stAggregate1, stAggregate3 and stI_Ctrl. The variables of the output structures stAggregate2 and stAggregate4-6 have the value 0.
  14. stAggregate1.iAggregateStep :=1;
    stAggregate1.rY_Max
    := 0;
    stAggregate1.rY_Min
    :=0;
    stAggregate1.bBlock
    := FALSE;
  15. stAggregate3.iAggregateStep :=2;
    stAggregate3.rY_Max
    := 60;
    stAggregate3.rY_Min
    :=30;
    stAggregate3.bBlock
    := FALSE;
  16. stI_Ctrl.rIntegralHigh := 8;
    stI_Ctrl.rIntegralLow := 8;
    stI_Ctrl.udiSecDelayHigh :=23;
    stI_Ctrl.udiSecDelayLow :=123;
  17. The column iCurrentProfile= 3 is intended to represent the third profile of the power range table arrPowerRange. In this profile the output iNumberOfStepInProfile has the value 3, because in the line iCurrentStep= 4 no variable value of the structure ST_HVACPowerRange(marked red) is greater than 0.
    If we assume that the current power step iCurrentStep has the value 3, the variable values are output at the output structures as follows:
  18. arrPowerRangeTable[] iCurrentProfile,iCurrentStep;

    stAggregate3.iAggregateStep :=arrPowerRangeTable[,].iAggregateStep33;
    stAggregate3.rY_Max
    := arrPowerRangeTable[,].rY_Max33;
    stAggregate3.rY_Min
    :=arrPowerRangeTable[,].rY_Min33;
    stAggregate3.bBlock
    := arrPowerRangeTable[,].bBlock33;
  19. stAggregate4.iAggregateStep :=arrPowerRangeTable[,.iAggregateStep32];
    stAggregate4.rY_Max
    := arrPowerRangeTable[,].rY_Max32;
    stAggregate4.rY_Min
    :=arrPowerRangeTable[,].rY_Min32;
    stAggregate4.bBlock
    := arrPowerRangeTable[,].bBlock32;

    stAggregate5.iAggregateStep :=arrPowerRangeTable[,.iAggregateStep31];
    stAggregate5.rY_Max
    := arrPowerRangeTable[,].rY_Max31;
    stAggregate5.rY_Min
    :=arrPowerRangeTable[,].rY_Min31;
    stAggregate5.bBlock
    := arrPowerRangeTable[,].bBlock31;
  20. stI_Ctrl.rIntegralHigh := arrPowerRangeTable[,].rIntegralHigh33;
    stI_Ctrl.rIntegralLow := arrPowerRangeTable[,].rIntegralLow33;
    stI_Ctrl.udiSecDelayHigh :=arrPowerRangeTable[,].udiSecDelayHigh33;
    stI_Ctrl.udiSecDelayLow :=arrPowerRangeTable[,].udiSecDelayLow33;
  21. Contents of the output structures stAggregate3, stAggregate4, stAggregate5 and stI_Ctrl. The variables of the output structures stAggregate1, stAggregate2 and stAggregate6 have the value 0.
  22. stAggregate3.iAggregateStep :=1;
    stAggregate3.rY_Max
    := 0;
    stAggregate3.rY_Min
    :=0;
    stAggregate3.bBlock
    := FALSE;
  23. stAggregate4.iAggregateStep :=1;
    stAggregate4.rY_Max
    := 0;
    stAggregate4.rY_Min
    :=0;
    stAggregate4.bBlock
    := TRUE;
  24. stAggregate5.iAggregateStep :=1;
    stAggregate5.rY_Max
    := 0;
    stAggregate5.rY_Min
    :=0;
    stAggregate5.bBlock
    := FALSE;
  25. stI_Ctrl.rIntegralHigh := 7;
    stI_Ctrl.rIntegralLow := 7;
    stI_Ctrl.udiSecDelayHigh :=400;
    stI_Ctrl.udiSecDelayLow :=200;

Output structure stI_Ctrl adjusted to the example

FB_HVACPowerRangeTable 4:

Output structures stAggregate1-6 adjusted to the example

FB_HVACPowerRangeTable 5:

Application example

The application example shows the function block FB_HVACPowerRangeTable in conjunction with the I transfer element FB_HVACI_CtrlStep. The example is illustrated in the programming languages ST and CFC. The program example P_CFC_I_CtrlStep.PRG for the CFC programming languages can be found in the folder Language CFC > Controller, the program example P_ST_I_CtrlStep.PRG for the ST programming languages in the folder Language Structured Text > Controller.

Download

Required library

TcHVAC.pro

TcHVAC.lib

VAR_INPUT

eDataSecurityType    : E_HVACDataSecurityType;
bEnable              : BOOL;
iNumberOfProfiles    : INT;
iProfile             : INT;
iStep                : INT;
eCtrlModeProfile     : E_HVACCtrlMode;
iManualProfile       : INT;
eCtrlModeStep        : E_HVACCtrlMode;
iManualStep          : INT;
iNumberOfAggregates  : INT;
bReset               : BOOL;

eDataSecurityType:if eDataSecurityType:= eHVACDataSecurityType_Persistent, the persistent VAR_IN_OUT variables of the function block are stored in the flash of the computer if a value changes. For this to work, the function block FB_HVACPersistentDataHandling must be instanced once in the main program, which is called cyclically. Otherwise the instanced FB is not released internally.

A change of value can be initiated by the building management system, a local operating device or via a write access from TwinCAT. When the computer is restarted, the saved data are automatically read back from the flash into the RAM.

Application example: FB_HVACPowerRangeTable 6:Example_PERSISTENT.zip

If eDataSecurityType:= eHVACDataSecurityType_Idle the persistently declared variables are not saved in a fail-safe manner.

Notice

A cyclically changing variable must never be linked with the IN_OUT variable of a function block, if eDataSecurityType:= eHVACDataSecurityType_Persistent. It would lead to early wear of the flash memory.

bEnable: the function block is enabled via TRUE. If bEnable = FALSE, then all output variables and output structures are set constantly to 0. The checking of the variables iNumberOfProfiles, iProfile, iStep, iNumberOfStepInProfile, iNumberOfAggregates, arrPowerRangeTable[X,X].iAggregate, arrPowerRangeTable[X,X].iAggregateSteps, arrPowerRangeTable[iP,iS].udiSecDelayHigh, and arrPowerRangeTable[iP,iS].udiSecDelayLow remains active. If an error occurs, it is displayed with bError = TRUE and can be acknowledged with bReset once the fault has been corrected.

iNumberOfProfiles: number of parameterized profiles in the power range table arrPowerRangeTable. The indication of the number of profiles must not be lower than g_iMinNumberOfProfiles and must not be greater than g_iMaxNumberOfProfiles. Otherwise an error is indicated by bError = TRUE and the execution of the function block is stopped.

iProfile: indicates the current profile with which the function block from the power range table arrPowerRangeTable[iCurrentProfile,iCurrentStep] is working. If eCtrlModeProfile = eHVACCtrlMode_Auto, then iCurrentProfile = iProfile. The indication of the profile must not be lower than g_iMinNumberOfProfiles and must not be greater than iNumberOfProfiles. Otherwise an error is indicated by bError = TRUE and the execution of the function block is stopped.

iStep: indicates the current step with which the function block from the power range table arrPowerRangeTable[iCurrentProfile,]iCurrentStep is working. If eCtrlModeStep = eHVACCtrlMode_Auto, then iCurrentStep = iStep. The indication of the steps must not be lower than g_iMinNumberOfStep and must not be greater than iNumberOfStepInProfile. Otherwise an error is indicated by bError = TRUE and the execution of the function block is stopped.

eCtrlModeProfile: the input variable via which the profile from the power range table arrPowerRangeTable[iCurrentProfile,iCurrentStep] is specified is decided via this enum. If eCtrlModeProfile = eHVACCtrlMode_Auto, then iCurrentProfile = iProfile. If eCtrlModeProfile = eHVACCtrlMode_Manual, then iCurrentProfile = iManualProfile.

iManualProfile: indicates which profile from the power range table arrPowerRangeTable[iCurrentProfile,iCurrentStep] is in use. If eCtrlModeProfile = eHVACCtrlMode_Manual, then iCurrentProfile = iManualProfile. The indication of the profile must not be lower than g_iMinNumberOfProfiles and must not be greater than iNumberOfProfiles. Otherwise iManualProfile is set internally to g_iMinNumberOfProfiles if it is lower than g_iMinNumberOfProfiles or to iNumberOfProfiles if it is greater than iNumberOfProfiles.

eCtrlModeProfile: the input variable via which the steps from the power range table arrPowerRangeTable[iCurrentProfile,]iCurrentStep are specified is decided via this enum. If eCtrlModeStep = eHVACCtrlMode_Auto, then iCurrentStep = iStep. If eCtrlModeStep = eHVACCtrlMode_Manual, then iCurrentStep = iManualStep.

iManualStep: indicates which step from the power range table arrPowerRangeTable[iCurrentProfile,]iCurrentStep is in use. If eCtrlModeStep = eHVACCtrlMode_Manual, then iCurrentStep = iManualStep. The indication of the steps must not be lower than g_iMinNumberOfStep and must not be greater than iNumberOfStepInProfile. Otherwise iManualStep is set internally to g_iMinNumberOfSteps if it is lower than g_iMinNumberOfProfiles or to iNumberOfStepInProfile if it is greater than iNumberOfStepInProfile.

iNumberOfAggregates: iNumberOfAggregates specifies the number of aggregates in the power generator sequence. For example, if iNumberOfAggregates = 4, then the parameters from the array arrPowerRangeTable are written to the output structures stAggregate1-4, depending on the specification of iCurrentStep/iCurrentProfile. The indication must not be lower than g_iMinNumberOfAggregates and must not be greater than g_iMaxNumberOfAggregates. Otherwise an error is indicated by bError = TRUE and the execution of the function block is stopped.

bReset: input for acknowledgement of the faults once they have been corrected. Internally the system responds to a rising edge.

VAR_OUTPUT

bEnablePowerRangeTable: BOOL;
iNumberOfStepInProfile: INT;
iCurrentProfile       : INT;
iCurrentStep          : INT;
stI_Ctrl              : ST_HVACI_Ctrl;
stAggregate1          : ST_HVACAggregate;
stAggregate2          : ST_HVACAggregate;
stAggregate3          : ST_HVACAggregate;
stAggregate4          : ST_HVACAggregate;
stAggregate5          : ST_HVACAggregate;
stAggregate6          : ST_HVACAggregate;
bError                : BOOL;
eErrorCode            : E_HVACErrorCodes;
iErrorPosArrayProfile : INT;
iErrorPosArrayStep    : INT;

bEnablePowerRangeTable: indicates that the function block is enabled. bEnablePowerRangeTable is TRUE if bEnable = TRUEANDbError = FALSE.

iNumberOfStepInProfile: indicates the number of parameterized steps from the specified profile iCurrentProfile of the power range table arrPowerRangeTable. Each individual step contains the parameter structure ST_HVACPowerRange needed for system control. Each profile can have up to 33 steps. The field for the steps in the power range table arrPowerRangeTable begins with 0 and ends with 32. The number of parameterized steps in a profile iNumberOfStepInProfile is determined from step 1 upwards to step 32. The counting of the parameterized steps ends in the step in which all variables of the parameter structure ST_HVACPowerRange have the value 0. The minimum value that iNumberOfStepInProfile can have is 1 and the maximum is 32. Step 0 is not taken into account, because the power generators are switched off in this step. The step can be considered to be a standby step. The values of the variables of the output structures stAggregate1-6 then output the value 0. In the standby step, the parameters required for starting the power step sequence of the energy generators are transferred to the upstream controller FB_HVACI_Ctrl_Step via the output structure stI_Ctrl.

FB_HVACPowerRangeTable 7:

iNumberOfStepInProfile can be used to limit the steps for other function blocks, such as for the input iNumberOfStepInProfile of the function block FB_HVACI_CtrlStep. In turn, the output variable iStep of FB_HVACI_CtrlStep can be used to specify the step of the power range table FB_HVACPowerRangeTable via the input iStep.

iCurrentProfile: indicates the current profile with which the function block from the power range table arrPowerRangeTable[iCurrentProfile,iCurrentStep] is working. The indication depends on the input variables iProfile, iManualProfile and eCtrlModeProfile. If eCtrlModeProfile = eHVACCtrlMode_Auto, then iCurrentProfile = iProfile. If eCtrlModeProfile = eHVACCtrlMode_Manual, then iCurrentProfile = iManualProfile.

iCurrentStep: indicates the current power step with which the function block from the power range table arrPowerRangeTable[iCurrentProfile,iCurrentStep] is working. The most current step is always the highest step viewed from 1 upward. The indication depends on the input variables iStep, iManualStep and eCtrlModeStep. If eCtrlModeStep = eHVACCtrlMode_Auto, then iCurrentStep = iStep. If eCtrlModeStep = eHVACCtrlMode_Manual, then iCurrentStep = iManualStep.

stI_Ctrl: output structure of the parameters ST_HVACI_Ctrl for the function block FB_HVACI_CtrlStep.
Which values the variables of the output structure stI_Ctrl take from the power range table arrPowerRangeTable depends on the selected profile and the current step. If the selected profile = 2iCurrentProfile and the step = 3iCurrentStep, then the contents of the following variables from the power range table are written to the structure stI_Ctrl:

stI_Ctrl.rIntegralHigh := arrPowerRangeTable[,].rIntegralHighiCurrentProfileiCurrentStep;
stI_Ctrl.rIntegralLow := arrPowerRangeTable[,].rIntegralLowiCurrentProfileiCurrentStep;
stI_Ctrl.udiSecDelayHigh :=arrPowerRangeTable[,].udiSecDelayHighiCurrentProfileiCurrentStep;
stI_Ctrl.udiSecDelayLow :=arrPowerRangeTable[,].udiSecDelayLowiCurrentProfileiCurrentStep;

stI_Ctrl.rIntegralHigh := arrPowerRangeTable[,].rIntegralHigh23;
stI_Ctrl.rIntegralLow := arrPowerRangeTable[,].rIntegralLow23;
stI_Ctrl.udiSecDelayHigh :=arrPowerRangeTable[,].udiSecDelayHigh23;
stI_Ctrl.udiSecDelayLow :=arrPowerRangeTable[,].udiSecDelayLow23;

stI_Ctrl.rIntegralHigh: positive value for the upper limit at which the integration of the I transfer element is stopped.

stI_Ctrl.rIntegralLow: positive value for the lower limit at which the integration of the I transfer element is stopped.

stI_Ctrl.udiSecDelayHigh: delay time after whose expiry the I transfer element is activated.

stI_Ctrl.udiSecDelayLow: delay time after whose expiry the I transfer element is activated.

stAggregate1-6: output structures of the parameters ST_HVACAggregate for controlling the aggregates 1 to 6. iNumberOfAggregates determines the number of aggregates in the power generator sequence. The values adopted by the variables of the output structures stAggregate1-6 from the power range table arrPowerRangeTable depend on the selected profile and the current step. If the selected profile = 8iCurrentProfile and the step = 5iCurrentStep, then it is crucial that the variable arrPowerRangeTable[,].iAggregate85 has the value 1. The values parameterized in the power range table are then output via the output structure stAggregate1.

stAggregate1.rY_Max := arrPowerRangeTable[,].rY_MaxiCurrentProfileiCurrentStep;
stAggregate1.rY_Min
:=arrPowerRangeTable[,].rY_MiniCurrentProfileiCurrentStep;
stAggregate1.iAggregateStep
:=arrPowerRangeTable[,].iAggregateStepiCurrentProfileiCurrentStep;
stAggregate1.bBlock
:= arrPowerRangeTable[,].bBlockiCurrentProfileiCurrentStep;

stAggregate1.rY_Max := arrPowerRangeTable[,].rY_Max85;
stAggregate1.rY_Min
:=arrPowerRangeTable[,].rY_Min85;
stAggregate1.iAggregateStep
:=arrPowerRangeTable[,].iAggregateStep83;
stAggregate1.bBlock
:= arrPowerRangeTable[,].bBlock85;

If the value of the variable arrPowerRangeTable[,].iAggregate83 is also 1, then the values of the highest power step iCurrentStep = 5 are written to the corresponding output structure stAggregate1, because arrPowerRangeTable[,].iAggregate85 is also 1 here. Only if iCurrentStep = 3 does this mean that following values are output via the output structure stAggregate1:

stAggregate1.rY_Max := arrPowerRangeTable[,].rY_Max83;
stAggregate1.rY_Min
:=arrPowerRangeTable[,].rY_Min83;
stAggregate1.iAggregateStep
:=arrPowerRangeTable[,].iAggregateStep83;
stAggregate1.bBlock
:= arrPowerRangeTable[,].bBlock83;

If iCurrentStep = 4 andarrPowerRangeTable[,].iAggregate84 = 2, then this means that the following values are output via the output structures stAggregate1 and stAggregate2:

stAggregate2.rY_Max := arrPowerRangeTable[,].rY_Max84;
stAggregate2.rY_Min
:=arrPowerRangeTable[,].rY_Min84;
stAggregate2.iAggregateStep
:=arrPowerRangeTable[,].iAggregateStep84;
stAggregate2.bBlock
:= arrPowerRangeTable[,].bBlock84;

stAggregate1.rY_Max := arrPowerRangeTable[,].rY_Max83;
stAggregate1.rY_Min
:=arrPowerRangeTable[,].rY_Min83;
stAggregate1.iAggregateStep
:=arrPowerRangeTable[,].iAggregateStep83;
stAggregate1.bBlock
:= arrPowerRangeTable[,].bBlock83;

bError: this output indicates with a TRUE that there is an error. The execution of the function block is stopped. The enum eErrorCode indicates the error number.
After the error has been corrected, the message bError must be acknowledged with bReset.

eErrorCode: returns the error number when the bError output is set.

The following errors can occur in this function block:

eHVACErrorCodes_InvalidParam_iStep: error when checking the specified steps. The value of iStep must be greater than or equal to g_iMinNumberOfSteps or smaller than or equal to iNumberOfStepInProfile.

eHVACErrorCodes_InvalidParam_iNumberOfStepInProfile: error while checking the number of profiles whether each of the specified profiles has parameterized steps. The profiles are checked in step 0. If no variable value of the structure ST_HVACPowerRange is greater than 0, an error has occurred.
The variable iErrorPosArrayProfile is used to specify the incorrect profile in the power range table arrPowerRangeTable[x1,x2]: x1 = iErrorPosArrayProfile;

eHVACErrorCodes_InvalidParam_iNumberOfAggregates: error when checking the specified number of aggregates. The value of iNumberOfAggregates must be smaller than g_iMinNumberOfAggregates and larger than g_iMaxNumberOfAggregates.

eHVACErrorCodes_InvalidParam_iAggregateSteps: error when checking the specified steps for the aggregate. The value of arrPowerRangeTable[x1,x2]. iAggregateStep must be greater than or equal to g_iAggregateMinNumberOfSteps and smaller than or equal to g_iAggregateMaxNumberOfSteps.
The variables iErrorPosArrayProfile and iErrorPosArrayStep are used to specify the incorrect point in the power range table arrPowerRangeTable[x1,x2]: x1 = x2 = iErrorPosArrayProfile;iErrorPosArrayStep

eHVACErrorCodes_InvalidParam_iNumberOfProfiles: error when checking the number of profiles. The value of iNumberOfProfiles must be greater than g_iMinNumberOfProfiles and smaller than or equal to g_iMaxNumberOfProfiles.

eHVACErrorCodes_InvalidParam_iProfile: error when checking the specified profiles. The value of iProfile must be greater than g_iMinNumberOfProfiles and smaller than or equal to iNumberOfProfiles.

eHVACErrorCodes_InvalidParam_iAggregate: error when checking the specified aggregates. The value of arrPowerRangeTable[x1,x2].iAggregate must be greater than or equal to g_iMinNumberOfAggregates and less than or equal to g_iMaxNumberOfAggregates.
The variables iErrorPosArrayProfile and iErrorPosArrayStep are used to specify the incorrect point in the power range table arrPowerRangeTable[x1,x2]: x1 = x2 = iErrorPosArrayProfile;iErrorPosArrayStep

eHVACErrorCodes_InvalidParam_udiSecDelayUp: error when checking arrPowerRangeTable[x1,x2].udiSecDelayUp. The value of arrPowerRangeTable[x1,x2].udiSecDelayUp must not be greater than g_udiMaxSec.
The variables iErrorPosArrayProfile and iErrorPosArrayStep are used to specify the incorrect point in the power range table arrPowerRangeTable[x1,x2]: x1 = x2 = iErrorPosArrayProfile;iErrorPosArrayStep

eHVACErrorCodes_InvalidParam_udiSecDelayDown: error when checking arrPowerRangeTable[x1,x2]. udiSecDelayDown. The value of arrPowerRangeTable[x1,x2].udiSecDelayDown must not be greater than g_udiMaxSec.
The variablen iErrorPosArrayProfile and iErrorPosArrayStep are used to specify the incorrect point in the power range table arrPowerRangeTable[x1,x2]: x1 = x2 = iErrorPosArrayProfile;iErrorPosArrayStep

FB_HVACPowerRangeTable 8:

To get the error numbers of the enum in the PLC, eErrorCode can be assigned to a variable of data type WORD.eHVACErrorCodes_InvalidParam_iStep = 31 eHVACErrorCodes_InvalidParam_iNumberOfStepInProfil = 32eHVACErrorCodes_InvalidParam_iNumberOfAggregates = 33eHVACErrorCodes_InvalidParam_iAggregateSteps = 34eHVACErrorCodes_InvalidParam_iNumberOfProfiles = 35eHVACErrorCodes_InvalidParam_iProfile = 36eHVACErrorCodes_InvalidParam_iAggregate = 39 eHVACErrorCodes_InvalidParam_udiSecDelayUp = 40 eHVACErrorCodes_InvalidParam_udiSecDelayDown = 41

iErrorPosArrayProfile: the variable iErrorPosArrayProfile specifies the profile in which the incorrect position in the power range table arrPowerRangeTable[iErrorPosArrayProfile,iErrorPosArrayStep] can be found.
If iErrorPosArrayProfile > 0, then one of the following errors is present at eErrorCode:
- eHVACErrorCodes_InvalidParam_iNumberOfStepInProfile
- eHVACErrorCodes_InvalidParam_iAggregateSteps
- eHVACErrorCodes_InvalidParam_iAggregate
- eHVACErrorCodes_InvalidParam_udiSecDelayUp
- eHVACErrorCodes_InvalidParam_udiSecDelayDown

The exact position of the step can be determined with the aid of the variable iErrorPosArrayStep.

Sample 1 for locating an error:
The following values are present at the output variables:

bError =TRUE;
eErrorCode= eHVACErrorCodes_InvalidParam_iNumberOfStepInProfile;
iErrorPosArrayProfile
= 2;

In the power range table arrPowerRangeTable[2,x]in the profile 2 in step 0 no variable value of the structure ST_HVACPowerRange is greater than 0. iErrorPosArrayStep is not taken into account with this error.

Sample 2 for locating an error:
The following values are present at the output variables:

bError =TRUE;
eErrorCode= eHVACErrorCodes_InvalidParam_iAggregateSteps;
iErrorPosArrayProfile
= 2;
iErrorPosArrayStep
= 3;

There is an incorrect value on the following variable in the power range table arrPowerRangeTable:

arrPowerRangeTable[2,3].iAggregateStep

iErrorPosArrayStep: if iErrorPosArrayProfile > 0, then the variable iErrorPosArrayStep indicates the step in the profile in which the incorrect place in the power range table is to be found.

Sample for locating an error:
The following values are present at the output variables:

bError =TRUE;
eErrorCode= eHVACErrorCodes_InvalidParam_iAggregate;
iErrorPosArrayProfile
= 5;
iErrorPosArrayStep
= 15;

There is an incorrect value on the following variable in the power range table arrPowerRangeTable:

arrPowerRangeTable[5,15].iAggregate

VAR_IN_OUT

arrPowerRangeTable    : ARRAY [1..g_iMaxNumberOfProfiles,0..g_iMaxNumberOfSteps] OF ST_HVACPowerRange;         X

arrPowerRangeTable: all information or parameters relevant to system control are summarized in the power range table arrPowerRangeTable. The power range table is a two-dimensional field (array) with the structure ST_HVACPowerRange. The power range table can be compared to a normal table in that the horizontal entries are called lines and the vertical entries columns. An individual element is thus clearly designated by naming line and column. The field range 1..g_iMaxNumberOfProfiles of the power range table would be the vertical part, i.e. the columns. This range is called the profile and iCurrentProfile indicates which profile is being addressed. The field range 0..g_iMaxNumberOfSteps is regarded as the horizontal part, i.e. the lines. This range is called the step and iCurrentStep indicates which step is being addressed.

The power range table consists of 16 profiles. Each profile can have up to 33 steps. Each individual step contains the parameter structure ST_HVACPowerRange needed for system control. The parameters indicated here are transferred via the output structures stI_Ctrl to the function block FB_HVACI_CtrlStep for controlling the steps and via stAggregate1-6 to the function blocks for power generation.

The number of steps in a profile is indicated by the output variable iNumberOfStepInProfile. The number depends on the entries in the power range table and on the selected profile iCurrentProfile. The selected profile is checked internally in the function block from step 1 to the step in which all variables of the structure ST_HVACPowerRange have the value 0. iNumberOfStepInProfile is always determined for the specified profile only. Each profile can have up to 33 steps from 0 to 32; step 0 is not taken into account when evaluating the number of steps via iNumberOfStepInProfile.

Structure ST_HVACPowerRange

arrPowerRangeTable[x,x].iAggregate: parameter that specifies to which output structure stAggregate1-6 of the function block FB_HVACPowerRangeTable the variables rY_Min, rY_Max, iAggregateStep and bBlock are written.

arrPowerRangeTable[x,x].iAggregateStep: parameter that specifies the step in which the addressed aggregate should be fixed or should regulate; see bBlock.
iAggregateStep is output via the structure stAggregateX.

arrPowerRangeTable[x,x].rY_Max: parameter specification for continuous aggregates. rY_Max is output via the structure stAggregateX.

arrPowerRangeTable[x,x].rY_Min: parameter specification for continuous aggregates. rY_Min is output via the structure stAggregateX.

arrPowerRangeTable[x,x].rIntegralHigh: positive value for the upper limit at which the integration of the I transfer element is stopped, see the VAR_IN_OUT variable rIntegralHigh in FB_HVACI_CtrlStep.
rIntegralHigh is output via the structure stI_Ctrl.

arrPowerRangeTable[x,x].rIntegralLow : positive value for the lower limit at which the integration of the I transfer element is stopped, see the VAR_IN_OUT variable rIntegralHigh in FB_HVACI_CtrlStep.
rIntegralLow is output via the structure stI_Ctrl.

arrPowerRangeTable[x,x].udiSecDelayHigh: delay time after which the I transfer element is activated, see the VAR_IN_OUT variable udiSecDelayHigh in FB_HVACI_CtrlStep.
udiSecDelayHigh is output via the structure stI_Ctrl.

arrPowerRangeTable[x,x].udiSecDelayLow: delay time after which the I transfer element is activated, see the VAR_IN_OUT variable udiSecDelayHigh in FB_HVACI_CtrlStep.
udiSecDelayLow is output via the structure stI_Ctrl.

arrPowerRangeTable[x,x].bBlock: if bBlock = FALSE, then the addressed aggregate is fixed in the specified step via iAggregateStep. If bBlock = TRUE, then the control of the addressed aggregate is released from the off step (0) to the specified step via iAggregateStep.
bBlock is output via the structure stAggregateX.

The variable is saved persistently.