SequenceControl (FB)¶
FUNCTION_BLOCK SequenceControl
Control up to four interconnected or related heat/cool sequences.
Building automation applications quite often need to handle interconnected or related heat/cool sequences of certain actuators / aggregates. Because there is a large amount of variance within sequence relations it is complex to implement such control algorithm in the application with the means of control primitives like PID, deadband etc.
SequenceControl provides a flexible implementation to control up two four interconnected or related heat/cool sequences. Basic comprehension of control algorithm in general and PID in particular is inevitable to understand the functionality of SequenceControl.
Sequence combinations:¶
SequenceControl supports a fixed set of sequence combinations - see SequenceControlSequences. Sequences and sequence combinations are described in this documentation as simple “ASCII art”. “" represents a “heating sequence”. “/” represents a “cooling sequence”.
A “heating sequence” is synonomous to any manipulated variable / actuator value with negativ control amplification, reducing its value at rising control variable value. A “cooling sequence” is synonomous to any manipulated variable / actuator value with positive control amplification, increaing its value at rising control variable value.
Some examples of sequence combinations: - - one heat sequence - \/ - two heat sequences followed by a cool sequence - \// - two heat sequences followed by two cool sequences All supported sequence combinations - see SequenceControlSequences.
Sequence relations:¶
Sequences can be related as follows:
- directly connected Example: two directly connected heat sequences (\) Temperature (control variable) above heat setpoint, controller reducing manipulated variable. The manipulated variable of first heat sequence (rOut1) reaches its minimum value (rMin1), the second heat sequences takes over immediately reducing manipulated variable of second heat sequence (rOut2). 
- overlap Example: two cool sequences (//) Temperature (control variable) above setpoint, controller increasing manipulated variable. Before the manipulated variable of first cool sequence (rOut1) reaches its minimum value (rMin1), the second heat sequences takes over increasing manipulated variable of second cool sequence (rOut2) 
- “zero energy band” (also often called “dead band”) Example: heat sequence, followed by “zero energy band”, followed by cool sequence (/) Temperature (control variable) rising above heat sepoint and later on rising above cool setpoint. Manipulated variable of heat sequence (rOut1) is reduced until its minimum value (rMin1). If temperature (control variable) is in between heat sepoint and cool setpoint neither rOut1 or rOut2 exceed rMin(1,2). If temperature (control variable) is rising above cool setpoint, rOut2 is taking over control. 
Control algorithm inputs:¶
Inputs related to a single sequence:
- Minimum value for manipulated variable - rMin (0..100) 
- Maximum value for manipulated variable - rMax (>rMin..100) 
- proportionality band - rXP please note: this is not a proportionality constant P), but the range within the process variable leads to (normalized) control actions (value of manipulated variable) 0..100%. rMin > 0.0 / rMax < 100.0 doesnt interfere with the control amplification. It’s best to envision rXP as the range of the process variable the sequence is “related to” (given: rMin = 0.0 AND rMax = 100). 
Inputs related to all sequences:
- setpoints: heating setpoint rSetptHeat, cooling setpoint rSetptCool 
- process variable rIn 
- (integral) reset time I - rTr [sec]. Not releavant if set to 0, in this case SequenceControl works as P controller (eventually PD controller) 
- derivative time D - rTd [sec]. Not releavant if set to 0, then SequenceControl works as P controller (eventually PI controller) 
- deviation minimum and maximum - for some use cases it is required to limit deviation by the mean of a command variable or other moving limits. 
- forced command variable value related to a selected sequence - rForcedValue 
- selected sequence to force command variable - usiForceSeq 
- enable/disable to force a command variable - xForceEnable 
Other inputs:
- “zero energy bands” / “dead zones” between sequences: rDeadzone12, rDeadzone23, rDeadzone34 rDeadzone can be set to 0 (=> sequences directly connected), < 0 (=> sequences overlap) or > 0 (=> “zero energy band”) 
- setpoints: rSetpointHeat, rSetpointCool - the relation between the setpoints and the sequences will be explained more detailed later on. 
Relation between setpoints sequences:¶
- rSetpointHeat rSetpointCool
- rDeadzone12 gets ignored in this case - | | / /
- | | / /
- | |/ /
 
 
 
