FB_HVACPriority_REAL_8

FB_HVACPriority_REAL_8 1:

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 rValueOut is controlled via the events occurring at the inputs bEvent1-8, rValue1-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 rValueOut has the value of rValue7.
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 rValueOut has the value of rValue1.

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 rValue1-8, whose value is output via rValueOut. If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Manual AND iManualValue = 2, then rValueOut = rValue2, see Table 3.

Notice

A frequently changing variable may not be applied to the VAR_IN_OUT variables rValue1-8 if eDataSecurityType = eHVACDataSecurityType_Persistent. This would lead to premature wear of the storage medium of the controller. If the VAR_IN_OUT variables rValue1-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 rValueOut 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 rValueOut = rValue7.

FB_HVACPriority_REAL_8 2:

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 rValueOut 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 rValueOut = rValue1.

FB_HVACPriority_REAL_8 3:

Table 3: Multiplexer

If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Manual AND iManualValue = 2, then rValueOut = 2.

FB_HVACPriority_REAL_8 4:

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 rValueOut 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 rValueOut is controlled via the events occurring at the inputs bEvent1-8, rValue1-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 eCtrlModeeHVACCtrlMode_Manual, then the value of the output rValueOut is controlled via iManualValue. If iManualProfile = 5, then rValueOut = rValue5, see Table 3

iManualProfile: If the operation mode eCtrlModeeHVACCtrlMode_Manual (Multiplexer) AND bEnable = TRUE AND bError = FALSE, then the value of the output rValueOut is controlled via iManualValue. If iManualProfile = 5, then rValueOut = rValue5, see Table 3

bEvent1-8: The output rValueOut is controlled via the events occurring at the inputs bEvent1-8, rValue1-8 and the control direction of the prioritization bDirection.
bDirection
=FALSE means that the events determine the output value rValueOut 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 rValueOut = rValue7.
bDirection = TRUE means that the events determine the output value rValueOut 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 rValueOut = rValue1.
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 rValueOut is controlled via the events occurring at the inputs bEvent1-8, rValue1-8 and the control direction of the prioritization bDirection.
bDirection
=FALSE means that the events determine the output value rValueOut 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 rValueOut = rValue7.
bDirection = TRUE means that the events determine the output value rValueOut 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 rValueOut = rValue1.
The variables bEvent1-8 and bDirection are taken into account only if eCtrlMode = eHVACCtrlMode_Auto.

VAR_OUTPUT

rValueOut           : REAL;
bActive             : BOOL;
bEdgeNewEvent       : BOOL;
iValueNumber        : INT;

rValueOut: 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 rValueOut is controlled via the events occurring at the inputs bEvent1-8, rValue1-8 and the control direction of the prioritization bDirection.
bDirection
=FALSE means that the events determine the output value rValueOut 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 rValueOut = rValue7.
bDirection = TRUE means that the events determine the output value rValueOut 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 rValueOut = rValue1.

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 rValue1-8, whose value is output via rValueOut. If bEnable = TRUE AND eCtrlMode = eHVACCtrlMode_Manual AND iManualValue = 2, then rValueOut = rValue2, 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 rValueOut by means of rValue1-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 rValueOut is output. If rValueOut = rValue7, then iValueNumber = 7, see Table 1, Table 2 and Table 3

VAR_IN_OUT

rValue1-8        : REAL;

rValue1-8: The value of the output variable rValueOut is determined by the variables rValue1 to rValue8. rValueOut = rValueX

If the function block is used to prioritize events, then each of the variables rValue1-8 is assigned to an event. rValue1 is assigned to the event bEvent1, rValue2 to the event bEvent2, rValue3 to the event bEvent3, ... and rValue8 to the event bEvent8

If the function block is used as a multiplexer, then each of the variables rValue1-8 is assigned to the value of iManualValue. If iManualValue = 1, then rValueOut = rValue1. If iManualValue = 2, then rValueOut = rValue2…. If iManualValue = 8, then rValueOut = rValue8.

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