Jump to content
lvb

Closed Loop Control without PID Toolkit?

Recommended Posts

I was wondering if anyone here could share some advice about closed loop control with or without the NI PID Toolkit in LabVIEW.

I have an analog output replacing a potentiometer on a current control module. Previously the current draw potentiometer was set on the current control module to a value between 0-100 (reading on front of pot).

If the operator set the value to "50"... as temperature and other factors changed, the machine would drift and the current draw setting on the pot (0-100 range) would no longer be valid.

I would like to control an analog output (0-10V) to maintain a constant current draw in the system. The feedback is from an analog input via a torque sensor. The frequency of the control is on a cycle basis (once a minute). Any advice?

Thanks!

Share this post


Link to post
Share on other sites

Is there a reason you don't want to use the PID toolkit? You caould always code up a PID model yourself, but it'd take you more thime that the toolkit's worth...

Share this post


Link to post
Share on other sites
Is there a reason you don't want to use the PID toolkit? You caould always code up a PID model yourself, but it'd take you more thime that the toolkit's worth...

Management...

Share this post


Link to post
Share on other sites
Management...

*shudder* A job I worked at a few years ago had 6 or 7 engineering staff write a test execution engine a lot like TestStand, but with *far* less functionality (c'mon - who can say they've never been tempted?) Sure, I learned a lot from the experience, but management's justification was that they'd already got the $ to employ us and could justify the $ to buy TestStand. Talk about short short sighted: it took us about 9 - 10 months, and the final product, although functional, was never really used: the office I was in closed and they laid all of us off :) I certainly hope that isn't the way your company is going ;)

That said, I think your best bet is to write it yourself. If you remember your high school math (integration and differentiation) it shouldn't be toooo hard. There a good explination here.

Has anyone else here already done it and has an example to share?

Share this post


Link to post
Share on other sites
Has anyone else here already done it and has an example to share?

NI has already done it and has an example to share, even for those who don't have the PID toolkit:

C:\Program Files\National Instruments\LabVIEW 7.1\examples\daq\solution\control.llb\simple PID.vi (also available in LabVIEW 8.0)

Or you can find this in the Example Finder under Hardware Input and Output -> Traditional DAQ -> Solutions -> PID and Alarm Controllers -> Simple PID Demo

It's not as elegant as the one in the PID toolkit but does the same thing.

Share this post


Link to post
Share on other sites
NI has already done it and has an example to share, even for those who don't have the PID toolkit...

Nice find ned!

Share this post


Link to post
Share on other sites

Hey guys!

I have a project on LABVIEW. I'm using LABVIEW v8.2.

My project is based on temperature control of a mulitvariable thermal system using PID. I just know the basic of basics in LABVIEW. I have searched online for help, but couldn't find much help. Do you guys know any site where it shows teaches how to create a PID control from scratch, or can any of you guys help me out?

Any help would be appreciated.

Share this post


Link to post
Share on other sites

Hey Karissap! Thanks for the link!

I know the basics of PID. but I don't know how to implement it onto LABVIEW. I don't have the PID Control Tool Kit... is it possible to do the program without the toolkit?

Share this post


Link to post
Share on other sites

QUOTE (ned @ Aug 21 2006, 07:28 PM)

NI has already done it and has an example to share, even for those who don't have the PID toolkit:

C:\Program Files\National Instruments\LabVIEW 7.1\examples\daq\solution\control.llb\simple PID.vi (also available in LabVIEW 8.0)

Or you can find this in the Example Finder under Hardware Input and Output -> Traditional DAQ -> Solutions -> PID and Alarm Controllers -> Simple PID Demo

It's not as elegant as the one in the PID toolkit but does the same thing.

I don't find it in LABVIEW 8.2. Any suggestions?

Share this post


Link to post
Share on other sites

QUOTE (blitzkrieg @ Nov 7 2008, 03:25 AM)

I don't find it in LABVIEW 8.2. Any suggestions?

Open the Example Finder and search for PID; there are several DAQmx PID examples that don't require the PID toolkit.

Share this post


Link to post
Share on other sites

I tried all that, I have searced for PID, it showd 36 results all of which require the PID Control ToolKit. So if anyone has the PID example of LABVIEW 8.2 which does not require the PID Control Toolkit, can you post it up? it would be appreciatied!

Share this post


Link to post
Share on other sites

QUOTE (blitzkrieg @ Nov 8 2008, 02:57 AM)

I tried all that, I have searced for PID, it showd 36 results all of which require the PID Control ToolKit. So if anyone has the PID example of LABVIEW 8.2 which does not require the PID Control Toolkit, can you post it up? it would be appreciatied!

