RT-PLC-404 · IDE en el navegadorPrograma tu propio PID en SCL y pruébalo en el gemelo PLC STOP
PROYECTO
▾ 📁 RoboTics_Nivel
  ▾ 🖥 PLC_1 [CPU 1214C]
    ▾ 📁 Bloques de programa
      🟦 Main [OB1]
      ⏱ Cyclic interrupt [OB30]
      🟧 FB_MiPID [FB1]
      🗃 FB_MiPID_DB [DB1]
    ▸ 📁 Objetos tecnológicos
    ▸ 🏷 Variables PLC
LLAMADA EN OB30 (50 ms)
"FB_MiPID_DB"( Setpoint := "SP_Nivel", Input := "PV_Nivel", Output => "CV_Valvula");
ATAJOS
Ctrl+B · Compilar
Ctrl+Enter · Pruebas
NombreTipoArranqueComentario
▾ Input
SetpointReal—Consigna de nivel (%)
InputReal—PV escalada con NORM_X/SCALE_X (%)
GainRealGanancia proporcional
TiRealTiempo integral (s)
TdRealTiempo derivativo (s)
CycleReal0.05Periodo del OB30 (s)
▾ Output · ▾ Static (se crean al asignarlas: #I, #PrevInput…)
Información · Compilar para validar el bloque FB_MiPID.

Pruebas automáticas

PVSPOutput
¿Atorado? Pistas progresivas
La integral acumula: #I := #I + #Gain * #Error * #Cycle / #Ti; dentro de un IF #Ti > 0.0 THEN … END_IF;
Anti-windup por integración condicional: calcula #U := #P + #I; y sólo integra si NOT ((#U >= 100.0 AND #Error > 0.0) OR (#U <= 0.0 AND #Error < 0.0)).
Ver solución de referencia