Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted

06-22-2011 06:05 PM - edited 06-22-2011 06:08 PM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

What happened to your PID control in your most recent post?

Highlighted
Options

06-22-2011 06:15 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@VeeJay wrote:

Attached is with indicators and controls. This is exactly what I want, but I am sure with the dynamics of my system, I would need to incorporate PID instead of just Relative error calculation. But, this is a start. Please review and thanks a bunch. The square wave thing is pretty cool. 🙂

If it's doing exactly what you want, then it sounds like you're pretty much there. You can clean it up a bit - I cringe when I see booleans wired into Select blocks, because there's almost always a simpler way to do it with boolean operations - and running the block diagram cleanup function will help too. Calculating the error as a percentage is kind of useless for control purposes because you get a divide-by-zero error when the setpoint is zero - is there some reason you need to calculate error that way? Just do a simple subtraction and then multiply by some gain.

Highlighted
Options

06-23-2011 09:43 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@ Kyle, I still am having trouble understanding the PID function and what exactly is the "output" that is labelled in the funtion. Is it error, percentage error, correction value etc... That's why for now, I removed it.

@ NAthan

I know that for setpoint 0, there will be divide by zero error. BUt, I wanted to get the square wave function working on the Digital Output lines. Like I said, I still don't understand how a simple subtraction and multiplication by gain will correct for the error. For eg. If setpoint is 1Volt and PV is 2Volt, Error=PV-SP=1Volt. For gain of 0.5, I get proportional gain 0.5*1=0.5Volt. So will this be the error after the control action if I were to understand it in a simpler way? I have not found any place that explains the action of a PID and how it controls, except for the statement that it corrects for the error. I guess I am looking for Math expressions and values rather than theory.

Thanks!

V

I may not be perfect, but I'm all I got!

Highlighted
Options

06-23-2011 11:59 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@VeeJay wrote:

I know that for setpoint 0, there will be divide by zero error. BUt, I wanted to get the square wave function working on the Digital Output lines. Like I said, I still don't understand how a simple subtraction and multiplication by gain will correct for the error. For eg. If setpoint is 1Volt and PV is 2Volt, Error=PV-SP=1Volt. For gain of 0.5, I get proportional gain 0.5*1=0.5Volt. So will this be the error after the control action if I were to understand it in a simpler way? I have not found any place that explains the action of a PID and how it controls, except for the statement that it corrects for the error. I guess I am looking for Math expressions and values rather than theory.

The manual that comes with the PID Toolkit is a good place to start (in the directory where LabVIEW is installed, look in the manuals folder for PID_User_Manual.pdf).

"For eg. If setpoint is 1Volt and PV is 2Volt, Error=PV-SP=1Volt. For gain of 0.5, I get proportional gain 0.5*1=0.5Volt. So will this be the error after the control action if I were to understand it in a simpler way?"

No, not at all. You misunderstand some terms, and your question really doesn't make sense. The error after the control action will depend on the system response to that control action. The output will be 0.5, not the proportional gain. The units of the output are not necessarily volts, even though the input is.

You might think of the proportional gain as a scaling factor to convert input units to output units. In your system, the input is an analog signal (maybe it's 0-10V) and the output will be % duty cycle. You might have a proportional gain of 20 (Duty Cycle %/V), such that a 1V error gives you 20% duty cycle and anything over a 5V error results in 100% duty cycle (in this case you need to limit the output to avoid going over 100%). Now let's say that instead of controlling duty cycle you are controlling an analog output with a range of 4-20mA (a common range). Then you would need a much smaller gain, perhaps 3 (mA/V). In your scheme you are making the gain non-linear while eliminating the flexibility to tune the Proportional controller for your system and the range of input and output.

Highlighted
Options

06-23-2011 02:41 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@Nathan, Thank you for that excellent explanation! That totally makes sense now. I get the Proportional gain part now. It is just the "AHA" moment I was looking for to make intuitive sense to me. Now, obviously, proportional control works best if system is linear. Since, my system is not so, I would need to include the Intergral action too and maybe Derivative as well. Would you mind adding on the explanation, part about integral control and how that would act on the actuator? THanks a bunch!

I may not be perfect, but I'm all I got!

Highlighted
Options

06-23-2011 03:23 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

With reference to this post about the square waveform, You will never see a change in the output means on the Front panel wavechart or even if I hook up an oscilloscope to that Digital output channel? I may have already answered this question, but I just want a confirmation. Thanks!

I may not be perfect, but I'm all I got!

Highlighted
Options

06-23-2011 05:17 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@VeeJay wrote:

@Nathan, Thank you for that excellent explanation! That totally makes sense now. I get the Proportional gain part now. It is just the "AHA" moment I was looking for to make intuitive sense to me. Now, obviously, proportional control works best if system is linear. Since, my system is not so, I would need to include the Intergral action too and maybe Derivative as well. Would you mind adding on the explanation, part about integral control and how that would act on the actuator? THanks a bunch!

Proportional control alone is sometimes sufficient for systems that have long lag time between the control action and the control response. For most systems, proportional control leads to a constant offset. As the process variable approaches the setpoint, the control action gets smaller and smaller, such that it is never quite enough to reach the setpoint. The other possibility is having too much proportional gain, which will cause the system to oscillate as it overshoots, then undershoots, etc the setpoint.

Integral control eliminates the offset by integrating (summing) the error and multiplying that by the integral gain, then adding that to the control output. When the system reaches the setpoint, the instantenous error is zero and the integrated value stops changing, but there may be residual integrated error so the output from the integral control is non-zero. This residual action allows the controller to eliminate the offset and is unlike proportional control, where zero error means zero output.

Derivative action is mostly useful as a way to speed the response from slow systems with little noise. Derivative control acts on the derivative of error. If the error is decreasing rapidly (large negative derivative) the derivative control will act to decrease the output (by adding in a large negative number). Conversely if the error is changing slowly, or not at all, there will be little derivative action. This allows the use of larger values for proportional and integral gain, with the derivative control counteracting those actions if the system responds quickly. However, in a noisy system, the derivative of the error will change frequently due to the noise, leading to poor control.

This is only a rough overview covering the basics, and it is well worth the time to set up a system to experiment with PID tuning parameters, and to do some reading about different tuning techniques.

@VeeJay wrote:

With reference to this post about the square waveform, You will never see a change in the output means on the Front panel wavechart or even if I hook up an oscilloscope to that Digital output channel? I may have already answered this question, but I just want a confirmation. Thanks!

I am confident that you can answer this question yourself (and that if you can't right now, the process of finding the answer will be quick and worth your time).

Highlighted
Options

06-24-2011 07:24 AM - edited 06-24-2011 07:25 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi Nathan,

I am under time constraints and don't have an oscilloscope with me. My answer is that what we see on the Front panel chart is what it will be when an oscilloscope when connected to a DO. I was under the impression that if we have a 10Hz square wave generated and loop time is 10Hz, Front panel would not display the square wave as intended but the output on the channel will be so. I was thinking about analog inputs i guess. The values are available, we just choose to read them based on our sample rate and samples to read.

I may not be perfect, but I'm all I got!

Highlighted
Options

06-24-2011 11:03 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

@VeeJay wrote:

Hi Nathan,

I am under time constraints and don't have an oscilloscope with me. My answer is that what we see on the Front panel chart is what it will be when an oscilloscope when connected to a DO.

That's exactly right.

Highlighted
Options

06-24-2011 11:06 AM - edited 06-24-2011 11:15 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi Nathan,

I am chugging along but there are still some issues I am facing with my setup. There is lot of dynamics involved and I will try to explain them here so you can have a complete understanding of my system. I am working on a solution to control elevation or incline. I use a distance sensor (one with transmitter and receiver on either ends of a moving tube; photoelectric sensor). When the device is horizontal, the Tx and Rx are close and signal is high so I read high voltage. When it inclines , distance increases and voltage decreases. I just have a RANGE of 3V total. My device only inclines from 0 deg to 13 degrees.

Mechanism to raise the device: THere is a motor coupled to a pump. When motor is turned ON, device raises.

Mechanism to lower the device: A valve, When valve is opened, water flows through, reducing the incline.

My SP is certain angle (which can be converted to Voltage through a calibration curve).

Process Variable (PV) is voltage. range about 3V

I am trying quick raise or lower when error is large and closer to SP or within a deadband, I stop. I would not prefer pulsing during raise because it is a 120VAC motor and it wouldn't respond well to like 200ms pulse ON. Lower however, I can pulse ON. valve pulses only when ON time is about 150ms or over.But, the output of PID starts from 0 (range -100 to 100) and because there is always going to be integral error, PID output adds up and my duty cycle increases as the device gets closer to target, but I need the opposite. Also, as the PID output keeps increasing, if my SP is lesser than PV, the direction of output changes but it takes time to get below 0 for me to take advantage of sign of PID output to choose a channel.

In summary, here is what I am trying to achieve. I do not want oscillations around target, hence I would use a deadband within which nothing should happen. So when raising, I expect an overshoot (because I wont pulse motor) and then open lower valve to get to target band.

When lowering from I want continuous lower until it reaches a threshold and then start PWN to get to deadband so that there is no undershoot which again turn ON the motor and the oscillations begin.

One serious problem I am facing is that when a load on the device is moving, the device behaves as a cantilever; so the PV I read will be changing because the sensor distance keeps changing. I am using a Mean point by point function here to reduce the bouncing value. Would this work? how do I know what time I am waiting until this average is calculated? But, I do not want constant correction. Somehow, I ahve to try and make the correction seemless which is hard.

Gosh! I am sorry, but I hope this makes sense. Thanks!

I may not be perfect, but I'm all I got!