FB_HVACScale
Application
A raw analog value is scaled to the specified measuring range and returned as the function value. If the raw value extends beyond the upper or lower measuring range, the corresponding limit value is output. There must be a difference of at least 0.01 between the upper and lower limit values for the raw data. If this is not the case, the lower limit value is output. The difference between the limits is necessary so as to avoid division by zero during the internal calculation of the linear equation.
VAR_INPUT
eDataSecurityType : E_HVACDataSecurityType;
bSetDefault : BOOL;
rRawData : REAL;
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: 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.
rRawData: raw value from the terminal.
VAR_OUTPUT
rScaledValue : REAL;
rScaledValue: scaled value.
VAR_IN_OUT
rRawDataLowOffLimit : REAL;
rRawDataHighOffLimit : REAL;
rScaleDataLowOffLimit : REAL;
rScaleDataHighOffLimit : REAL;
rRawDataLowOffLimit: lower limit from raw value. Preset to 0.
rRawDataHighOffLimit: upper limit from raw value. Preset to 32767.
rScaleDataLowOffLimit: lower limit of the scaled measured value. Preset to 0.
rScaleDataHighOffLimit: upper limit of the scaled measured value. Preset to 100.
Example in FBD: