why are PID's so much more popular than PLC?

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

Thedutchtouch

Well-Known Member
Joined
Nov 7, 2013
Messages
468
Reaction score
82
Location
Berwyn Heights
i'm getting into researching the jump from propane to electric, and during discussions with my dad (engineer) ran into some questions that i couldn't answer. why are the PID based systems seemingly more popular than a PLC? (for the DIY crowd) is it that PID's are somewhat plug and play, while a PLC requires knowledge of how to create a program? he swears up and down that a PLC would be a cheaper and more customizable option, but they surely don't seem to be as popular, so wondering what the reasons are.
 
PLC is probably more expensive and definitely more work if you are programming yourself. Buying a PID you basically enter the setpoint and I imagine you can enter tuning parameters (ie how fast or slow you want the heating element to heat the wort/mash etc..) I would go PID. I am currently using my electric stove, pretty rudimentary, right now until I have enough to invest in an electric system myself and will definitely get PID controllers.
 
PID - Proportional Integral Derivative. A controller for controlling rate of change of a value with other outputs that it may control.

PLC - Programmable Logic Controller. A PLC is simulated relay logic controller. Typically a bank of discrete inputs and outputs; Digital or Analog, AC or DC.

A long time ago people used to use mechanical relays (switches) to hard wire logic (AND, OR, Latches, Timers-ON and Timers-OFF). Now its all done in ladder diagrams to simulate hard wiring.

I'm an automation engineer and have been away from this hands-on type of work for awhile. I am going to assume PID controllers are more popular because people don't want to create the code to do what a PID controller can do. While its possible to do on a PLC its easier to use PID Controller all alone or integrate it into a PLC.

While I don't have any recollection of the calculus for a PID I would use it as a module within a control system. Its easy, you have set points and limits to plug in and its all there. Somebody has done all the hard (logic)work for you. You just have to figure out the power supply, temp inputs and heating/cooling outputs.

Another example where you consider a PLC or another controller might be a frequency drive controller. This device controls the amount of voltage going to an AC Motor to change the rpm. (you might have it connected to a pump) It has canned routines for ramping 0-1725 rpm within a given time. It also can have dynamic braking to slow or stop an AC motor. The logic is all ready programmed into the controller. The user interface is built into the controller or it can be controlled by a PLC.

Now a days I think an industrial PLC might have a software PID module and hardware plug ins. Like I said I've been away from this for awhile.

A simple system with a single temp control purpose - stand alone PID controller with the 110 VAC power supply, thermo-couples, heating elements and etc.

A complex system with a multiple control features (like switches, multiple power requirements, AC and DC, thermo-couples, pH meters, lights, motors, solenoids, contacters, heating elements, and pumps) - use a PLC and a PID module.
 
Schlenkera, thank you very much, your answer was very clear, and really helped me understand the differences. i think my dad was assuming i'd automate the pumps, valves, etc as well... which i can see the PLC coming into play. but since at this point i'd just like to dial in a temp with an electric element, and will manually switch valves etc... this makes much more sense for the PID.. it seems we may have another Kal clone in the works.
 
My career is controls engineering... PLCs and PIDs are a normal every day thing.

For my electric brewery I choose to go with discrete PID controllers (I went with Auber ones, but they are a piece of shat company to deal with, and i hope they go out of business, pieces of trash). Worst experience ever. Spend your money elsewhere. Miserable. Miserable. Miserable. But back to the point...

Mainly went with discrete units due to cost and simplicity. PLCs just add too much complexity for what we're doing at a home brew level. Also they tend to be hundred of dollars, plus an HMI, which can be hundreds more. You can get a perfectly capable PID for less than $40. It's not as flexible, but you don't need it to be.

Just don't buy Auber. They suck.
 
Good summary, @Schlenkerla. One comment... PID math is really simple - no calculus required.

I am confident PID loops are easy in a PLC. It's just the hardware is much more expensive. As noted above, the PLC can do lots more, but if you don't use it, it's a waste.
 
my vote for cheap pids with the manual pwm mode you will want is the mypin TD4-snr (around $25 shipped(... if your looking for more// the auberins ezboil was made for home brewing and they can be bought for around $40-55 + shipping depending on options. it has a knob for controlling the boil in manual mode which many people like but its technically not a pid either.
 
I've been designing/programming industrial controls (for the power plant industry) for the past 30 years. As mentioned when using PLC's the costs add up by adding automated valves, analog input modules, transmitters, etc. If you opt to add an HMI you have added cost of the HMI unit and associated software but gain the advantage of having more information available (status of pumps, valves, temperatures, etc.) and can have a menu system setup for different styles of beer.

What most people don't realize is the life cycle of PLC's and HMI's. By life cycle I am referring to when the manufacture no longer manufacture parts or provides support for the hardware. For HMI's the life cycle also includes the windows operating system used for windows based units as well as the programming software. PLC's typically have a 15 year life cycle and HMI's usually have a 7 year life cycle, HMI's have a shorter life cycle mainly due to the windows based hardware platform becomes obsolete which is also related to the software used to program the HMI. There are options to upgrade the HMI software, however if it doesn't support the hardware platform then you have to upgrade both.

Over the years I get involved with control upgrades for our systems but there are still a handful of relay based control systems that are still working after 75 years.

I plan on designing a control panel for my 2 BBL electric RIMS system and I am leaning on using the non-PID based controller (ezboil) since I feel that a PID controller is overkill for the home brewery application. I also plan on using old fashioned switches, lights and pushbuttons for control. I however will use a variable frequency drive (VFD) to adjust the speed of my recirc pump. This also will allow me to feed the VFD with 220V single phase power and the VFD will provide the pump the needed 3-phase power.
 
Good summary, @Schlenkerla. One comment... PID math is really simple - no calculus required.

I am confident PID loops are easy in a PLC. It's just the hardware is much more expensive. As noted above, the PLC can do lots more, but if you don't use it, it's a waste.

Thanks for the compliments.

I have used temp controllers and they are very simple and easy to use.

In the summary I was thinking of the possible complexity of a PID loop system with multiple hot & cold process in-flows and how a system slowly or quickly, heats or cools to maintain a uniform temperature. Meaning do I bump the heat source up a little or a lot. Little:for a Longer Time verses A lot:for a Shorter Time. Meanwhile, taking into account how far the temperature is off target with the goal of being off target for the minimum time and not over shoot the target.

A PID System Figures this out for you.

Think of temperature monitoring over time. I think of sine wave where you want the amplitude very flat with a long stretched-out wavelength frequency. Mainly for consistency of temperature over time.

Amplitude is temperature (Y Axis, or vertical)

Wavelength frequency is time (X Axis, or horizontal)

sine.gif


The top one below (in black) is more desirable for a consistent temp and minimal adjustment. Disregard the wave titles. I wanted to use this just as an example of temp fluctuation over time.

Amplitude-and-Frequency-Modulation-Illustration-Three-sinusoidal-waveforms-are-shown.png
 
Good summary, @Schlenkerla. One comment... PID math is really simple

Proportional, Integral, Derivative.

- no calculus required.

???

A PID controller's output is a linear blend of the error (PV - SP), the rate of change of the error (derivative) and integral of the error so of course we do indeed have to do calculus. But that's hardly a big deal.

Anyway, all this is mooted to some extent by the fact that modern temperature controllers, even the cheapie ones we use here are trending towards fuzzy logic these days.
 
I don't understand your point "multiple hot & cold process in-flows", nor of the relevance to AM or FM waveforms... The temp response will likely not be sinusoidal in our systems.

Disregard the AM/FM sine wave form for clarities sake. I could have used a unilateral trend chart with the middle axis being the target over time.

In general terms I was thinking of how complex a PID loop could be.

Not related to brewing. Just industrial... Imagine varying degrees of heating and cooling inputs like hot/cold water flow (temperature and volume) into a controlled system with variable heat sources. How much current you're going to send to a large immersion coil. Make it more complex add a separate system operating drains and spill overs with float switches.
 
Proportional, Integral, Derivative.







???



A PID controller's output is a linear blend of the error (PV - SP), the rate of change of the error (derivative) and integral of the error so of course we do indeed have to do calculus. But that's hardly a big deal.



Anyway, all this is mooted to some extent by the fact that modern temperature controllers, even the cheapie ones we use here are trending towards fuzzy logic these days.


No calculus is required, practically. There, that better?

When you write a PID algorithm for a control system, the calculation is performed every given time period, so in effect calculus is being performed. But from an executional standpoint for each calculation, the Proportional calculation is subtraction (aka addition), the Derivative is division, and the integral is addition. Combine those via addition. Not complex math in any form.
 
A PID System Figures this out for you.

Suppose you have a can which has water in it to a depth of 6". For whatever reason you want it full to 9" depth and have a variable speed pump you can use to add water to it. There is a small hole in the bottom of the can and some water runs out of it. You have a sensor which gives you a voltage proportional to 9" minus 9" the water level so that, initially, you get a voltage of lets say 3 volts (1 volt per inch to make it easy). That voltage is processed and passed to the pump motor which delivers water at a rate that depends linearly on the voltage applied to it. What should the relationship between the motor voltage and the error voltage be? That depends. Obviously if the water level gets disturbingly low we would want to apply the maximum voltage to the pump to raise the water level back towards the target quickly and clearly if the water level is too high to the point that the can is in danger of overflowing we would want to shut the pump off (motor voltage 0). In between it might make sense to have the motor voltage proportional to the error voltage. If the error voltage is 0 the motor voltage is 0. If the error voltage is positive, the can is too full and the error voltage will be negative. So we should apply a negative voltage to the motor and run the pump backwards removing some water. But our pump won't run backwards so whenever the error voltage is negative we send 0 volts to the pump.

If you haven't seen the analogy to mash temperature control in this go back and read it again (if you care).

If the water level (temperature) drops below 9" now we have a positive error and the pump runs adding water (heat) causing the water level to rise which it does until the level is just enough below 9" that the developed pump voltage is sufficient that the pump is supplying water at the same rate the water is running out of the can. Things are then steady but the steady state water level is not at 9" but a bit below depending on the proportionality between the error and the pump voltage. This is a Proportional Controller - a 0 order feedback loop and the shortcoming with it is obvious. The steady state error is not 0.

To fix that we integrate the error that is sample its value every second or so and add all the values up. If we are at the Proportional steady state the constant errors keep ramping the accumulator up so the obvious thing to do is take a bit of the integrator output and add it to the proportional error and send that to the motor. If we reach exactly 9" water level the error is then 0 and no further augmentation of the integrator's output occurs. This is PI control.

Now suppose somebody comes along and punches another hole in the can so that the water starts to run out faster. The water level starts to drop quickly and if we want to respond to such a situation quickly we could take the differential (rate of change) of the error and add that scaled in some suitable way to the sum of the proportional and integrated errors. We now have PID control.

The big disadvantage of PID control is that the system must be 'tuned' to the system we are trying to control (tuning means selecting the gains of the proportional, integral and differential channels prior to summing them). When we tune we are characterizing the system in terms of a classical linear system and are trying to optimize the transient response (critical damping, no overshoot or droop). If we tune for 100 lbs of grain at a 1.6 qts/lb water rate and heat loss corresponding to a spring day and then mash 50 lbs of grain in the winter with a 1.3 qts/lb ratio the tuning will not be right and we will not get the response we want.

Fuzzy logic is somewhat immune to this as we don't model the system in the same way.
 
The am/fm chart was showing that one would NOT want a lot of variation over time. That one would prefer a flatter line.

However in a trend chart.

A zoomed out view of the fluctuation over time might look more like a wave form.

That's just my mental picture of this. Wrong or right. That's what I was thinking (post #11)
 
No calculus is required, practically. There, that better?

My point was really that at the very core of a PID system lies the classic integral/differential equation of linear system theory and the very name emphasizes this.

When you write a PID algorithm for a control system, the calculation is performed every given time period, so in effect calculus is being performed. But from an executional standpoint for each calculation, the Proportional calculation is subtraction (aka addition),
.. of the PV from the SP to obtain the error for that time sample

the Derivative is division,
The derivative is obtained by subtracting the current error from the error at the previous sample time. If you want you could divide by the time interval but we don't like dividing if we don't have to and so would probably not do that and simply incorporate the scale factor into the D gain parameter

and the integral is addition. Combine those via addition
Check


Not complex math in any form.
If you wanted the LaPlace transform of the system response (for what ever reason - probably because you are taking a course in this ) you would have to use 'complex' math but you would still implement it with simple additions, subtractions, multiplications and divisions. That's basically all computers can do.

Don't take me too seriously here. Just enjoy thinking about this stuff I haven't touched in years from time to time.
 
Let me say this. In a former life I was an automation engineer and manufacturing engineer. No expert in PID. I know it's application at a high (bird's eye) level. I used simple temp controllers.

My expertise was more in ladder logic, non contact sensors, and systems integration. To include gutting old electronics and installing new systems. Plating, pick and place, conveyors, and Turnkey CNC Machines. Lots of NC and PLC programming.
 
I've just started designing a new control panel and planning on doing all the control systems in firmware (i.e., replacing 3 hardware PID modules with code). I know off-the-shelf source code is available to perform the PID control system, so there's where I'm going to start with that. I'll end up posting a build thread at some point and I'll let you all know how it went. I know generally how these things work, but "generally" will have to be improved when I get down to the nuts and bolts of getting it actually working :)
 
$5 arduino and some time playing in c++ worked out well for me.

In regard to customization, simplicity or complexity the sky is the limit. Here is an opensource PID algorithm library: http://playground.arduino.cc/Code/PIDLibrary
For my RIMS I started with that but wound up with more of a thermostat logic until within a few degrees or so, then I move into a cascade control algorithm with a little PID thrown in there. ( I got a lot of help from a control engineer on this forum )

It's cheap and effective but I spent a lot of time in tinkering in development, but that's just another part of the hobby for me. If you're not into that aspect of it an off the shelf PID is very appealing.
 
The PID algorithm is so simple to code I hardly think it necessary to try to adapt canned stuff

do
read PV
Err = SP - PV
Integ += Err
Diff = Err - Old_Err
Old_err = Err
Out = A*err + B*Integ + C*diff
output Out
wait (Delta_T)
while (True)


A, B and C are the tuning parameters and, of course, you have to find those. You also need to have a little logic in there to go to full on if outside the proportional band on the low side and to 0 if above the set point.

You might want to make the integrator 'leaky'

Integ = alpha*Integ + (1 - alpha)*Err

I'd think the challenges would be in the read and write (interfacing to the RTD's and heater controls esp. if the output is going to be proportional), implementing the timing delay, displaying PV etc.

Sounds like fun.
 
The PID algorithm is so simple to code I hardly think it necessary to try to adapt canned stuff

do
read PV
Err = SP - PV
Integ += Err
Diff = Err - Old_Err
Old_err = Err
Out = A*err + B*Integ + C*diff
output Out
wait (Delta_T)
while (True)


A, B and C are the tuning parameters and, of course, you have to find those. You also need to have a little logic in there to go to full on if outside the proportional band on the low side and to 0 if above the set point.

You might want to make the integrator 'leaky'

Integ = apha*Integ + (1 - alpha)*Err

I'd think the challenges would be in the read and write (interfacing to the RTD's and heater controls esp. if the output is going to be proportional), implementing the timing delay, displaying PV etc.

Sounds like fun.

Code:
bool PID::Compute()
{
   if(!inAuto) return false;
   unsigned long now = millis();
   unsigned long timeChange = (now - lastTime);
   if(timeChange>=SampleTime)
   {
      /*Compute all the working error variables*/
	  double input = *myInput;
      double error = *mySetpoint - input;
      ITerm+= (ki * error);
      if(ITerm > outMax) ITerm= outMax;
      else if(ITerm < outMin) ITerm= outMin;
      double dInput = (input - lastInput);
 
      /*Compute PID Output*/
      double output = kp * error + ITerm- kd * dInput;
      
	  if(output > outMax) output = outMax;
      else if(output < outMin) output = outMin;
	  *myOutput = output;
	  
      /*Remember some variables for next time*/
      lastInput = input;
      lastTime = now;
	  return true;
   }
   else return false;
}
(source)

Pretty d**n close to what I got! :mug: I just couldn't grasp how simple PID actually was until I got a look at an actual algorithm.
 
A morsel in the academic fodder manger indicated that division of the first difference by the inter sample interval is not necessary as the intersample intervals are the same. If the intersample interval can be other than constant (if for example an interrupt could suspend looping until its service routine completes) it will be necessary to keep track of the interval between samples and to divide by the intersample interval. It's probably easier and adequate to simply detect that the intersample interval is not what is expected and set the derivative term to 0 for that cycle.
 
