lvb Posted August 21, 2006 Report Share Posted August 21, 2006 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! Quote Link to comment
crelf Posted August 21, 2006 Report Share Posted August 21, 2006 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... Quote Link to comment
lvb Posted August 21, 2006 Author Report Share Posted August 21, 2006 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... Quote Link to comment
crelf Posted August 21, 2006 Report Share Posted August 21, 2006 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? Quote Link to comment
ned Posted August 21, 2006 Report Share Posted August 21, 2006 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. Quote Link to comment
crelf Posted August 21, 2006 Report Share Posted August 21, 2006 NI has already done it and has an example to share, even for those who don't have the PID toolkit... Nice find ned! Quote Link to comment
blitzkrieg Posted November 6, 2008 Report Share Posted November 6, 2008 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. Quote Link to comment
Karissap Posted November 6, 2008 Report Share Posted November 6, 2008 There is a NI Developer Zone site which may help: PID Theory Explained Do you have the LabVIEW PID Control toolset? Quote Link to comment
blitzkrieg Posted November 7, 2008 Report Share Posted November 7, 2008 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? Quote Link to comment
Phillip Brooks Posted November 7, 2008 Report Share Posted November 7, 2008 I Googled 'labview PID example' and the first entry I got was for this LAVA post. http://forums.lavag.org/Closed-Loop-Contro...lkit-t3797.html Quote Link to comment
blitzkrieg Posted November 8, 2008 Report Share Posted November 8, 2008 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? Quote Link to comment
ned Posted November 8, 2008 Report Share Posted November 8, 2008 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. Quote Link to comment
blitzkrieg Posted November 9, 2008 Report Share Posted November 9, 2008 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! Quote Link to comment
crelf Posted November 9, 2008 Report Share Posted November 9, 2008 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. Quote Link to comment
blitzkrieg Posted November 10, 2008 Report Share Posted November 10, 2008 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? Quote Link to comment
crelf Posted November 10, 2008 Report Share Posted November 10, 2008 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. Quote Link to comment
ned Posted November 10, 2008 Report Share Posted November 10, 2008 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. Quote Link to comment
crelf Posted November 10, 2008 Report Share Posted November 10, 2008 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. Quote Link to comment
Gabi1 Posted November 10, 2008 Report Share Posted November 10, 2008 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! Quote Link to comment
blitzkrieg Posted November 10, 2008 Report Share Posted November 10, 2008 Mods can close/delete this thread. New thread opened with better details. Thanks Mod (crelf) note: Topics merged. Quote Link to comment
blitzkrieg Posted November 10, 2008 Report Share Posted November 10, 2008 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 Quote Link to comment
crelf Posted November 11, 2008 Report Share Posted November 11, 2008 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. Quote Link to comment
Minh Pham Posted November 11, 2008 Report Share Posted November 11, 2008 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 Quote Link to comment
TobyD Posted November 11, 2008 Report Share Posted November 11, 2008 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 Quote Link to comment
blitzkrieg Posted November 12, 2008 Report Share Posted November 12, 2008 Hey Minh, thanks for the code! and Toby D, I can't run the program ! Is that because of different version issues? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.