PID control of Counters (PWM)

Hello everybody!!
I work on a closed loop PID controlled problem (Labview 8.5) and I have a couple of questions in order to make some progress!
Firstly, I have to declare that my loop is composed of 2 AI channels (2 accelerometers), 1 AO channel (excitation channel-shaker), and 2 CO (for pulse creation PWM-controllers). The idea is very simple. When the AI (channel 1) value surpass or underpass a predetermined threshold value, then the appropriate CO should be activated in order to apply the necessary control forces and simultaneously to copy my data values of both AI channels in binary style for CPU velocity reasons! BUT, with the PID controller I want to optimize the Duty Cycle value of the pulses!
My questions are :
1) Why when I put Kp=Ti=Td=0 ( = run WITHOUT control) I can copy ALL the AI samples and when I start to activate the PID controller (let’s say for only Kp=0.5) I CAN’T copy ALL the AI samples? Where is my fault?
2) About the PID vi which I use, is it correct or I should use the PID vi for ARRAYS?
3) And finally, about the Boolean statement just before the Case Structures and the Shift Register, is it ok/necessary?
I attach two vis, the ReadBinar .vi is used to read my binary files generated in the end of running of the Control.vi.
Best regards
Grigorio
Attachments:
Control.vi ‏277 KB
ReadBinar.vi ‏162 KB

Hello Zach!
First of all, I want to thank you for your kind interest on my problem!!
I must describe you the desired process with the Control.vi. There are two AI channels writing down the acceleration of a structure in two different points (for velocity reasons I use Binary Type storage for my data). One AO channel for structure sinusoid excitation (shaker) and two CO channels for controlling two solenoid valves with which I want to control my structure acceleration (minimize it as well and fast as possible)!!
In order to help the description, let’s ‘cut’ the block diagram of Control.vi into three pieces (Before While Loop – Inside While Loop – After While Loop).
In Before While Loop section, the main question is about simultaneousness. The DAQmx Start inside the Flat Sequence Structure, do you think that is necessary, ok? I want to run my experiment for 30s and to collect 6000 samples with 200 samples/s. In addition, in the CO DAQmx timing, I have set 200 samples/channel in order to be able to change the duty cycle value because of the conditions inside the While Loop. Do you think that everything in this section works well? 
Inside the While Loop, firstly in the DAQmx Read, I have set 200 samples per Input Channel, which is also equal to the AI and AO Sampling rate! Before some days I have put there -1 and unfortunately the total written samples were less than 6000!! My main problem is how I can check all the read data without losing run velocity and simultaneous if one sample is >0 then it goes further to the first PID.vi (left solenoid valve) or if that sample is <0 then it goes further to the second PID.vi (right solenoid valve)!! When a sample has gone to a PID.vi, then I want to tune the duty cycle of the controller (PWM control) as well as possible in order to achieve the Setpoint value for the second AI channel. Are all these possible? If not, what do you suggest me?
In addition I compare the present duty cycle value with the previous one in order to be inside a tolerance value (let’s say 0.1). Moreover, is it correct the Case Structures where I want to share the positive and negative AI samples before going to the respective PID ?
Finally, After the While Loop, I believe that everything is OK. I just finish all the tasks.
I have to mention that I work on a PCI-6289 and Labview 8.5.
With best regards!
 Grigorio
Attachments:
Control.vi ‏288 KB
equal within tolerance.vi ‏9 KB
ReadBinar.vi ‏163 KB

Similar Messages

  • Level Control with PID Control & Pulse-Width Modulation

    Hi all,
          I have attached my program which I'm having trouble wiring up in the block diagram.... I'm fairly new to labview, but basically I have a level control project with an analog input cistern arm turning a pot for my test tank (configured as DAQ assistant voltage analog i/p) and a pump working off a reservoir (configured as DAQ assistant voltage digital o/p). My electrical side of things is working correctly and I have tested both DAQ assistants I/O's successfully off a basic program, minus the PID & PWM... I found a simple PID control subvi which I think I have wired up correctly, apart from the output variable... I also found a bit of code for PWM using the square waveform vi (far right side of the program) which I have tried to include in the program, but I've been unsuccessful with that. The ideal operation i'm looking for with this project is to be able to enter different values for the setpoint, for the PID to kick in to find that setpoint each time using the PWM to drive the pump, which has a flow rate of 13L/min. I have a manual valve to release water from my test tank which I can set accordingly.
    My questions are;
    - How do I connect the 'output variable' of the PID subvi to my DAQ assistant digital output(both DAQ assistants are set at 1 sample on demand)?
    I have a 'number to boolean array' function, but this gives an error saying that the number of tasks generated are not the same...
    - How do I wire up the PWM bit of code? Do I need to include the 'error in & out' tabs?
    -Am I on the right track with this program or am I way off the mark?!
    Any feedback on this would be greatly appreciated. Thanks for your time,
    Richie
    Attachments:
    PID-RichLevelControl.vi ‏91 KB

    Rich-MechatronicsStudent wrote:My questions are;
    - How do I connect the 'output variable' of the PID subvi to my DAQ assistant digital output(both DAQ assistants are set at 1 sample on demand)?
    I have a 'number to boolean array' function, but this gives an error saying that the number of tasks generated are not the same...
    - How do I wire up the PWM bit of code? Do I need to include the 'error in & out' tabs?
    -Am I on the right track with this program or am I way off the mark?!
    You're a bit off track.  You need the output of the PID to go into the PWM generator, and the output of the PWM to be written to the digital output.  Right now you have the output of the PID connected directly to the Digital Output in a way that won't work, and the PWM generator hanging off the side not really connected to anything.  Also, the PWM generator isn't really going to work since you're generating it at the same frequency as your PID loop runs.  Try a simpler algorithm such as on/off control first and see if that works for your system.

  • Throttle body PID control using pulse width modulation

    Hello all,
    I am trying to do a PID control for a throttle body (using pulse width modulation) for a set value of feedback voltage. The process variable is the pulse width duty cycle. The throttle body is expected to be fully open at a feedback voltage of 5V and pulse width duty cycle of 42.5%.  When I use the highlight execution using the attached file, I can see the throttle body fully open (the values observed are: PID output 42.5 %, feedback voltage approximately 4.7V). However, when the highlight execution is unclicked, the throttle body flutters in the closed condition (still PID output 42.5%, feedback voltage approximately 0.9 V). Can any one please help by suggesting any modification to this attached file to make this throttle body respond to the set value of feedback voltage.
    Many thanks 
    Ajith
    Attachments:
    Throttle body control using PWM technique - PID.vi ‏525 KB

    How did you determine your P, I, and D gains? If you have not tuned your controller, you'll get poor performance. Running with execution highlighting will slow down the execution, which will change the effect of the gains. I would start with pure proportional control (I and D = 0) with a small proportional gain, and see if it responds in approximately the way you want. If so, then your code is probably correct, and you just need to do a full tuning to get good performance. There are many resources available on the web, on this forum and elsewhere, for PID tuning. Note that since your code uses a simple PID example, and not the one from the PID toolkit, the gains do not have the units that are used in many tutorials so you'll have to correct the calculations to compensate.

  • I am looking to control a 4-way hydraulic solenoid valve. Do I need a PID control toolset, or can i control the system through my 16E4 daq card and scxi chasis

    I am looking to control a 4-way hydraulic solenoid valve. Do I need a PID control toolset, or can i control the system through my 16E4 daq card and scxi chasis

    I think you're asking 2 different questions.
    The PID control toolset is for using PID loops for control; it's just software.
    The DAQ card and scxi chassis are hardware. If you have the appropriate signal conditioning cards in your chassis to control/monitor your solenoid valve, then you can run a PID loop.
    I believe the simple answer is: the PID control toolset is the best way to do control, but there are simple PID VI's (even on this website) that you can download and use for simple control.
    Mark

  • PID control in a windows CE Labview application

    Hi there,
    I want to build an application that will control the temperature in some ovens, using PID control. The application will be running in a controller (or a touch panel computer) with windows CE OS. I have Labview 8.6, PID control toolkit 8.6 and Touch panel module 8.6. The problem is that the PID vi's don't seem to work in touch panel module. 
    Is there any way to implement PID control in a windows CE Labview application?  
    Thanks in advance.
    Solved!
    Go to Solution.

    I think with a timed loop you can run reasonable good timing down to 1 mSecond. I think 1 mSecond is the lower limit for non realtime systems like Windows/windows CE. And if you have the PID toolkit this will supply you with the functions you need. You do not need an extra CE PID toolkit. This because  the touch panel module run under your standard Labview environment. But I do not know if all the functions in the PID tool like fuzzy logic are compatible with CE. Have you also considered Windows Embedded as OS for your module. With windows Embedded you can run standard Labview built exe files
    Both Windows Embedded, and XP Embedded can be trailed
    http://www.microsoft.com/windowsembedded/en-us/products/westandard/default.mspx
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • Steps to create vi file for PID control in 8.0 pro without specific PID addons.

    Per my other posts, I am testing a friend's software to see if this is what we would like to use.  I would prefer to use their software for our initial work to help offset the cost of the software.  Problem is their software is 8.0 pro without the extra PID stuff.  I am curious how one gets started creating a custom PID algorithm to be used in series between an input and an output.  I have viewed several tutorials but all seem to simply point at the PID toolkit that is not availalbe to me right now.  I realize it might be more work to create one but probably the only option at this point. 
    To simply the process, lets just compare a single input and output where the software will control the output to obtain to desired input.  in  tutorial, I was following right along until the PID loop was added and that seems to be just a drop and go type of deal in which would rarely apply to a real work application. I am simply trying to learn how PID systems are written into the block diagrams.  
    Hopefully my question makes sense.  

    asdfs wrote:
    Per my other posts, I am testing a friend's software to see if this is what we would like to use.  I would prefer to use their software for our initial work to help offset the cost of the software.  Problem is their software is 8.0 pro without the extra PID stuff.  I am curious how one gets started creating a custom PID algorithm to be used in series between an input and an output.  I have viewed several tutorials but all seem to simply point at the PID toolkit that is not availalbe to me right now.  I realize it might be more work to create one but probably the only option at this point. 
    To simply the process, lets just compare a single input and output where the software will control the output to obtain to desired input.  in  tutorial, I was following right along until the PID loop was added and that seems to be just a drop and go type of deal in which would rarely apply to a real work application. I am simply trying to learn how PID systems are written into the block diagrams.  
    Hopefully my question makes sense.  
    Take a look at the PID Control Toolkit User Manual . It clearly defines the math used and there is absolutely nothing stoping you from writing that code yourself.
    What you will not get by doing it yourself is the auto-tuning as well as all of the supporting and helper sub-VI along with the polymorphic versions that will support arrays of PIDs.
    If you write it yourself and it work good please post up your version for others to review or use.
    Have fun,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to apply notch filter in the PID control

    Dear all,
    I am using PID control in my positioning stage but the output is every noisy with some fixed frequencies(30,50,150Hz). I want to add a notch filter to take off those noise. However, I do not know how to apply the notch filter to the PID module. Could anyone tell me how and show me example if you have?
    Thanks
    best
    Attachments:
    PID_notch filter.png ‏21 KB
    PID_notch filter.png ‏21 KB

    Hi LYnn,
    I am sorry for my late reply. My stage is driven by a voice coil actuator (VCA). The VCA as a resolution of 1 um and range of 6 mm. The NF of the stage does shift when the load is changing. Do you have any advice for controlling such kind of stage?
    BTW, as far as I see, the control frequency is determined in the DAQ Assistant settings and its value is equal to "Sampling rate"/"Samples to read", am I right?
    Thanks
    best
    Attachments:
    VCA stage.png ‏160 KB

  • NI Robotic starter Kit DANI PID control

    Hello
    I have this great kit and interested to do a kind of research of PID control on the two DC motors.
    I already saw links that can do this job but I noticed that I can not find any technical datasheet having the motor paramters ( Mechanical or electrical)
    I plan to bulid a tranfser function usig these paramters and then design a PID controller to make a speed control.
    I searched the internet for the datasheet for these motors and could not find.
    I think I should use a system identification for these parameters...so the question is
    Is it possible to do any experimental system identification for identification of the DC motor parameters without deassebling them from the kit???
    and how to do this job using labview??
    if any has the datasheets for these motors (TETRIX DC Drive motor, part number 39083) it will be helpful  ...
    Thanks
    A.Hakim

    Hello ShishKeBobby
    Thanks for your reply, but realy these information I knew, I need more information like a datasheet for this DC motors concerning the electrical and mechanical parameters.
    I searched for the tetrix DC drive motor, part no. 39083 on pitisco web site but I could not download the datasheet.
    these are the information I need
    Motor constants (KT, KE)
    Motor internal resistance (Rm) and inductance (La)
    Motor friction (viscous friction)
    Interia (J)
    , thanks 
    or I am thinking to get these parameters by system identification but I dont know how without disasseblying of the dc motor from DANI and having a benifet from Labview and the assembled Morors in DANI.....
    what you think?
    Thanks for help
    A.Hakim

  • Looking for a reasonable looptime for my PID controler!!

    Good morning!
    I am trying to do a PID control of a combustionchamber.  The setpoint and process value are the output  temperature, the value to  operate  is  the massstream of  the fuel.  My  in- and output datas are refreshed every 50 ms.  My problem is...
    What is a reasonable looptime for my PID control? 
    Do you have any ideas???
    thanks RT

    My group has used the Sun Electronics PC-1000 Process Controller for some time, with good results. There are some instructions in the beginning of this Engineering Note (pdf link) that discribe how to iteratively determine the PID coefficients for a linear system. I'm not a mathematician, so I can't vouch for whole document, but their somewhat antiquated instruments DO work
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • How can I make and wire reffercence signals(ramp,sine,square) to excite and evaluate the behaviour of the system wih PID control?

    Dear all,
    I am Tri, I am a beginer with LV program. Actually I used LV for my reasearch, I had tried wiht very simple thing but the problem arise because I am not familiar with LA. Why I know that problem is simple because I compare with MatLab that I had somtime used before.
    I make a loop of PID control, It worked properly but I don't know how to make a refference signal to wire to the loop for excitating to evaluate the behaviour of the system. Please give me your help.
    Thanks

    Hi Tri,
          I've employed the "simple PID.vi" without a problem, but your example is more complex.  I think you use a Function generator to modulate DAQ inputs?
    Perhaps someone else will be able to infer your intention and identify a flaw in the logic.
    In case someone else wants to run your VI, it may help to build/attach an .llb (some sub-VIs are needed by the VI you atached.)
    To build the .llb, save your VI with Development Distribution options (Alt-F,Alt-W) and attach the .LLB
    1) \File\Save with Options
    2) select Development Distribution
    3) Save
    4) choose "New VI Library"
    But first, It would be helpful to us if you clean-up the code - straighten wire-paths, minimize bends in wires, and try to avoid "tall" diagrams.  Scrolling diagrams up and down is "bad form".  If scrolling is necessary, left&right is preferrable!
    Cheers.
    (and, for the record: in my previous post, Exitation would be wired to "Process Variable", Not "Set Point" (ouch!))
    When they give imbeciles handicap-parking, I won't have so far to walk!

  • Toolkit for feedback system? Motion; PID; Control/Simulation???

    Hi, I have to develop/program an organ bath system - a feedback system mimicking real sinusoidal breathing oscillations (shown in attached images). I have NI Labview 8.5, NI-Motion 7.6, a linear motor (M-235 DC-Mike actuator), an MID-7654 Servo Power Motor Drive and a pressure transducer. I believe I will need to control the PID controller and am aware of the PID Control Toolkit as well as the Control Design and Simulation Toolkit for NI Labview. However, is it possible to control the system using the NI-Motion software I have at the moment? If not, do I have to purchase both the PID and Control/Simulation Toolkit or just one? Thanks in advance...
    Attachments:
    feedback design1.JPG ‏25 KB
    feedback system1.JPG ‏42 KB

    Dear Garry,
    Do you have a motion controller to interface the MID-7654 to your
    computer and LabVIEW? This would be the PCI-734x or PCI-735x. If you
    do, I believe that you could implement your application with LabVIEW
    and NI-Motion. You could do so by using the analog feedback feature for
    the control loops for each axis. Then, you could specify the optimal
    sinusoidal moves/pressure patterns that mimic real breathing patterns.
    The analog feedback from your pressure transducer will be used during
    the move(s) to maintain the pressure that you want.
    Please see Chapter 13 here for more details:
    NI-Motion User Manual
    http://www.ni.com/pdf/manuals/371242c.pdf
    Here is also a good discussion forum post on Analog feedback:
    Can i use NI-7358 to implement a hybrid position force/torque control system?
    http://forums.ni.com/ni/board/message?board.id=240&thread.id=2976&view=by_date_ascending&page=1
    I believe that the above option would work for you, and you would not
    have to use the Control Design and Simulation Module or the PID
    Toolkit. Please let me know if you have any additional questions. I
    haven't actually set up a system with analog feedback from a pressure
    transducer before, but I believe that the above would be a very viable
    option.
    Best Regards,
    ~Nate

  • Why do I get this error when running the PID Control-Single Channel.vi: "Requested value is not a supported value for this property."

    Error -200077 occurred at Property Node DAQmx Timing (arg 3) in DAQmx Timing (Sample Clock).vi:1->PID Control-Single Channel.vi
    Requested value is not a supported value for this property.
    Property: SampQuant.SampMode
    You Have Requested: Hardware Timed Single Point
    You Can Select: Finite Samples, Continuous Samples
    Author: Pcorcs
    Attachments:
    PID Control-Single Channel.vi ‏53 KB

    Actually I have already tried a few things you suggested and got as far as the DAQmx Write vi. The error at the DAQmx was a buffer error indicating i needed to set it to 2 instead of the default of 1. Tried using the DAQmx Input and Output Buffer vi to change buffer, with no luck.
    Attachments:
    PID Control-Single Channel.vi ‏53 KB

  • PID control loop slows down during execution.

    Hi, I am a attaching a LV8.6 code that i am currently using to control my engine experiment. I use PID control where the input signal is an rpm value that i measure using a counter. The ttl signal from the sensor is not clean and so i use an analog trigger to generate pulses on the counter from where i measure the frequency and hence the rpm. The output is generated as an analog voltage on an output channel. The problem i am facing is that the loop runs really good when i start off but gradually the loop keeps slowing down and this greatly affects my ability to control engine speed. I am not sure why this is happening. I tried increasing the sample size and rate (so as to increase the buffer size) but this didnt have any effect on the speed. I am guessing its a problem with the way i have my loops setup.. any suggestions would be greatly appreciated.
    Thanks, Shyam.
    Attachments:
    PID control loop.vi ‏33 KB

    Hi all..I realised my mistake soon after posting as usually is the case..the create channel vi for doing the analog output to the output channel was within the loop and slowing things down..when i moved it out..it fixed the problem!!
    Shyam.

  • Can anyone help with a PID control vi

    Hi
    I am doing a project at the moment and I need to build a temperature chamber. I am using LV 7.1 and I have 4 thermistors being fedback to a daq device. I also have two heaters as part of the chamber but i want to get the thermistors readings and pid control the output to the heaters. I have the program written to get the thermistors readings and average them but im having trouble trying to think how i can pid control the heaters so i am looking for a pid vi. If anyone can help it would be great. Thanks....

    NI sells a control toolkit for LV which includes PID control. You can look for it on this site.
    If you want to write this yourself, you should start with an uninitialized shift register. A USR allows you to keep data from the last time you ran the VI. There is an example of using a USR in the LV Example Finder and you can probably some more information about it in this site. You will also need to measure the time between runs and then probably calculate the derivative between each 2 runs to see how fast you're approaching your setpoint.
    I hope this helps, as a start.
    Try to take over the world!

  • PID control in FPGA

    Hi,
    New year wishes to all.
    the Pid control block of FPGA(I think even in windows), LabVIEW is differentiating the Process variable instead of differentiating the error, Is that same?
    Regard,
    N. Madhan Kumar.
    Solved!
    Go to Solution.
    Attachments:
    pid Conventional.gif ‏1 KB
    PID in Labview.png ‏3 KB

    I don't have the control design / PID toolkits installed at the moment as I rarely use them nowadays but when I last did it, I ended up implementing my own. This should be a good starting point:
    It is about as basic of a parallel PID implementation as I can come up with (for Windows - hence the doubles, if on the FPGA you'll probably be using floats). You may wish to extend to allow the controller to reset (as per the LabVIEW implementation by reinitialising the shift registers).
    I've attached the VI (LV2012).
    Certified LabVIEW Architect, Certified TestStand Developer
    NI Days (and A&DF): 2010, 2011, 2013, 2014
    NI Week: 2012, 2014
    Knowledgeable in all things Giant Tetris and WebSockets
    Attachments:
    PID.vi ‏13 KB

Maybe you are looking for

  • No Listner Connection Error

    I have a problem in connecting from client machine during log in I get the error of TNS:No Listner could any body help me solve this problem. null

  • HT4137 i have encountered problem while downloading ios 6

    i have iphone 3gs in which without doing backup i tried to download ios 6 . inbetween some error occurred  now its saying to restore the phone . i don't want to loose the data .can i do something about it

  • Multiple users to share same session

    Hi guys. I am writing a Flash game, where the state of the game and the moves will be stored in the session. Several users will be sharing the same game session though. Flash will send variables containing the move made by a particular player to a Se

  • Printing invoices based on Customer Master's language

    Hi there, Is there a way to set to print in a Customer specific language? For instance, I have a invoice which I want to print for a German customer, hence the output should be german. This is not based on the user logon as a English logon may print

  • What to do about this adobe problem

    i just  hate adobe flash, yet can't do much with out it. It start to happened a few year back i think, once in a while it would just froze everything on my pc computer, especially when i'm watching a video, got that fix after i uninstall the latest v