PID

PID Controller

Continuous
Ejecutar el ejemplo en vivo Gratis · sin registro · funciona en tu navegador

El bloque PIDController implementa un controlador Proporcional-Integral-Derivativo estándar para sistemas de control por retroalimentación en bucle cerrado. Combina tres términos de control en paralelo para regular con precisión un proceso: una acción proporcional para respuesta inmediata, una acción integral para eliminar el error en estado estacionario y una acción derivativa para amortiguar sobreimpulsos.

Vídeo tutorial

Modelo Matemático

u(t)=Kp e(t)+Ki∫0te(τ) dτ+Kd ddte(t)u(t) = K_p \, e(t) + K_i \int_{0}^{t} e(\tau) \, d\tau + K_d \, \frac{d}{dt} e(t)

Aproximación numérica discreta:

I[n] = I[n-1] + Ki × e[n] × Δt                              (Euler hacia adelante)
D[n] = (Kd × N × (e[n] - e[n-1]) + D[n-1]) / (1 + N × Δt)  (Filtro Euler hacia atrás)

La función de transferencia del filtro derivativo es Kd × N × s / (s + N), donde NN es el coeficiente del filtro. Este filtro paso bajo previene la amplificación del ruido de medición. Un valor mayor de NN implica menor filtrado (N→∞N \to \infty corresponde a una derivada pura). Los valores típicos oscilan entre N=10–100N = 10\text{–}100.

Entradas y Salidas

Direction ID Label Tipo Status
→ In error Error number Required
→ In reset Reset number Optional
← Out out Output number Output
← Out p P number Output
← Out i I number Output
← Out d D number Output

Parámetros

Parámetros Label Tipo Por defecto Descripción
kp Proportional Gain (Kp) number 1 Controls immediate response to error
ki Integral Gain (Ki) number 0.1 Eliminates steady-state error over time
kd Derivative Gain (Kd) number 0.1 Dampens oscillations by responding to error rate of change
n Filter Coefficient (N) number 100 Derivative filter cutoff frequency. Higher = less filtering
form PID Form select parallel Parallel: u = Kp·e + Ki·∫e + Kd·de/dt. Series: u = Kp·(1 + 1/(Ti·s) + Td·s)·e
min Saturation Min number -1000000000000000 Lower output limit for anti-windup protection
max Saturation Max number 1000000000000000 Upper output limit for anti-windup protection
showComponents Show P/I/D Outputs boolean false Expose individual Proportional, Integral, and Derivative term outputs

Ejemplos de Uso

Control de Temperatura de un Horno

Setpoint (200°C) → [+]
                     \
Temp Medida   → [-] → Error → PIDController (Kp: 2, Ki: 0.05, Kd: 1) → Calentador

Control de Posición de un Servomotor

Una señal escalón como posición objetivo requiere Kd>0K_d > 0 para amortiguar el movimiento y evitar que el servomotor sobrepase u oscile alrededor de la posición final.

Observaciones y Buenas Prácticas

  • Estándar Industrial: La gran mayoría de los lazos de control de retroalimentación en la industria emplean controladores PID.
  • Sintonización (Tuning): Use el botón Auto-Tune del panel de propiedades para calcular Kp,Ki,KdK_p, K_i, K_d dentro de su límite de sobreimpulso y margen de seguridad, o empiece solo con KpK_p y añada después KiK_i y KdK_d.
  • Paso de Simulación: Todas las ganancias operan de manera consistente e independiente del paso temporal Δt\Delta t, que se gestiona internamente.

Preguntas Frecuentes (FAQ)

Q: How does PID anti-windup clamping work and when should I use back-calculation?

Clamping (conditional integration) halts integration whenever the actuator output saturates AND the control error has the same sign as the saturated output. This prevents the integrator state from accumulating error that cannot be physically actuated. Back-calculation continuously discharges the integrator state via a feedback gain KtK_t proportional to the difference between demanded and saturated control output (u−usatu - u_{sat}). Clamping is ideal for hard physical limits (valves, PWM duty cycle) to eliminate severe overshoot upon setpoint recovery.

Q: What is the derivative filter coefficient N in the PID block?

An ideal derivative term D(s)=Kd⋅sD(s) = K_d \cdot s has infinite high-frequency gain, amplifying sensor noise and causing actuator chatter. BlockWerk implements a real, band-limited derivative filter: D(s)=Kd⋅s1+sKdND(s) = \frac{K_d \cdot s}{1 + s \frac{K_d}{N}}. The parameter NN (typically chosen between 8 and 20) places a low-pass roll-off pole at frequency ωp=N/(Kd/Kp)\omega_p = N / (K_d / K_p) rad/s, providing derivative phase lead at control frequencies while attenuating high-frequency noise.

Bloques Relacionados