LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Probem with the Cycle Average and RMS.vi

Solved!
Go to solution

Hi,

 

I have built a DAQmx with 4 analog input channels. Because at the time I am writing the code I do not have any hardware connected I created a virtual device. I am trying to creating a drop-down menu through which I will choose for which channel I need the RMS. For the RMS I am using the Cycle Average and RMS.vi. For some reason my code works only for when I have "Channel 1" while for the rest of the channels I get nothing. Note that the virtual device generates identical signals for the virtual channels. Has anyone ever experienced a similar problem? I attach my code.

 

Capture.PNG

 

 

KR,

Michail

0 Kudos
Message 1 of 4
(2,129 Views)
Solution
Accepted by topic author MichailM

Michail,

 

     I suggest you Simplify.  Do a single Channel.  Don't generate a simulated signal with a simulated DAQ device, use the Waveform Palette and generate a known signal with known "noise".  Should take 4-5 functions.  With real "knowns", you can see if the analyses (plots, RMS) make sense.  Simplify before you try to analyze.

 

Bob Schor

Message 2 of 4
(2,109 Views)

Hello Michail,

 

+1 for the steps Bob gave you. Your VI as-is looks functional to me. Executing it I can select between four different (physically existing) AI channels. There is a minor, potential issue: You need to selected the channels on your Front Panel before executing the VI. Did you do so?

 

I have a few comments regarding your code, making it easier and/or better. Nothing that changes its behavior, though:

  1. Use an enum instead of the string combobox as selector for your case. Using strings you could have a typo, using an enum instead, LabVIEW will facilitate the case structure from it automatically after you right-click it and click "Add case for every value".
  2. You can also get rid of the case structure completely, see attached code. This limits the flexibility of your code, so in case you planned to add different code per case don't simplify this part^^
  3. Instead of using the "Split Signals" and "Convert from Dynamic Data", you could simply use "Decimate 1D Array".
  4. Currently, you are adding four physical channels to your task, one by one. You can achieve the same in just one step. Did you know you can select multiple channels in an Channel Control? Simply use Shift+Click or Ctrl+Click, or type in the channels in the correct syntax: Select More Than One NI-DAQmx Channel in LabVIEW.
    2018-12-11_14-52-27.png
    (In case you intended to give your user(s) a simply user interface that allows defining a channel order, stay with your current VI.)

Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
Message 3 of 4
(2,076 Views)

Thank you both for your comments. At the end, I tried it with actual hardware and it worked fine. This code is part of a larger one but your advice is very helpful to improve the entire application.

 

KR,

Michail

0 Kudos
Message 4 of 4
(2,055 Views)