Hi, Kataeb
I have worked on a lot of PID's over the last 2 years and they whipped my butt at the beginning. I had to use them a lot for valve, burner and fan controls for air handling units, so the gains are very slow. So what we wound up doing was making tags and using move blocks to be able to work with changing KP, KI and KD while the program is in run mode. One of my tags would be like: "AHU_8_React_Burner_1_Valve_Kp". That would be a real number data type. That value would be moved into the tag name of the PID like "PID_AHU_8_React_Burner_1.KP" Note the differences.
Since I had to have incredibly slow gains, I had like 0.0005 in KP, 0.016 in KI and zero in the derivative (KD). Then you can play with these and get the loop to become stable. I would suggest having a value in the .KI, because then it's simply a PI control.
To reset the output % to zero, you must keep the PID active on it's rung. I only condition that rung with the XIO done bit from the update timer, which is free running. I don't use scheduled tasks for PID's. Be sure the PID update time in the PID configuration matches the preset on the update timer!! Very important. I usually use half a second (500ms). That would be .5 seconds in the update time in the PID configuration. When the process stops, or is at rest, or the machine is no longer desired on, use XIO's to move zero percent into the Output percent and at the same time activate PID_(tag name).SWM and move zero into PID.SO. When you want the process to start again, the XIO's go false and then the PID takes over. This way you can start the output from zero and not let the PID start at say the last percentage it was before you paused the process. This whipped me for a while, they didn't like the fans taking off from zero to 80%. I had to spend a lot of time figuring this out. Remember to click "Help" on each configuration screen on the PID and that will get you information also. Hope this helps, wish you the best.