No announcement yet.

PID Loops with Discrete Outputs

  • Filter
  • Time
  • Show
Clear All
new posts

  • PID Loops with Discrete Outputs


    I am a beginner with some basic knowledge of ladder logic, but I have come across a roadblock while writing some project code. I have a Productivity3000 series PLC connected to an RTD Sensor and a C-More touchscreen. What I am attempting to do is to control a resistance heater using a PID loop, but have run across an issue that the manuals I've looked at fail to address - what if my heater output is discrete? I've managed to make a very primitive thermostat using the "Compare Values" function, and it does almost what I want it to do - but the temperature overshoots frequently. I think that a PID or PI Loop might mitigate this problem, but I'm not certain how, as it demands an analog output. This confuses me, because I thought that using analog switches with a PID loop was a no-no because of wear on the switches. I currently have a solid state relay controlling my heater instead of a switch. Any help is appreciated.

  • #2
    The help file in the PID instruction shows (The example with the Hot Air Balloon) how to run the PID output with ON & OFF time. So if the output is high then the Relay will be on longer and Off Less, if the output is low then the relay is on for a short time but off longer.


    • #3
      So, I have the basic process set up as in the help file, but I'm having difficulty getting the process to actually run. Any advice? below is my code.
      Attached Files


      • #4
        It looks like you didn't assign the 'Current Value' tag in the Simple Timer setup, even though you're using it in the compare function at the bottom.
        Take a look again at the manual where you pulled the example from, and you should see what I mean.

        Secondly, your PID1AUTO bit is off, which means the PID loop is in manual mode.


        • #5
          For heaters, a PID output is a duty cycle based on cumulated effects of P, I, D.
          Therefore the output of a PID is a discrete output already. That is what feeds a solid state relay which powers the heating resistor. At least this is how it works in a hardware PID controller.

          A thermostat only tells that temperature is above or below set value. Canít work with PID. you need a temperature sensor in order to compare its reading to a set value.

          However, even if the PID returns an analogue value- like for an AC motor drive, for heating you need to convert it to a duty cycle. Can be done in ladder logic.

          and now the long story

          PID works only when the inertia of the system hardly overcomes the integral action of heating.

          imagine the PID as three flames. The strongest flame is I and must be pretty much constant throughout. Then D is like I, however it can change duty cycle in only 10% of time base of I. P is the linear component, it changes even faster than D- in 1% time base of I.

          These three factors work well only if I provides 90% of heating, D provides 9% and P 1%. In case oh a heating controller, since cooling can not be controlled, the error that affects the duty cycle of each othe three can only be negative or positive, but not both. Can be zero as well.

          Diagnose of the PID controller:
          1. At start-up it overheats, even enters overtemp alarm.
          This usually happens because although the PID is set to work well when at temperature, it does not work well at startup due to high thermal resistance of the the object being heat up.for this reason, the integral error maximizes over the long heating time and even if the integral effect ramped down as soon as it reached temperature, this is not happening fast enough and the overheating takes place. At that moment, the PID is all zeroed in order to allow cooling. Then the cooling takes place at a pace that can be fast enough to drive the PID at 100%, which again could result in overheat.

          my troubleshooting in this case would be to reset the heater before it reached the set temp. A power cycle is a bit harsh, but effective.
          a smart way to startup is to use a second set of PID values ( with lower I component) for an idle temperature lower than the normal temperature. Although this set might tend to overshoot, will have a better chance to stabilize and getting from there to normal set value will not overload the PID.
          the reason this works is that the lower I will produce less overheating effect, although on expense of longer startup.

          2. If the PID started cycling after it worked fine for a while, it means the inertia of the system changed too much. Example: when the hot melt tank went almost empty and too much cold glue pellets were added, in case of a hot melt machine.

          the easiest troubleshooting is to learn not to overload the PID. All machine operators know that.
          the dumb troubleshooting is to change the P, I, D values. If you do that, be around to change them back as soon as the controller approaches the set value. Note: changing the PID is equivalent to adjusting to higher thermal inertia, but again at the risk of overheating when temperature approaches the set value.

          3. A heater tends to overheat at shutdown. As long as it does not burn the heater, either let it be or use a fan to help cooling. Usually heaters have a standby setup which is a second PID set meant to maintain a lower temp. That allows a safe shutdown as well.

          Conclusions on PID:

          The inertia of the system can only be controlled within a narrow range.
          when a PID runs out of control, two culprits need be checked their alibi:
          1. The sensor providing the process value
          2. The system inertia

          A PID controlled system is a closed-loop system. A servo system, if you want. Servo drives employ PID and the reason we donít see much complaint is that the mechanical inertia is maintained under tight control by adjusting motor speeds and ramping accordingly. Although acceleration and stopping might seem fast for human eye, is well within the capabilities of a servo drive. By contrast, a temp controller can hardly provide
          Last edited by Alexandru; 10-15-2018, 12:10 PM.


          • #6
            In Chapter 8 page 43 for the DL405 User Manual it is said that the derivative gain for temperature control loop is never used. I don't understand that. We have a heater that is set to PI loop but it tends to overshoot by 50 degrees if not more. When I added the D (rate) parameter to the loop the value stabilized. Should I remove the rate since it is not used for temperature control and try to manually tune the proportional and reset values? Can someone guide me? thanks.


            • #7
              I think we should clarify what youíre doing:
              1. Start the PID
              2. Start timer1
              3. Scale the control value when timer1 is done ( to active duty)
              4. Use control value as time base for timer2
              5. Use timers 1 and 2 as duty cycle generator for output to heater

              i donít see a mistake in ladder logic.

              If this doesnít work continuously, is because the PID is not set up properly.
              If it overheats, the integral gain is too high. However, in your ladder is not a straightforward fix. Since you donít have control over integral gain, then three factors need adjustment:
              prop gain
              integral time
              the period of the duty cycle.

              i donít know what I would do first, probably reduce the number of variables by making the integral time equal to duty cycle. This way I would only have to adjust prop gain.


              • #8
                They donít use the derivative gain cause is quite similar to proportional gain. So they made a PI out of PID. I have explained the ponder of each gain in my first post here, see if that helps.


                • #9
                  I fixed it. Thank you all!


                  • #10
                    wouldn't hurt to tell what was wrong and how you fixed it. we could all learn from it


                    • #11
                      I failed to remove the PIDAUTO bit after I finished tuning and replace it with PID1EN. Entirely user error.