FB_HVACPriority_INT_8

This function block can be used to prioritize events or as a multiplexer. This selection is made with the help of the Enum eCtrlMode.
The function block can be used to prioritize events if eCtrlMode = eHVACCtrlMode_Auto. The output iValueOut is controlled via the events occurring at the inputs bEvent1-8, iValue1-8 and the control direction of the prioritization bDirection.
bDirection =FALSE means that the events have a higher priority in ascending form from 1 to 8. If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Auto AND bDirection = FALSE AND bEvent7 = TRUE (highest occurring event in Table 1 column 1), then iValueOut has the value of iValue7.
bDirection = TRUE means that the events have a higher priority in descending form from 8 to 1. If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Auto AND bDirection = TRUE AND bEvent1 = TRUE (lowest occurring event in Table 2 column 1), then iValueOut has the value of iValue1.
The function block can be used as a multiplexer if eCtrlMode = eHVACCtrlMode_Manual. The value of iManualValue refers to one of the VAR_IN_OUT variables iValue1-8, whose value is output via iValueOut. If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Manual AND iManualValue = 2, then iValueOut = iValue2, see Table 3.
Notice | |
A frequently changing variable may not be applied to the VAR_IN_OUT variables iValue1-8 if eDataSecurityType = eHVACDataSecurityType_Persistent. This would lead to premature wear of the storage medium of the controller. If the VAR_IN_OUT variables iValue1-8 change frequently and are not to be stored persistently, then eDataSecurityType must be eDataSecurityType_Idle. |
Table 1: Prioritization of events in ascending form from 1 to 8
It can be seen in Table 1 that bDirection = FALSE. This means that the events determine the output value iValueOut in ascending form from 1 to 8. If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Auto AND bDirection = FALSE AND bEvent7 = TRUE (highest occurring event in column 1), then iValueOut = iValue7.

Table 2: Prioritization of events in descending form from 8 to 1
It can be seen in Table 2 that bDirection = TRUE . This means that the events determine the output value iValueOut in descending form from 8 to 1. If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Auto AND bDirection = TRUE AND bEvent1 = TRUE (lowest occurring event in Table 2 column 1), then iValueOut = iValue1.

Table 3: Multiplexer
If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Manual AND iManualValue = 2, then iValueOut = 2.