A morsel in the academic fodder manger indicated that division of the first difference by the inter sample interval is not necessary as the intersample intervals are the same. If the intersample interval can be other than constant (if for example an interrupt could suspend looping until its service rotine completes) it will be necessary to keep track of the interval between samples and to divide by the intersample interval. It's probably easier and adequate to simply detect that the intersample interval is not what is expected and set the derivative term to 0 for that cycle.

Funny you should mention! as I did end up modifying the canned PID algorithm I posted above to account for changes in the sample interval like so:

Code:
float PID::calc()
{
   unsigned long now = millis();
   float timeChange = (float)(now - lastTime)/1000.0;

   /*Compute all the working error variables*/
   float input = *myInput;
   float error = *mySetpoint - input;
   
   ITerm+= (ki * timeChange * error);
   ITerm = constrain(ITerm, kioutMin, kioutMax);
   
   float dInput = (input - lastInput);
 
   /*Compute PID Output*/
   float output = kp * error + ITerm- kd / timeChange * dInput;
   output = constrain(output, outMin, outMax);
	  
   /*Remember some variables for next time*/
   lastInput = input;
   lastTime = now;

   return output;
}

Gotta love the freedom of customizable open source! :tank:
 
I've been designing/programming industrial controls (for the power plant industry) for the past 30 years. As mentioned when using PLC's the costs add up by adding automated valves, analog input modules, transmitters, etc. If you opt to add an HMI you have added cost of the HMI unit and associated software but gain the advantage of having more information available (status of pumps, valves, temperatures, etc.) and can have a menu system setup for different styles of beer.

What most people don't realize is the life cycle of PLC's and HMI's. By life cycle I am referring to when the manufacture no longer manufacture parts or provides support for the hardware. For HMI's the life cycle also includes the windows operating system used for windows based units as well as the programming software. PLC's typically have a 15 year life cycle and HMI's usually have a 7 year life cycle, HMI's have a shorter life cycle mainly due to the windows based hardware platform becomes obsolete which is also related to the software used to program the HMI. There are options to upgrade the HMI software, however if it doesn't support the hardware platform then you have to upgrade both.

Over the years I get involved with control upgrades for our systems but there are still a handful of relay based control systems that are still working after 75 years.

I plan on designing a control panel for my 2 BBL electric RIMS system and I am leaning on using the non-PID based controller (ezboil) since I feel that a PID controller is overkill for the home brewery application. I also plan on using old fashioned switches, lights and pushbuttons for control. I however will use a variable frequency drive (VFD) to adjust the speed of my recirc pump. This also will allow me to feed the VFD with 220V single phase power and the VFD will provide the pump the needed 3-phase power.


Why would you add vfd drives on a system with lights, pushbuttons and switches? Isnt the beauty of manual rig having a manual valve on a pump discharge to adjust flow?
 
Why would you add vfd drives on a system with lights, pushbuttons and switches? Isnt the beauty of manual rig having a manual valve on a pump discharge to adjust flow?

The VFD will serve several purposes:

The main reason is that the pump motor is a 3-phase motor. The VFD accepts a single phase input (220V) and outputs 3-phase 220V to the motor.

I have an electric RIMS system with manual valves. I figure that I can fine tune the mash temperature by adjusting the speed of the recirculation pump along with the temperature controller for the heating element along with adjusting the manual valves.

I can also adjust the speed of the pump when cooling through the tube chiller and when performing a CIP.

Your correct in that I can throttle the manual valves to accomplish the same thing but since I acquired a free VFD I figure why not use it to adjust the speed as well.
 
(I went with Auber ones, but they are a piece of shat company to deal with, and i hope they go out of business, pieces of trash). Worst experience ever. Spend your money elsewhere. Miserable. Miserable. Miserable. But back to the point...

Just don't buy Auber. They suck.

100% agree. One of my PID'S was never delivered I verified with USPS that they never delivered it. I called Auberins and this was the response "You need to investigate your neighbors to see who stole you package." Yes, that is in quotes. Then they tried to sell me another one for full price and extra shipping for signature delivery only. Even after they verified with USPS that the first one I ordered was never delivered. Good thing I went though PayPal and got my money back.

Avoid Auberins like the black plague.
 
100% agree. One of my PID'S was never delivered I verified with USPS that they never delivered it. I called Auberins and this was the response "You need to investigate your neighbors to see who stole you package." Yes, that is in quotes. Then they tried to sell me another one for full price and extra shipping for signature delivery only. Even after they verified with USPS that the first one I ordered was never delivered. Good thing I went though PayPal and got my money back.

Avoid Auberins like the black plague.

Not as bad as my experience, but just another example of their shady business practices!
 
One of my PID'S was never delivered I verified with USPS that they never delivered it. I called Auberins and this was the response "You need to investigate your neighbors to see who stole you package."

Seems to me that if USPS admits that they had it but never delivered it that Auberins is blameless and that the PO is the party that is responsible for its loss.
 
Seems to me that if USPS admits that they had it but never delivered it that Auberins is blameless and that the PO is the party that is responsible for its loss.

Well I tried to keep the story short. Auberins created a tracking number and label for it, when I never received my item I called the USPS and gave them the tracking number and verified my information. The USPS said the tracking number was for a different address then the one verified on my order from Auberins, and the status on the tracking number was in transit. The USPS would not give me the address that was printed on the label from Auberins for security/privacy reasons. I then contacted Auberins and they "verified" that both the address and tracking information was correct. Which is a 100% lie, because the USPS said the address on it was not mine. So the label was printed incorrectly, never changed from in transit status, never got delivered, Auberins refused to take responsibility, and blamed my neighbors for stealing it.

Mind you, in order to get my money back from PayPal, I had to get proof of all this. Which I still have.
 
Well I tried to keep the story short. Auberins created a tracking number and label for it, when I never received my item I called the USPS and gave them the tracking number and verified my information. The USPS said the tracking number was for a different address then the one verified on my order from Auberins, and the status on the tracking number was in transit. The USPS would not give me the address that was printed on the label from Auberins for security/privacy reasons. I then contacted Auberins and they "verified" that both the address and tracking information was correct. Which is a 100% lie, because the USPS said the address on it was not mine. So the label was printed incorrectly, never changed from in transit status, never got delivered, Auberins refused to take responsibility, and blamed my neighbors for stealing it.

Mind you, in order to get my money back from PayPal, I had to get proof of all this. Which I still have.

You'd think for a crap little PID controller they probably pay $8 for they would just bite the bullet and keep their customers happy. But they are a greedy company that treats their customers like thieves. It's so unfortunate the home brew community has made them a defacto supplier of electric brewery controls because they are really an awful company.

I really can't understate how bad of an experience i had with them. They really screwed up something bad and when i brought it to their attention they acted like i insulted them and said they would no longer communicate with me because they didn't feel i wasn't grateful enough for what they did (it was an enclosure with a few custom hole punches - almost all the locations were off and some were the wrong size). No joke - they wouldn't respond to me via e-mail and HUNG UP ON ME WHEN I CALLED THEM. I had to charge back nearly an $800 order to them in order to get them to even respond to me to resolve the issue. In the end it wasn't the resolution i wanted but i had so much time invested it wasn't practical to go another direction.

Auber is a BAD company. I hope others see this as a warning and take their business elsewhere.
 
The VFD will serve several purposes:



The main reason is that the pump motor is a 3-phase motor. The VFD accepts a single phase input (220V) and outputs 3-phase 220V to the motor.



I have an electric RIMS system with manual valves. I figure that I can fine tune the mash temperature by adjusting the speed of the recirculation pump along with the temperature controller for the heating element along with adjusting the manual valves.



I can also adjust the speed of the pump when cooling through the tube chiller and when performing a CIP.



Your correct in that I can throttle the manual valves to accomplish the same thing but since I acquired a free VFD I figure why not use it to adjust the speed as well.


Free, ok I would too. There is always an "oh ****, turn it down" factor to vfd pumps from my experience. Its a love/hate relationship we have...
 
Back
Top