FB_HVACWork
Application
This function block serves the recording of the operating hours and the switch-on cycles. Furthermore it is possible to report specified operating times being reached.
Recording of operating hours
As soon as the input bOn reports operation, the operating time is recorded with an internal resolution of 1 sec. The output is in the form of a real value in hours to two decimal places (1/100 h). If no system time with second resolution is available, or if this is disrupted, the clock input bSysTakt1Hz is used instead after 2 s. Triggering takes place on a rising edge at this input. The variant with the system time is more exact than the variant with the clock generator on account of the possibility of synchronization via the network.
Every positive edge at bOn is counted as a switch-on cycle and is available at the output as iCount.
VAR_INPUT
eDataSecurityType : E_HVACDataSecurityType;
bSetDefault : BOOL;
bOn : BOOL;
bResetHours : BOOL;
bResetCount : BOOL;
dtSystemtime : DT;
bStartWarnLevel : BOOL;
bStartAlarmLevel : BOOL;
bSysTakt1Hz : BOOL;
bReset : BOOL;
Notice | |
If E_HVACDataSecurityType := eHVACDataSecurityType_Persistent has been selected, the procedure deviates from the standard. After a change, the data are not written to the flash memory with a delay equivalent to g_tHVACWriteBackupDataTime (default t#5s), but constantly only once per hour. This serves to protect the flash memory, as otherwise all persistent data would be written to it every 5 sec if the operating hour counter were to be running. |
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.
bOn: operating message; the operating time is totaled up as long as the signal is present. The rising edge is counted as the switch-on cycle.
bResetHours: a rising edge sets the operating hours counter to 0.
bResetCount: a rising edge sets the switch-on cycle counter to 0.
dtSystemtime: system time with seconds display.
bStartWarnLevel: a rising edge at the input resets the output bQWarnLevel and restarts the time measurement for this.
bStartWarnLevel: a rising edge at the input resets the output bQAlarmLevel and restarts the time measurement for this.
bSysTakt1Hz: 1 Hz clock signal as a replacement for dtSystemTime; if dtSystemTime is not available, or does not change its value for longer than 2 s, then the clock signal is used as a replacement.
bReset: acknowledge input in the event of a fault. Resets the flag bInvalidParameter.
VAR_IN_OUT
rHours : REAL;
uiCount : UINT;
uiWarnLevel : UINT;
uiAlarmLevel : UINT;
bEnableWarnLevel : BOOL;
bEnableAlarmLevel : BOOL;
rHours: operating hours with a resolution of 1/100 hours (internally with 1 s). The variable is saved persistently.
uiCount: switch-on cycle counter. The variable is saved persistently.
uiWarnLevel: number of operating hours after which a warning is output (0..50000). Upon a rising edge at the input bStartWarnLevel the current operating hours count is added to the value uiWarnLevel and saved as an absolute operating time. As soon as the operating hours counter has reached this value and the signal is enabled via bEnableWarnLevel, the output bQWarnLevel is set to TRUE. The variable is saved persistently. Preset to 0 h.
uiAlarmLevel: number of operating hours after which an alarm is output (0..50000). Upon a rising edge at the input bStartAlarmLevel the current operating hours count is added to the value uiAlarmLevel and saved as an absolute operating time. As soon as the operating hours counter has reached this value and the signal is enabled via bEnableAlarmLevel, the output bQAlarmLevel is set to TRUE. The variable is saved persistently. Preset to 0 h.
bEnableWarnLevel: enables the output bQWarnLevel. The variable is saved persistently. Preset to FALSE.
bEnableAlarmLevel: enables the output bQAlarmLevel. The variable is saved persistently. Preset to FALSE.
VAR_OUTPUT
bQAlarmLevel : BOOL;
bQWarnLevel : BOOL;
bInvalidParameter: BOOL;
bQAlarmLevel:operating hours counter has reached the alarm level.
bQWarnLevel:operating hours counter has reached the warning level.
bInvalidParameter: an error occurred during the plausibility check. It is deleted again by bReset.