VAR_INPUT
eDataSecurityType : E_HVACDataSecurityType;
bEnable : BOOL;
bEvent1 - bEvent8 : BOOL;
eCtrlMode : E_HVACCtrlMode;
iManualValue : INT; 0..8
bDirection : 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: 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 iValueOut is set constantly to 0.
eCtrlMode: This enum specifies the operation mode of the function block (see E_HVACCtrlMode).
If eCtrlMode = eHVACCtrlMode_Auto, then the function block represents a prioritization of events. If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Auto, then the output iValueOut is controlled via the events occurring at the inputs bEvent1-8, iValue1-8 and the control direction of the prioritization bDirection, see Table 1 and Table 2
If eCtrlMode = eHVACCtrlMode_Manual, then the function block represents a multiplexer. If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Manual, then the value of the output iValueOut is controlled via iManualValue. If iManualProfile = 5, then iValueOut = iValue5, see Table 3
iManualProfile: If the operation mode eCtrlMode = eHVACCtrlMode_Manual (Multiplexer) AND bEnable = TRUE AND bError = FALSE, then the value of the output iValueOut is controlled via iManualValue. If iManualProfile = 5, then iValueOut = iValue5, see Table 3
bEvent1-8: The output iValueOut is controlled via the events occurring at the inputs bEvent1-8, iValue1-8 and the control direction of the prioritization bDirection.
bDirection =FALSE means that the events determine the output value iValueOut in ascending form from 1 to 8. If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Auto AND bDirection = FALSE AND bEvent7 = TRUE (highest occurring event in Table 1 column 1), then iValueOut = iValue7.
bDirection = TRUE means that the events determine the output value iValueOut in descending form from 8 to 1. If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Auto AND bDirection = TRUE AND bEvent1 = TRUE (lowest occurring event in Table 2 column 1), then iValueOut = iValue1.
The variables bEvent1-8 and bDirection are taken into account only if eCtrlMode = eHVACCtrlMode_Auto.
bDirection: The function block can be used to prioritize events if eCtrlMode = eHVACCtrlMode_Auto. The output iValueOut is controlled via the events occurring at the inputs bEvent1-8, iValue1-8 and the control direction of the prioritization bDirection.
bDirection =FALSE means that the events determine the output value iValueOut in ascending form from 1 to 8. If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Auto AND bDirection = FALSE AND bEvent7 = TRUE (highest occurring event in Table 1 column 1), then iValueOut = iValue7.
bDirection = TRUE means that the events determine the output value iValueOut in descending form from 8 to 1. If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Auto AND bDirection = TRUE AND bEvent1 = TRUE (lowest occurring event in Table 2 column 1), then iValueOut = iValue1.
The variables bEvent1-8 and bDirection are taken into account only if eCtrlMode = eHVACCtrlMode_Auto.
VAR_OUTPUT
iValueOut : INT;
bActive : BOOL;
bEdgeNewEvent : BOOL;
iValueNumber : INT;
iValueOut: This function block can be used to prioritize events or as a multiplexer. This selection is made with the help of the Enum eCtrlMode.
The function block can be used to prioritize events if eCtrlMode = eHVACCtrlMode_Auto. The output iValueOut is controlled via the events occurring at the inputs bEvent1-8, iValue1-8 and the control direction of the prioritization bDirection.
bDirection =FALSE means that the events determine the output value iValueOut in ascending form from 1 to 8. If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Auto AND bDirection = FALSE AND bEvent7 = TRUE (highest occurring event in Table 1 column 1), then iValueOut = iValue7.
bDirection = TRUE means that the events determine the output value iValueOut in descending form from 8 to 1. If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Auto AND bDirection = TRUE AND bEvent1 = TRUE (lowest occurring event in Table 2 column 1), then iValueOut = iValue1.
The function block can be used as a multiplexer if eCtrlMode = eHVACCtrlMode_Manual. The value of iManualValue refers to one of the VAR_IN_OUT variables iValue1-8, whose value is output via iValueOut. If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Manual AND iManualValue = 2, then iValueOut = iValue2, see Table 3.
bActive: bActive goes TRUE if
1. bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Auto and one of the input variables bEvent1-8 is TRUE.
2. bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Manual AND iManualValue > 0
bEdgeNewEvent: Is TRUE for one PLC cycle if
1. bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Auto and the decisive event (bEvent1-8) for controlling the output iValueOut by means of iValue1-8 has changed.
2. bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Manual and with each change of iManualValue
iValueNumber: The variable iValueNumber indicates the variable from which the value on iValueOut is output. If iValueOut = iValue7, then iValueNumber = 7, see Table 1, Table 2 and Table 3
VAR_IN_OUT
iValue1-8 : INT;
iValue1-8: The value of the output variable iValueOut is determined by the variables iValue1 to iValue8. iValueOut = iValueX
If the function block is used to prioritize events, then each of the variables iValue1-8 is assigned to an event. iValue1 is assigned to the event bEvent1, iValue2 to the event bEvent2, iValue3 to the event bEvent3, ... and iValue8 to the event bEvent8
If the function block is used as a multiplexer, then each of the variables iValue1-8 is assigned to the value of iManualValue. If iManualValue = 1, then iValueOut = iValue1. If iManualValue = 2, then iValueOut = iValue2…. if iManualValue = 8, then iValueOut = iValue8.
The variable is saved persistently.
Requirements
Development environment | required library | required function |
---|---|---|
TwinCAT 3.1 build 4022.16 or higher | Tc2_HVAC V3.3.1.0 | TF8000 | TC3 HVAC V1.0.0.0 |