Override control with PID_Compact as of V2 (S7-1200, S7-1500) - PID

Using PID_Compact (S7-1200, S7-1500)

ft:publication_title
Using PID_Compact (S7-1200, S7-1500)
Product
PID
Version
V20
Publication date
11/2024
Language
en-US
Override control with PID_Compact as of V2

Override control

In case of override control, two or more controllers share one actuator. Only one controller has access to the actuator at any time and influences the process.

A logic operation decides which controller has access to the actuator. This decision is often made based on a comparison of the output values of all controllers, for example, in case of a maximum selection, the controller with the largest output value gets access to the actuator.

The selection based on the output value requires that all controllers operate in automatic mode. The controllers that do not have an effect on the actuator are updated. This is necessary to prevent windup effects and their negative impacts on the control response and the switchover between the controllers.

PID_Compact supports override controls as of version 2.3 by offering a simple process for updating the controllers that are not active:

  • By using the OverwriteInitialOutputValue and PIDCtrl.PIDInit tags, you can preassign the integral action of the controller in automatic mode as though the PID algorithm had calculated Output = OverwriteInititalOutputValue for the output value in the last cycle.

  • To do this, OverwriteInitialOutputValue is interconnected with the output value of the controller that currently has access to the actuator.

  • By setting the bit PIDCtrl.PIDInit, you trigger the pre-assignment of the integral action as well as the restart of the controller cycle and the PWM period.

  • The subsequent calculation of the output value in the current cycle takes place based on the pre-assigned (and synchronized for all controllers) integral action as well as the proportional action and integral action from the current control deviation.

  • The derivative action is not active during the call with PIDCtrl.PIDInit = TRUE and therefore does not contribute to the output value.

This procedure ensures that the calculation of the current output value and thus the decision on which controller is to have access to the actuator is only based on the current process state and the PI parameters. Windup effects for controllers that are not active and thus incorrect decisions of the switchover logic are prevented.

Requirements

  • PIDCtrl.PIDInit is only effective if the integral action is activated (Retain.CtrlParams.Ti tag > 0.0).

  • You must assign PIDCtrl.PIDInit and OverwriteInitialOutputValue in your user program yourself (see example below). PID_Compact does not automatically change these tags.

  • PIDCtrl.PIDInit is only effective when PID_Compact is in automatic mode (parameter State = 3)

  • If possible, select the sampling time of the PID algorithm (Retain.CtrlParams.Cycle tag) in such a way that it is identical for all controllers, and call all controllers in the same cyclic interrupt OB. In this way, you ensure that the switchover does not take place within a controller cycle or a PWM period.

Note

Constant adaptation of the output value limits

Instead of the active updating of the controllers without access to the actuator described here, this is implemented alternatively by constant adaptation of the output value limits in other controller systems.

This is not possible with PID_Compact, because a change of the output value limits is not supported in automatic mode.

Example: Control of a gas pipeline

PID_Compact is used for control of a gas pipeline.

The main goal is to control the flow rate Input1. The controller PID_Compact_1 is used for this purpose. In addition, the pressure Input2 (measured in flow direction in front of the valve) is to be kept below the high limit with the limiting controller PID_Compact_2.

Flow rate and pressure are controlled by a single solenoid valve. The output value of the controller corresponds to the valve opening: The valve is opened when the output value increases. This means the flow rate increases (normal control logic) while the pressure drops (inverted control logic).

The valve is controlled with the output value of PID_Compact in I/O format (parameter Output_PER) by writing the program tag ActuatorInput.

The setpoint for the flow rate is specified at the parameter PID_Compact_1.Setpoint.

The pressure high limit is specified as setpoint at the parameter PID_Compact_2.Setpoint.

Both controllers must share one valve as shared actuator. The logic that decides which controller gets access to the actuator is implemented by a maximum selection of the output value (in Real format, parameter Output) in this case. Because the output value corresponds to the opening of the valve, the controller that requires the larger valve opening gets the control.

Note

Activate inversion of the control logic

Because a decrease of the actual value (pressure) is to be achieved with the pressure regulator PID_Compact_2 when the output value increases (valve opening), the inversion of the control logic must be activated: PID_Compact_2.Config.InvertControl = TRUE.

In normal operation of the plant, the actual value of the flow rate corresponds to the setpoint. The flow controller PID_Compact_1 has settled on a stationary output value PID_Compact_1.Output. The actual value of the pressure in normal operation is significantly below the high limit that is specified as setpoint for PID_Compact_2. The pressure regulator therefore wants to close the valve even further to increase the pressure, which means it will calculate an output value PID_Compact_2.Output that is smaller than the output value of the flow controller PID_Compact_1.Output. The maximum selection of the switchover logic therefore gives the flow controller PID_Compact_1 continued access to the actuator. In addition, it is ensured that PID_Compact_2 is updated by means of the assignments PID_Compact_2.OverwriteInitialOutputValue = PID_Compact_1.Output and PID_Compact_2.PIDCtrl.PIDInit = TRUE.

If the pressure now approaches the high limit or exceeds it, for example due to a fault, the pressure regulator PID_Compact_2 calculates a higher output value to open the valve even further and thus reduce the pressure. If PID_Compact_2.Output is greater than PID_Compact_1.Output, the pressure regulator PID_Compact_2 receives access to the actuator through the maximum selection and opens it. It is ensured that PID_Compact_1 is updated by means of the assignments PID_Compact_1.OverwriteInitialOutputValue = PID_Compact_2.Output and PID_Compact_1.PIDCtrl.PIDInit = TRUE.

The pressure is reduced while the flow rate increases and can no longer be kept at the setpoint.

Once the fault has been remedied, the pressure will continue to drop and the opening of the valve is reduced by the pressure regulator. If the flow controller calculates a larger opening as output value, the plant returns to normal operation so that the flow controller PID_Compact_1 once again has access to the actuator.

This example can be implemented with the following SCL program code:

"PID_Compact_1"(Input := "Input1");

"PID_Compact_2"(Input := "Input2");

IF "PID_Compact_1".Output >= "PID_Compact_2".Output THEN

 

"ActuatorInput" := "PID_Compact_1".Output_PER;

 

"PID_Compact_1".PIDCtrl.PIDInit := FALSE;

 

"PID_Compact_2".PIDCtrl.PIDInit := TRUE;

 

"PID_Compact_2".OverwriteInitialOutputValue := "PID_Compact_1".Output;

ELSE

 

"ActuatorInput" := "PID_Compact_2".Output_PER;

 

"PID_Compact_1".PIDCtrl.PIDInit := TRUE;

 

"PID_Compact_2".PIDCtrl.PIDInit := FALSE;

 

"PID_Compact_1".OverwriteInitialOutputValue := "PID_Compact_2".Output;

END_IF;