Jump to content


Photo
- - - - -

PID


  • Please log in to reply
6 replies to this topic

#1 Shiner

Shiner

    Sparky

  • MrPLC Member
  • PipPipPip
  • 286 posts
  • Gender:Male
  • Location:Houston
  • Country:United States
    United States

Posted 21 July 2011 - 01:22 PM

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.

#2 BobLfoot

BobLfoot

    The Wizard

  • MrPLC Admin
  • 3159 posts
  • Gender:Male
  • Location:Southern Indiana
  • Country:United States
    United States

Posted 22 July 2011 - 12:46 AM

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.

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.
BobLfoot

"Poor Planning on your part does not a crisis on my part make"

#3 Shiner

Shiner

    Sparky

  • MrPLC Member
  • PipPipPip
  • 286 posts
  • Gender:Male
  • Location:Houston
  • Country:United States
    United States

Posted 22 July 2011 - 06:19 AM


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.

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.



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.

#4 WeakSauce

WeakSauce

    Hi, I am New!

  • MrPLC Member
  • Pip
  • 3 posts
  • Gender:Male
  • Country:United States
    United States

Posted 16 September 2011 - 01:35 PM

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, 16 September 2011 - 01:36 PM.


#5 Conor

Conor

    Sparkologist

  • MrPLC Member
  • PipPipPip
  • 342 posts
  • Gender:Male
  • Location:Dublin
  • Country:Ireland
    Ireland

Posted 16 September 2011 - 01:42 PM

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.

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

#6 Mickey

Mickey

    Propeller Head

  • MrPLC Member
  • PipPipPipPipPipPip
  • 1512 posts
  • Country:United States
    United States

Posted 16 September 2011 - 02:17 PM


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.

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



Here's one way to do it.


FV=FV+C(NV-FV)
Where:
FV= Filtered value
C= constant (range 0-1) The smaller the number the more dampening.
NV= New Value



Attached Files


Edited by Mickey, 16 September 2011 - 02:18 PM.


#7 WeakSauce

WeakSauce

    Hi, I am New!

  • MrPLC Member
  • Pip
  • 3 posts
  • Gender:Male
  • Country:United States
    United States

Posted 16 September 2011 - 07:52 PM



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.

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



Here's one way to do it.


FV=FV+C(NV-FV)
Where:
FV= Filtered value
C= constant (range 0-1) The smaller the number the more dampening.
NV= New Value


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, 16 September 2011 - 08:08 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users