PID_Compact is a closed-loop control block built into the S7-1200. It packages the PID arithmetic, output clamping, manual/automatic switching and self-tuning, and works with a technology object. It is easier than writing a PID by hand, but it has many settings and wrong ones are harder to trace than no PID at all. The sections below follow the order in which it is used.
PID_Compact brings the fiddly parts of closed-loop control into one instruction: proportional, integral and derivative terms, output limits, manual and automatic switching, and self-tuning. It keeps its state in an instance data block and is bound to a technology object, and you call it with that instance block. Understand this and every later setting has a place to sit.
Before use, create a PID object under Technology objects and set the measured-value input, the output channel, the control direction and the sample time. The control direction matters: for heating and pressurising, where a larger output should raise the measured value, the direction is the opposite of cooling or vacuum, and choosing it the wrong way makes the loop diverge. The sample time should match the program call cycle.
The block has manual, automatic, pretuning and fine-tuning modes. Run in automatic normally; tune using pretuning and fine-tuning; switch to manual to give the output directly during commissioning. It must be called once per cycle from a fixed place. Putting it inside a conditional branch skips the call and leaves the state wrong.
Proportional gain, integral time and derivative time set the speed of response and the overshoot: a smaller integral time means stronger integral action and faster removal of steady-state error, but too small causes oscillation; derivative action damps overshoot and speeds up the response. The output limits should match the real range of the actuator, such as 0-100% for a valve or the full analog range.
Pretuning applies a fixed output and watches the response to obtain a rough set of parameters; fine-tuning adjusts them near the setpoint. Tuning needs a process that allows disturbance, so a hazardous or disturbance-sensitive process should be given parameters by hand or tuned with the machine stopped. Once tuning is done, fix the parameters and record them.
| State or symptom | Meaning | Common cause | Action |
|---|---|---|---|
| Initial state | Not yet enabled | Not enabled or call misplaced | Check enable and cyclic call |
| Pretuning | Rough parameters being found | Tuning interrupted | Keep the process steady and tune |
| Fine-tuning | Parameters being trimmed | Large disturbance near setpoint | Allow small disturbance |
| Automatic | Normal closed-loop control | Suitable parameters | Watch curve and overshoot |
| Manual mode | Output given by hand | Commissioning or contingency | Match value before returning to auto |
| Output saturated | Output at a limit | Wrong range or setpoint | Check actuator range and setpoint |
| Alarm: sampling or parameter error | Configuration problem | Technology object set incorrectly | Check each configuration item |
| Alarm: excessive disturbance | Tuning failed | Process variation beyond limits | Reduce disturbance and retry |
| No output | Block not working | Not called or not enabled | Check call location and enable bit |
The trick with PID_Compact is to get the order right: create the technology object, call the block, then tune the parameters. Skip any step and the symptoms afterwards point in the wrong direction. When giving parameters by hand, start with a smaller proportional gain and a longer integral time, then tighten gradually.
The programming and data types of closed-loop control follow GB/T 15969.3, Programmable controllers, Part 3: Programming languages (equivalent to IEC 61131-3). The safety requirements for actuators and process equipment follow GB 5226.1 and the equivalent international standard IEC 60204-1. The exact block parameters and alarm codes are as stated for the CPU version and technology object in use.
Tune and commission only where the machine allows disturbance, and keep a record of the parameters. Before going to automatic, confirm the actuator direction and range in manual.