> ## Documentation Index
> Fetch the complete documentation index at: https://wiki.codeandcompile.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PID Tuning Simulator

> Tune a PID controller on a simulated process and watch overshoot, oscillation and settling time change live, with Ziegler–Nichols and SIMC starting values.

Move the sliders and watch the controller react. The process is a typical industrial loop such as a tank level, an oven temperature or a motor speed: it reacts with a **delay** (dead time) and then settles **slowly** (time constant).

**━** Process value (PV)
╌ Setpoint (SP)
**━** Controller output (CV, %)

Overshoot

%

Settling time (±2 %)

PV before disturbance

/

Controller

Ziegler–Nichols
SIMC (smooth PI)
P only

Process

Add a load disturbance (−20 % at 60 % of the run)

## What each term does

* **Kp (proportional gain)** reacts to the current error. A higher Kp makes the loop faster, but too high makes it overshoot and oscillate. With Kp alone the process value stays below the setpoint: this is the **steady-state offset**.
* **Ti (integral time)** adds up the error over time and removes the offset. A shorter Ti acts more strongly, and too short causes slow oscillations. Set Ti to 0 to switch the integral off.
* **Td (derivative time)** reacts to how fast the process value changes and brakes the loop before it overshoots. It's sensitive to noise, so many real loops run as PI with Td = 0.

The controller uses the standard form `CV = Kp × (e + 1/Ti ∫e dt + Td × de/dt)`, with the output limited to 0–100 %. Like most PLC PID blocks, the derivative acts on the process value instead of the error, so setpoint steps don't cause a kick, and the integral stops while the output is saturated (anti-windup).

## Tuning rules used

For a process with gain **K**, time constant **τ** and dead time **θ**:

| Rule | Kp | Ti | Td | Character |
| - | - | - | - | - |
| Ziegler–Nichols (reaction curve) | 1.2 τ / (K θ) | 2 θ | 0.5 θ | Fast, aggressive |
| SIMC PI (Skogestad), τc = θ | τ / (2 K θ) | min(τ, 8 θ) | 0 | Smooth, robust |

> [!NOTE]
>
> This is a simplified first-order-plus-dead-time model without noise or valve limits beyond 0–100 %. Use the values as a starting point, then fine-tune on the real machine. Siemens `PID_Compact` and other PLC blocks also have their own auto-tuning.

## Related

> [card] [Analog scaling calculator](https://wiki.codeandcompile.com/tools/analog-scaling-calculator.md)
>
> Scale the 4–20 mA signal from your transmitter before it goes into the PID.

> [card] [Get my courses – 20% off](https://wiki.codeandcompile.com/who-am-i/get-my-courses-20-off.md)
>
> Learn PLC programming step by step. Use code **WIKI** for 20% off.


## Related topics

- [Free Engineering Tools](https://wiki.codeandcompile.com/tools/index.md)
- [Code and Compile Wiki](https://wiki.codeandcompile.com/index.md)
- [Course Presentations](https://wiki.codeandcompile.com/factory-automation/plc/siemens/s7-1200-basic/course-presentations.md)
- [Tasks and Solutions](https://wiki.codeandcompile.com/factory-automation/digital-twin/factory-io/tasks-and-solutions.md)
- [From Prompt to Live Dashboard with ThingsBoard AI](https://wiki.codeandcompile.com/product-reviews/smart-platforms/thingsboard/from-prompt-to-live-dashboard-with-thingsboard-ai.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.