LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Set up feedback control of function generator

Hello,

 

I use a function generator (Agilent 33210A) to drive a mechanical shaker with a pure sine wave. I have an accelerometer on the shaker that I monitor with an oscilloscope (Agilent DSO-X-2004A). I control the function generator, and monitor the oscilloscope, with LabVIEW. 

 

I am trying to set up a frequency sweep of the shaker while maintaining a constant acceleration RMS value. My shaker does not have a linear response, so the acceleration changes with frequency. I have downloaded the drivers for both instruments and have both instruments working ok with the example codes provided. However, since I am new to LabVIEW, I am having difficulty putting together the code I want. 

 

Each time I change the frequency I need to check the acceleration RMS value. From there I adjust the function generator output amplitude and check the new RMS value from the accelerometer signal. I can manually create this feedback loop, or I suppose I can use some kind of LabVIEW controller for better results? The speed is not so important to me because once I have the frequency and amplitude set where I want, another set of code will take measurements from devices I have on the shaker. Once those measurements are done, I move to the next frequency.

 

Any advice or tips on this issue are greatly appreciated. I will post screenshots of any milestones I reach, but right now it's a total mess.

 

- John

 

S

0 Kudos
Message 1 of 9
(3,588 Views)

Right off the top of my head I would think that you won't need a feedback loop unless the shaker is both nonlinear and inconsistent. If the nonlinearity is repeatable all you might need to do is generate a lookup that corrects for the nonlinearity by adjusting amplitude as a function of frequency.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 9
(3,581 Views)

Just to clarify, here is a screenshot of what I am dealing with.

 

What's the best way to deal with the example instrument control code given by Agilent and NI? Avoid modifying the blocks they set up? Copy them to different folder and modify them there?

 

The pseudo code for what I want to do is simple in my mind. Realizing it in LabVIEW is quite challenging.

 

- John

0 Kudos
Message 3 of 9
(3,576 Views)

The shaker can be considered nolinear and inconsistent. Nonlinear frequency response in my frequency range (50-150Hz). Inconsitent because the weight of my samples, which vary, also effect the response of the shaker.

0 Kudos
Message 4 of 9
(3,574 Views)
0 Kudos
Message 5 of 9
(3,573 Views)

Ignore my last post-- I have had to learn LabVIEW from scratch starting from last week, and I was unsure of so many things at the time.

 

Attached here is my first attempt at creating this feedback loop that I discussed in my original post. I have one issue that I have not been able to resolve yet, and I'm sure it is an easy to fix newbie mistake. My code runs great in Highlight Mode, but get's totally stuck when trying to run normally. A detail that may help: I use VISA driver blocks for the scope and IVI drivers for the function generator. They made the most sense to me and were easiest to patch together.

 

A second "problem" is that I use both the Wait and Wait Until Next as my pauses in the sequences... I'm not sure which to use in my case.

 

Thanks for the help answering my questions. I still have a lot to learn about LabVIEW and any suggestions/comments are welcome.

 

0 Kudos
Message 6 of 9
(3,529 Views)

I can't look at all your code right now, but thw difference in wait functions is easy. The Wait function always waits the indicated number of msec before continuing. In other words, if you have 1000 wired to it, the function will always wait 1000 msec.

 

The "next multiple" version of the wait depends on the state of an internal millisecond counter that is always running in the background. It waits until that counter is an exact multiple of the number you have wires to it. For example, if you have 1000 wired to it, the function will wait until the counter value is a multiple of 1000. The thing is, the first time you call this function inside a loop, you don't know where the internal count is at, so the first time it might wait 999msec and you might wait 1msec - it all depends on where the counter was at when you started. Of course, every loop after that will take 1000 msec because the loop is now synchronized with the internal counter. Due to this behavior, the function is used to create a rough synchronization between different parts of the code.

 

For most timing operations you will probably want to use the wait (ms) function.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 9
(3,513 Views)

Still having problems with executing the code unless I'm in Highlight Execution mode. I've put waits all over the place, but it hasn't helped. Any ideas?

 

Thanks for the help.

 

- John

0 Kudos
Message 8 of 9
(3,499 Views)

I found a possible source of the problem. The function generator VIs I was using were written with IVI drivers, and the oscilloscope measurement VIs were written with VISA drivers. I switched all the function generator VIs to VISA VIs and the code executed no problem. Still not sure why mixing IVI and VISA worked in Highlight Execution mode and not normally, but my problems are basically solved.

 

- John

0 Kudos
Message 9 of 9
(3,492 Views)