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.

Similar Messages

  • Pulse width modulation on sbRIO 9631

    need to control 150 RPM DC motor with help of pulse width modulation from sbRIO 9631. need a simple VI in which i can take some DIO's and with help of a slider i can increase or decrease speed of motor simultaneously. 

    A 12V geared DC motor is hard time figuring out how to control or maintain it.Torque in from speed 0 to 150 RPM.

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

  • Using pulse width modulated signal (square wave) to control when a signal is turned on or off

    Using pulse width modulated signal (square wave) to control when a signal is turned on or off
    Greetings All
    I'm trying to use a labview created pulse width modulated signal (square wave) to control when a signal is turned on or off.
    Here's my logic and graphic example:
    1) The source wave signal is continuous
    2) Use a PWM (square wave) created in labview to control when the signal is turned on or off
    3) If PWM signal (amplitude) is greater than 0 play signal if PWM is not greater than 0 don't play signal.
    I'm actually using this to step sequence / pulse several separate magnetic coils using my audio card (which has several audio output channels), I have a signal in labview played constantly.  Than compare it to the PWM (square wave) which controls if the signal gets played on each separate channel or not.  That way I can control which coil is on and off and in what sequence they are activated. 
    I couldn't find an edge detection for a square wave created in labview so I tried Limits but that doesn't seem to work unless I change the phase manually and that only goes from 1 to -1.  I'm just trying to compare the PWM (square wave edges) already created by labview / play a signal if the pulse is greater than 0 and it turns off the signal if it's less than 0.
    Should I be doing this another way
    Tia
    Message Edited by sal22 on 08-16-2009 06:09 PM
    Message Edited by sal22 on 08-16-2009 06:10 PM
    Solved!
    Go to Solution.
    Attachments:
    PWM control signal block.png ‏23 KB
    PWM control signal front.png ‏48 KB
    pwm test.vi ‏36 KB

    Greetings,
    I tried it two ways using amplitude and levels and fft spectrum.  The values don't seem to update the way I need them to (basiclly showing a 0 or a 1).   I compare the Y values like you recommended but they don't ever seem to update.
    tia
    Message Edited by sal22 on 08-19-2009 10:05 AM
    Attachments:
    pwm magnitude not updating.png ‏29 KB
    pwm test.vi ‏41 KB

  • Tank Level Control with PID regulator

    Hello! 
    I found a lot of examples regarding the simulation of a tank - level control with PID regulator. but I still have a dilemma.
    I can't find the transfer function for the process, if you can help me it would be great because I'm stuck here...

    Maybe you could ask some of you classmates?
    LabVIEW Champion . Do more with less code and in less time .

  • Does the new ipad use pulse width modulation to control the brightness of the display?

    Does the new ipad use pulse width modulation to control the brightness of the display? I have photophobia and migraines and am unable to use displays that use this technology due to it triggering a headache.

    You'll have to go to an Apple Store and view the screen to see if it's OK for you.  If a store is not convenient, buy one from Apple online and check it out.  You have 14 days to return it for a full refund, no questions asked.

  • I need to design fuzzy controller with pid control .

    hi ,
    I need to design fuzzy controller with pid control . to control   Dc servo motor i have NI DAQ PCI 6251 anyone help me??

    ssaara,
    Along with the shipping examples, here is a link to the PID Control Toolkit User Manual. Fuzzy Logic control is discussed in Part II of the manual, Chapters 5 and 8 are good starting points.
    --Michelle
    Instrument Control R&D
    National Instruments
    Instrument Control
    Machine Vision

  • Pulse width modulation with daq mx

    Im trying to change the pulse width modulation on the fly with daq mx. All I have found so far are examples useing traditional DAQ, but not DaqMX. It would be a lot easier if I were to use DaqMX since I will be useing other daq applications in my program and would rather use mx.

    Does this help?
    Attachments:
    PWM-Counter_Output_Folder.zip ‏63 KB

  • Lenovo x240 and PWM (Pulse Width Modulation)

    Hello everyone!
    Does Lenevo Thinkpad x240 use PWM (Pulse Width Modulation) to control screen brightness?
    If so, is there a flickering effect like in this video?
    https://www.youtube.com/watch?v=SpDdy9jSx7Y

    There is an analog modulation with which there is no pulsation at low brightness levels. For example, HP Elitebook 8740w. Watch video: http://www.youtube.com/watch?v=Dk4ckdQ9rvE
    How poor the implementation of PWM (if x230 has PWM) is in this model?

  • Building delays in pulse width modulation

    HI there I am trying to build a vi to control a speed controller for a motor.
    The specification that the technician gave me is to produce a pulse width modulation waveform with constant gap time and variable "on" time.
    This will give the motor a variable speed that can be manipulate.
    I already build a pulse width modulation vi but I don't understand how can I make the gap time constant eg 20ms while varying the on time 1-3ms.
    Is there a method that I could use or an example that I can look at? Any help will do thanks in advance.
     ill attach my current vi.
    Solved!
    Go to Solution.
    Attachments:
    pulse.vi ‏20 KB

    You want to vary the ON time between 1 to 3ms? 
    Did you do a search using the keyword "pwm"?  There are many posts that have examples.
    The idea is that you want to preserve the same frequency and change your duty cycle.
    (Example)
    Let say you want a waveform at every 20ms, which translates to 50 Hz.
    2 ms is 10% duty cycle, 1ms is 5% duty cycle, and 3ms is 15% duty cycle.
    Did I understand your question correctly?  Somehow, I feel like I missed something..

  • Pulse width modulated signals

    Is it possible to generate a fixed frequency with variable duty cycle signals using counter/timer channels of my DAQ 700?
    If yes, is there any example I could download?
    If no, I am looking for a DAQ card that can handle
    the job, I'd appreciate any recommendation.
    Another part of my project is to read in a analog signal while generating this pulse width modulated
    signal. So far I am not very lucky with one DAQ,
    I am thinking of getting two. Does it sound overkill?
    Please help.
    Thanks

    Could you provide a timing diagram for your digital signal?
    I am a firm believer that a digital output device such as an NI timer can create any signal, given the proper software or hardware. I once did a high speed, gated, triggered data acquisition with only a single NI timer chip on the AT MIO 16E-1. It required about 75 feet of BNC cable, more PFI wires than you can imagine, four external logic devices (AND and OR, NAND and NOR boxes) all interconnected and basically tangled. I don't think I could repeat that setup without my documentation, but the point is, it worked.
    The most important thing from that example is that I used a timing diagram. These are so vital in digital IO and timer applications that its not funny.
    If you can't determine ho
    w to do what you need from a timing diagram, just send me a copy, let me know what the basic specs are of the DAQ 700 (how many counters, interconnect capabilities, etc) and I can try to help.
    Good luck.
    As far as reading the analog signal at the same time...well, look at my example. I generated the trigger/gate signal with the card, and then read in the analog data (on several channels simultaneously.)

  • Cannot Find Pulse Width Modulation(FPGA, Use in SCTL)

    Hello All,
    Can someone tell me where I can find Pulse Width Modulation (FPGA, Use in SCTL).vi? I couldn't find it in LabVIEW Example Finder.
    Thanks
    Message Edited by John Edwards on 02-01-2009 09:30 PM
    Solved!
    Go to Solution.

    Here it is...
    Attachments:
    Pulse Width Modulation (FPGA, Use in SCTL).vi ‏43 KB

  • Peltier control with PID

    Hello,
    I have a Keithley 2400 source-meter, and a Keithley 2010 multimeter. I measure temperature of a water loop with a RTD, and I measure its 4W resisitivity with the K2010.
    I can cool and also heat this water loop via a Peltier heat-pump. The applicable range is -1Amp < current < +1 Amp. So I use the Keithley source-meter to drive the Peltier in this range. Negative current cools the water, positive current heats.
    I have the PID tool-kit with LabView 2011.
    My only question is that, if I give  +-1 as range input to the PID.vi, is it a proper way to implement this task?
    Thanks!
    Solved!
    Go to Solution.

    Hi blokk,
    "ok. so this is not implemented in the Pid toolkit. So when the PID vi using negative output, I have to set the Kc to negative. ... Because it should change the sign of Kc as early as it switches range polarity continuously."
    You don't need to change anything, when the PID control is running. You have to set the Kc once to the correct value, that's it! Kc is describing the PID behaviour in terms of "higher output results in heating up and lower output means cooling mode"...
    "Should I alter the pid.vi inside?"
    Never ever change vi.lib VIs! If you really want to change them (that isn't needed here!), make a copy of the VI and change the copy!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • AO squarewave with 1 microsecond pulse width

    Im trying to create a squarewave with a pulse width of 1 microsecond and a period of 2 microseconds (50% duty cycle). So far I have been trying to use what code i can get off the NI site to help me with this, but so far no luck. I have a PXI-6025E running off the PXI-8176 controller. Can anyone point me in teh right direction? Or possibly if theres a VI I skipped over that might have the answer.
    Thanks,
    -Mark

    Mark,
    There is an example which ships with LabVIEW titled "Function Generator.vi". You may also find this on our website at the following link.
    Simple Function Generator Example
    http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B45EACE3D82956A4E034080020E74861&p_node=DZ52311&p_submitted=N&p_rank=&p_answer=&p_source=External
    Change the waveform type on the front panel to Square Wave. If you wish to change the duty cycle, from the default of 50%, then you will have to go to the block diagram and set the % duty cycle input of the Compute Waveform VI in the middle of the diagram.
    This example will work with any E Series device, which includes the NI 6025E. Keep in mind that a period of 2uS is an output rate of 500kHz. The NI 6
    025E only has an analog output rate of 10kHz. You will need to consider different hardware if you wish to achieve an analog output frequency of 500kHz. However, if your square wave is TTL (0V and 5V) then you should just use your board's counters. They will be able to perform this frequency generation easily.
    DAQ-STC: Generating a Continuous Pulse Train (Intermediate-Level VIs)
    http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B45EACE3EB0B56A4E034080020E74861&p_node=DZ52328&p_submitted=N&p_rank=&p_answer=&p_source=External
    Regards,
    Justin Britten
    Applications Engineer
    National Instruments

  • Control three interdependent things with pid control?

    I have 3 things (they are valves) that I need to control to set flows... but adjusting one of the three valves will affect how the others behave... basically they are all 4-20mA controls, but if one is moved the others will read something different.
    My question, I'm having a hard time thinking about how to control these three things, I need to be able to tell any of the three to go to a certain flow regardless of where the others are... is PID the answer?  If so, I need to tune them one at a time, and I don't know what to set the other 2 vlaves while I tune 1... does it matter? cause, whatever PID constants I get from tuning will be dependent on what the other 2 valves are at... or is there another way?
    much thanks!

    Hi Fibo,
    I've linked an article you can read through for a quick intro to MIMO control.
    Can I simulate MIMO models in LabVIEW?
    However, I wonder if this necessarily needs a MIMO model.  Regardless of how one valve affects the other, if you've got a sensor on each of your valves and implement PID separately on each one, then the relationship between the 3 valves is eliminated, is it not?  We've now got 3 single-input single-output systems.
    Message Edited by Tejinder G. on 03-29-2010 01:05 PM
    Tejinder Gill
    National Instruments
    Applications Engineer
    Visit ni.com/gettingstarted for step-by-step help in setting up your system.

Maybe you are looking for

  • XML INVOICE REPORT- MULTIPLE COPIES

    Hi All, I am developing report for sales invoice. The source for the report is RDF and template designed using RTF for difffent operating units. Now We have an requirement to to print the invoice - 3 copies every time when user submit the request. In

  • Conflicts on a single table

    I am having a conflict issue on just one table out of 37 table articles The database is for Food recipes I have 3 users making changes, they each have their own menus so they should not work on anyone else's dishes [tblRecipe] but they do need to be

  • HT2534 the "none" option does NOT appear!!! why?

    followed these wonderful instructions but no matter what I do I do NOT get the "none" option!!!

  • Object encoding error

    Hello! "Object encoding error; terminating connection : rtmp://_defaultRoot_/_defaultVHost_/onair/_definst_" This message sends the FMS 3.0 to the console, when I try connecting to a remote shared object from a client side flash app, and after the Ne

  • Can I get three finger scroll to navigate back and forward pages in firefox like in OS X Snow Leopard?

    My only complaint so far about Lion.  It's like I have a new toy to play with, I'm just frustrated that the previous three finger scroll options are seemingly unavailable. Please help, Chandler