Sorry if this is basic. School project, a small heated water tank on a bench. CPU 1212C DC/DC/DC, TIA V17, PID_Compact V2 called in OB30 with a 100 ms cycle. Heater on a PWM output, Pt100 through an SM1231 RTD.
Setpoint 60.0, Input shows 22.5 and follows the tank, so the measurement works. But State stays 0 and Output stays 0.0, and the heater never comes on. I opened the commissioning window and started pretuning and it says something like "controller inactive" and does nothing. I also checked that OB30 is really running with a counter, and it is.
I thought the block starts controlling by itself once it's got a setpoint. What did I miss? Pretty sure there's a step that puts the block into a mode and I've skipped it, State 0 has to mean something.
OB30 at 100 ms is right, leave that alone. Look at the call: what's wired to Mode and ModeActivate? And in the static data, what's RunModeByStartup set to?
Mode isn't connected, ModeActivate isn't connected. I thought they were optional, maybe not. What does RunModeByStartup mean, is it the mode the block takes when the CPU starts?
Before the software, one check: with the heater forced on from a watch table, does the Pt100 climb? If yes the loop is proved and it is only the block.
Then the block. PID_Compact comes up Inactive after every CPU restart and waits to be told. Either wire Mode to 3 and pulse ModeActivate once with a rising edge, or set RunModeByStartup to true in the static data so it goes to automatic on its own at start. State goes 3, Output starts moving. Nothing to do with the scaling.
Longer version with the block states is here: https://plctr.com/implementing-pid-control-in-plc-systems/
Forced the heater first, the Pt100 climbed, so the loop was fine. Then I set RunModeByStartup to true, restarted the CPU, State went to 3 and Output started at about 40 percent and the tank is heating.
So the block had never been put into automatic at all, it was sitting there waiting to be told, and RunModeByStartup does the telling at start. I also had Mode backwards, I thought 0 was automatic.
One thing I don't understand: the commissioning window has a Start button, and I'm not sure why that didn't put it in automatic. Thanks marekw and tomhw.