FB_HVACSetpointRamp

FB_HVACSetpointRamp 1:

Application

The function block generates a sliding setpoint ramp. This function block must be called in every PLC cycle, because the calculation for reaching the final setpoint depends on the TaskTime.

VAR_INPUT

eDataSecurityType: E_HVACDataSecurityType;
bSetDefault      : BOOL;    
bEnable          : BOOL;
rSetpointIn      : REAL;
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_HVACSetpointRamp 2: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.

bSetDefault: If the variable is TRUE, the default values of the VAR_IN_OUT variables are adopted.

bEnable: enable of the function block.

rSetpointIn: setpoint to which the output rSetpopintOut is regulated, depending on the absolute temperature change rSetpointSlide per time change tRampTime. Each change of the setpoint starts a new calculation of the setpoint to the target value of the ramp. The target value is the current value of rSetpointIn. The start value of the ramp is the last value before changing rSetpointIn to the new target value, see Figure 1.1.
The parameters rMaxSetpoint and rMinSetpoint define the value range of rSetpointIn.
If an incorrect variable value is present at rSetpointIn, then the last valid variable value is taken, if available. If there is no valid, last value, then work continues internally with rMinSetpoint. bInvalidParameter is set if the variable value is incorrect, the function block continues to operate normally.

bReset: acknowledge input in the event of a fault.

VAR_OUTPUT

rSetpointOut         : REAL; 
tRemainingTime       : TIME;
bValueReached        : BOOL;
bInvalidParameter    : BOOL;

rSetpointOut: output of the ramp generator

tRemainingTime: time duration in which the output rSetpointOut has reached the target value rSetpointIn.

bValueReached: a TRUE at this output indicates that the output rSetpointOut has reached the target value rSetpointIn.

bInvalidParameter: indicates that an incorrect parameter is present at one of the variables rSetpointSlide or tRampTime. An incorrect parameter entry does not lead to a standstill of the function block; see description of variables. After rectifying the incorrect parameter entry, the message bInvalidParameter must be acknowledged via bReset.

VAR_IN_OUT

rMinSetpoint     : REAL;
rMaxSetpoint     : REAL;
rSetpointSlide   : REAL;
tRampTime        : TIME;

rMinSetpoint/rMaxSetpoint: the parameters rMaxSetpoint and rMinSetpoint define the value range (-10000..10000) of rSetpointIn. rMaxSetpoint must be greater than rMinSetpoint.

If an incorrect variable value is present, the last valid variable value, if available, is used. If there is no valid last value, then the default value is used. bInvalidParameter will be set in the event of an incorrect parameter entry. The function block continues to operate normally. The variable is saved persistently. Preset to 10 or 40 respectively.

rSetpointSlide: absolute temperature change in [Kelvin / tRampTime] with which the output is converted in sliding steps from a lower to a higher value or from a higher to a lower value, see fig. 1.1

If an incorrect variable value is present, the last valid variable value, if available, is used. If there is no valid last value, then the default value is used. bInvalidParameter will be set in the event of an incorrect parameter entry. The function block continues to operate normally. The variable is saved persistently. Preset to 1.

tRampTime: ramp time (1s..24h) during which the final setpoint is reached in sliding steps, depending on the absolute temperature change rSetpointSlide, see fig. 1.1

If an incorrect variable value is present, the last valid variable value, if available, is used. If there is no valid last value, then the default value is used. bInvalidParameter will be set in the event of an incorrect parameter entry. The function block continues to operate normally. The variable is saved persistently. Preset to 3600 s.

Fig. 1.1:

FB_HVACSetpointRamp 3: