Sign in to follow this  
Followers 0
Shiner

PID

7 posts in this topic

I have read over posts on PID and without practice the deciphering all that information is getting to me. I have a process where I am trying to do two things. First, on initial start up, I want to monitor the output of a device using a sensor. The input of this is very unsteady so I need to do smoothing. I need some advice on how to set this up. The output will increase with temperature until max output is reached. At this point any increase in temperature will begin to decrease the output. I want to record this peak and use it as my setpoint. I would like to do this "on the fly" because the output will also diminish with the age of the equipment (at some point necessitating change which will again change the peak point). So each time the machine is started the max is recorded, and used as my target run temperature with a second sensor for temperature. Second, based on the setpoint, I want to ramp up or down cooling fans to hold the output devices at their optimum temperature that we determined above. The processor is a 1769-L23E-QBFC1. I have 4-20mA going to the drives, 4-20 in from the temp sensor, and 0-10 in from my emitter sensor.

Share this post


Link to post
Share on other sites
Not a lot of information to go on but here goes. You're working with a Compactlogix which IIRC means RSlogix 5000 and plain english tag names. The first Tags I would suggest are a Quartet of Booleans named as follows {ModeOff, ModeStartup, ModeRun, ModeCoolToOff } Have tour Main Routine call a routine named ModeSwitch which moves you from mode to mode based on conditions. Write a routine for each mode which controls your outputs and monitors your inputs. Program Flow would block out like this. In ModeOff Opertor Pushes StartPB, after checking safeties and interlocks the Mode is changed to ModeStartup. In Mode Startup the System is started with Fans at a fixed moderate speed and the Temp Input is monitored for the max Point which is recorded and the after max dip. Once these are seen the Mode is Switched to ModeRun. In ModeRun the temp max which ws recorded is used to drive the PID which speeds up or slows down the fans to hold temp. If the Stop button is pushed a controlled cool down shut down is run and then mode switched to Mode OFF.

Share this post


Link to post
Share on other sites
That sounds about what I was thinking except for creating seperate routines. The main thing right now is, not having alot of PID experience with contrologix, how to set up the smoothing of the incoming signals. They aare very dirty, even though the cabling is shielded in conduit, I see the count jump quite a bit. My cvoncern is it could jump to a high point and set that as the target, and forever chase a point that was nothing more than a spike.

Share this post


Link to post
Share on other sites
I would do a simple low pass or averaging filter on the input to the PLC. It will really smooth out the results but still be very accurate and fast as the scans are usually very fast and you can adjust the window size to be whatever you need. I had a terrible input from a weight transmitter that was fixed this way. Edited by WeakSauce

Share this post


Link to post
Share on other sites
Hi Weaksauce, Can you expand/explain on both of those fixes (low pass and average filter). I would be interested in using in some of my programs Conor

Share this post


Link to post
Share on other sites
Filtering.txt Edited by Mickey

Share this post


Link to post
Share on other sites
an averaging filter is just an average of the last x samples where x is some number back. a low pass filter is just another name for the broader style of filters. Low pass means that only low frequency events get through. An averaging filter will weather a few high noise values by considering the values that it was at and taking a "vote" from all of them. That is a very simple way to do it but it's actually not going to work as written(I actually did that approach first but my incoming data was too noisy for this approach to work well). The proper formula for a two sample weighted average is going to be(using your nomenclature plus UV is updated value that becomes FV in the next time step) UV = (1-c)*FV + c*NV. You could do this for n values of history and weight them all different or some less and others more if you wanted to do a weighted average. but all the coefficients must add up to 1 or you will have a tough time getting an actual correct answer out of the system. If you want to learn more about that you can find it in all it's nitty gritty in a linear signals and systems book or a digital signal processing book. Edit: the concept here is IIR filters where the output is dependent on the recent output of the system as well as the input signal history. These tend to be less stable than a FIR filter which is one that depends only on the input signal because errors in the precision of multiplication on a PLC/computer will cause large errors in the output over time. A simple averaging filter is one that does not exhibit this behavior because there is only "clean" signals coming in and they don't recursively multiply themselves and cause output errors to accumulate. The approach that worked well for me was just a basic average function with around 100 samples. basically take an array of input values of length N and add them all up together and then divide by N to get the average value of the window of N. You slide the window as you go and things are all good it just removes the gaussian(or bell curve or normal curve) noise from the system. If the signal is actually changing very fast you should choose the number of samples to be smaller. Play around with the number of samples and you will see the difference in response time for fast changes in the value of the instrument. You are using compact logix so rslogix 5000 programming. There is an average that you can use right out of the box. you just give it an array and tell it how many samples to use. (it might even do weighted averages too if you are able to pass in a coefficient array as well but I don't know.) Good luck. Hope this helps! Edited by WeakSauce

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0