- rSetpointHeat rSetpointCool
- rDeadzone23 gets ignored in this case 
Other control characteristics:¶
Integrator dynamics¶
To provide an homogenous integration speed within all sequences, integration speed (or integration gradient - the ratio (delta rOut <–> (delta integrator deviation / delta time)) will be computed as follows:
One active sequence: the proportional deviation is used as integrator deviation
Multiple active sequences: the difference of rActual to the “lower end” of the sequence (in relation to the releated setpoint) is used as integrator deviation. Example: eSequences:=”\//, rSetptCool:=23.0, rXP3:=10.0, rXP4:=10, rDeadzone34:=1.0
- rOut3 “lower end” is rSetptCool(23.0) 
- rOut3 “upper end” is rSetptCool + rXP3 (33.0) 
- rOut4 “lower end” is rOut3 “upper end” + rDeadzone34 (34.0) 
Reset¶
Level sensitive xReset allows to force SequenceControl to propertional-only state rOut computed based on propertional deviation only - integrator will be reset.
“Anti windup” (integration limit)¶
Integration will be stopped at “outer” manipulated variable limits of directly connected or overlapping sequences.
“Soft set”¶
In case of control parameter changes (rXP, rMin, rMax, rTr, rTd) SequenceControl tries to smooth changes of manipulated variables. This just works for PI control in many but not all cases by adjusting the integrator. “Soft set” is not going to work for P/PD control of course.
- InOut:
- Scope - Name - Type - Initial - Comment - Input - xEnable- BOOL- TRUE - Enable - rIn- REAL- 22.0 - Control variable - rSetptHeat- REAL- 21.0 - Heat setpoint - rSetptCool- REAL- 23.0 - Cool setpoint - eSequences- SequenceControlSequences.H1C2 - Sequence configuration - rXP1- REAL- 1.0 - Proportionality band for manipulated variable sequence 1, >0.0 - rMin1- REAL- 0.0 - Minimum value for manipulated variable sequence 1, 0..<100 - rMax1- REAL- 100.0 - Maximum value for manipulated variable sequence 1, >0..100 - rDeadband12- REAL- 0.0 - “zero energy band” / “dead band” between sequence 1 and 2 - rXP2- REAL- 1.0 - Proportionality band for manipulated variable sequence 2, >0.0 - rMin2- REAL- 0.0 - Minimum value for manipulated variable sequence 2, 0..<100 - rMax2- REAL- 100.0 - Maximum value for manipulated variable sequence 2, >0..100 - rDeadband23- REAL- 0.0 - “zero energy band” / “dead band” between sequence 2 and 3 - rXP3- REAL- 1.0 - Proportionality band for manipulated variable sequence 3, >0.0 - rMin3- REAL- 0.0 - Minimum value for manipulated variable sequence 3, 0..<100 - rMax3- REAL- 100.0 - Maximum value for manipulated variable sequence 3, >0..100 - rDeadband34- REAL- 0.0 - “zero energy band” / “dead band” between sequence 3 and 4 - rXP4- REAL- 1.0 - Proportionality band for manipulated variable sequence 4, >0.0 - rMin4- REAL- 0.0 - Minimum value for manipulated variable sequence 4, 0..<100 - rMax4- REAL- 100.0 - Maximum value for manipulated variable sequence 4, >0..100 - tI- TIME- TIME#0ms - (Integral) reset time (I). Not releavant if set to T#0S, in this case SequenceControl works as P controller (eventually PD controller) - tD- TIME- TIME#0ms - Derivative time (D). Not releavant if set to T#0S, then SequenceControl works as P controller (eventually PI controller) - rDeviationMin- REAL- -3.4E+38 - Deviation minimum - rDeviationMax- REAL- 3.4E+38 - Deviation maximum - xForceEnable- BOOL- FALSE - Enable forced value (rForcedValue) / sequence (usiForceSeq) - rForcedValue- REAL- Forced command variable value for selected sequence (usiForceSeq) - usiForceSeq- USINT (1..4) - 1 - Selected sequence to force command variable with rForcedValue - xReset- BOOL- FALSE - Reset to proportional control / reset detected input error - itfDateTimeProvider- Util.IDateTimeProvider- Globals.g_dtpDateTimeProvider - Source for the current date and time information in milliseconds since 1.1.1970 00:00:00.000 - Output - rOut1- REAL- Manipulated variable sequence 1 - rOut2- REAL- Manipulated variable sequence 2 - rOut3- REAL- Manipulated variable sequence 3 - rOut4- REAL- Manipulated variable sequence 4 - eMode- Operation mode - xError- BOOL- Error indication - eErrorID- Error ID 
