LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create a PID for function generator

Hi, 

 

I'm trying to build a PID system that controls the input voltage to a linear actuator. My goal is to use a simple control system (PID) to keep the linear actuator vibrating at a fixed acceleration even under external interferences. 

 

I am using BNC-2110 input to read acceleration signals. I have connected a piezo-electric accelerometer to the BNC-2110 input that measure voltage generated from the vibrating actuator, which is then converted in to acceleration (ms^-2 or g- not shown in the VI). 

 

I also use the same BNC-2210 to output a sinusoidal signal that drives the actuaor. A 50 Hz, 1V sinusoidal signal is generated by the labview virtual signal generator (see attachment), which drives the actuator at 1g acceleration. The overall goal is to make sure that input frequency(50 Hz) remain constant at all times while varying the input voltage from 0-10V (using PID) to keep the actuator vibrating at a fixed acceleration of (1g/ 9.8 ms^-2) under external disturbances. 

 

I have been trying my very best to come up with a feasible program and have failed for the last 2 months. It would be great if community members would help me out. 

 

Thank you so much 

Download All
0 Kudos
Message 1 of 5
(2,997 Views)

Well... there are some problems in your code. Is this your first LabVIEW project?

For example, the problems are...

  • PID operation should be time-critical but you putted "Write to Measurement File" into While Loop.
    It causes much jitter
  • Output from PID function is connected to DAQmx Write function but in this case,
    Write and Read don't run in parallel While Loop Tunnel Help

You can refer following examples.

C:\Program Files (x86)\National Instruments\LabVIEW 201x\examples\control\PID

How to Synchronize Analog and Digital Input or Output Tasks in NI-DAQmx With LabVIEW

Certified LabVIEW Developer
There are only two ways to tell somebody thanks: Kudos and Marked Solutions

GCentral
Message 2 of 5
(2,967 Views)

Hi Emboar, 

 

Thank you for the quick response. Yes, I am new to LabVIEW and this is my first project. 

 

Can I get your opinion on how you differently would have created the program to make it error-free? It would be great if you can share me a screenshot or even the edited vi file so I can get a better understanding.

0 Kudos
Message 3 of 5
(2,954 Views)

It's simple, refer link I introduced. The diagram in the link shows how to create synchronized DI and DO application. You can do same operation on AI and AO. Put PID function into the loop. It's the simplest way.

Certified LabVIEW Developer
There are only two ways to tell somebody thanks: Kudos and Marked Solutions

GCentral
Message 4 of 5
(2,946 Views)

Hi Batasel,

 

I have been trying my very best to come up with a feasible program and have failed for the last 2 months.

So after two month you are still not able to avoid problems like

  1. completely missing DATAFLOW concept, including a loop never stopping to iterate?
  2. ignoring coercion dots like the waveform input to your PID?
  3. reading an arbitrary number of samples in the AI task because you failed forgot to set a sample number?
  4. creating a greedy loop with no wait? A loop that examines the same input again and again? (It's not even called right now due to item 1…)
  5. not using AutoCleanup…
  6. creating an AO task for "use waveform", but feeding only single samples?

Have you taken any of those "Training resources" offered in the header of the LabVIEW board?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 5
(2,935 Views)