It's not difficult to write one yourself - think of it as a functional global.

Share this post


Link to post
Share on other sites

QUOTE (crelf @ Nov 8 2008, 08:48 AM)

It's not difficult to write one yourself - think of it as a functional global.

I tried it myself, but im getting stuck... if anyone has the Simple PID example on their LABVIEW 8.2, can you please post it up?

Share this post


Link to post
Share on other sites

QUOTE (blitzkrieg @ Nov 9 2008, 03:22 AM)

I tried it myself, but im getting stuck...

Show us what you've done - upload your code, and we'll try to help.

Share this post


Link to post
Share on other sites

QUOTE (ned @ Nov 7 2008, 10:18 AM)

Open the Example Finder and search for PID; there are several DAQmx PID examples that don't require the PID toolkit.

Oops, my apologies. While there are several DAQmx examples with "PID" in the name that show up in a search, it turns out that none of them actually contain a PID implementation, they all only implement proportional control.

Share this post


Link to post
Share on other sites

QUOTE (ned @ Nov 9 2008, 11:02 AM)

...it turns out that none of them actually contain a PID implementation, they all only implement proportional control.

True, but often P is all you need. :)

Share this post


Link to post
Share on other sites

QUOTE (crelf @ Nov 9 2008, 05:35 PM)

True, but often P is all you need. :)

This is quite dependant on the system. i found that for most, actually I is all you need. P is for first estimation and D serve as first order correction.

I never used the PID toolkit, and always developed mines alone. here is an overall simple approach you could try:

X= value wanted

X1= value wanted - actual value

X2= previous X1

correction parameter = AX+BX1 +C(X1-X2)

A,B and C are the weight you are going to put on each of the element, in order to reach target value.

I propose you activate them in steps, by first approaching solution with A, then correct for constant offset with B. you might have to tune down A quite a bit doing so. finally, minimise fluctuations with C. You will want to keep C at a minimum level.

implementing in LV is elementary.

enjoy!

Share this post


Link to post
Share on other sites

Basically, I'm in my last year of instrumentation engineering and we have to do a project. The topic assigned was a computer oriented project, in which I have to demonstrate any experiment on a computer software. The only software I was thought, and too only there bare basics, was LABVIEW. I was given 1 week to submit my projet

outline, and I had to search online for an experiment. I eventually got one ( thanks to Alberto Leva) which is based on a multivariable thermal system.

I know how the system works very well, the problem I'm facing is how to implement it in LABVIEW. The block diagram is very challenging, and requires years of experience to get it done properly.

Since I know the basics, and the fact that I need to submit the simulation soon, I request any of this forum members to help me build on this project. Any help will be appreciated be it big or small.

I have uploaded the overview of the experiment ( diagrams, equations, how the front panel should look finally ) and the LABVIEW VI (what I have completed so far).

Im using LABVIEW 8.2.

Details of the experiment

LABVIEW 8.2 VI so far

Share this post


Link to post
Share on other sites

QUOTE (Gabi1 @ Nov 9 2008, 01:35 PM)

i found that for most, actually I is all you need.

I don't think I've ever used I without P.

Share this post


Link to post
Share on other sites

It's been awhile since I finished my Analogue and Digital Control subject but I think i did heard about the I controller.

However I havent got a chance to do that at Uni/ work. I mainly use P, PI or PD. P is ofcourse the one that you starting with

and most of the case you will received responses from the system and have a better understanding of the system before using

any of the other actions like I or D depends on on desired criteria/ specs. I reckon PI are most used, since derivative action is very sensitive to measurement noise, and the absence of an integral value may prevent the system from reaching its target value due to the control action. (from wiki).

As Clelf said, it is not too hard to implement it in LV, just abit of work, and i think that would be fun to do as well as it is a part of ur project.

follow this pseudocode:previous_error = 0integral = 0 start: error = setpoint - actual_position integral = integral + error*dt derivative = (error - previous_error)/dt output = Kp*error + Ki*integral + Kd*derivative previous_error = error wait(dt)goto startGood luck mate

Share this post


Link to post
Share on other sites

QUOTE (blitzkrieg @ Nov 7 2008, 11:57 PM)

I tried all that, I have searced for PID, it showd 36 results all of which require the PID Control ToolKit. So if anyone has the PID example of LABVIEW 8.2 which does not require the PID Control Toolkit, can you post it up? it would be appreciatied!

Here is a VI you can try. I found it in our "sandbox" and cleaned up (quite a bit believe it or not :) ). The sandbox is what we call the directory where potentially useful yet not yet used code gets stuck and forgotten. I haven't tested it to see if it works, but it looks promising.

Saved for LV 8.0

WinAPI.zip

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.