LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting an Error while giving an input to the formula node from 4 channels from the RMS block connected to the DAQmx block in the LabView VI.

Solved!
Go to solution

Hello Everyone,

I am new to Labview, and I am facing a problem supplying input to the formula node from the RMS block connected to the DAQ block.

I have attached my Labview VI as well as a screenshot of the error.

 

I wanted to give 4 voltage values as inputs from 4 channels of the (DAQ)- RMS block (ai0,ai1,ai2,ai3) to the formula node and have different "IF" and "ELSE" cases inside the formula node and subsequently print out the output.

 

I have typed out a single "IF" case for example in the attached LabVIEW VI.

 

I had a couple of questions which I wanted to ask:-

a) Red MARKED- Have I used the correct block diagram to separate 4 voltage channels from the cluster and supply them as an input to the formula node?

 

b)Blue marked-  Could someone help me with the error listed by LabVIEW in the screenshot, please?

 

All the help will be much appreciated.

I have tried everything to the best of my ability and then posted the question on this forum.

 

Thank you so much!

 

Regards,

Devansh.

formula_node_error1.jpg

 

 

 

Download All
0 Kudos
Message 1 of 12
(3,520 Views)

First off, why use the formula node in the first place. Use native LabVIEW. Your code will run faster. Secondly, you are inputting arrays to the formula node but accessing them as if they were single values. It is unclear what you really want to accomplish so more specific advice is impossible to give. I also don't know why you are converting your array of values (output from the Basic DC/RMS subVI) to a dynamic data type only to convert it back to arrays of doubles. If your intention is to pick out individual values from the array, simply use the Index Array node. There is no need for the dynamic data.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 12
(3,505 Views)

Hi Mark,

Sorry for not explaining what I want to accomplish well in my post.

I will try to do so here,

I have 4 Analog input channels of DAQ-USB-6001 through which I am receiving 4 voltages from 4 filters in my circuit simultaneously with respect to the position of the object. Whichever filter my object will be closer to will give me max voltage from that particular channel but the other 3 filters will also give me a certain voltage (less as compared to their position from the object).

So I thought of using the formula node to build up my conditions such as if ai0 is > 2 volts (RMS value) and ai1,ai2,ai3<1 volt then the output should be position A. So I know my object is at position A. 

Similarly if ai0 > 2.2 volts && ai1>1.2 volts && ai3<ai2 && ai4< 1 volts, then the output should be position B. 

I hope this makes it clear.

 

So could you suggest to me what would be the best possible way I could implement this logic in LabView?

Also, could you elaborate a bit on using Native LabView, please?

 

Also, I agree I made a mistake converting an array of values to dynamic data and converting it back to arrays, but as you see in my sub vi of DC RMS where I have used " "Array to cluster block " which helps me get 4 voltages separately on the waveform graph.

So I thought of doing something where the RMS values will continuously keep feeding to the formula node and as I keep changing the position of the object, due to changing of voltages from all 4 filters, I will keep getting the position such as position A, B, C, D E etc according to my "IF" AND "&&" conditions. 

 

I hope I was able to explain it well.

Could you suggest to me how I could implement those conditions in LabView and firstly how I should go about feeding 4 voltage values from 4 channels to my conditions?

 

I want to stick to LabView and so it would be really if you could suggest me how I could go about with it?

 

Thank You So Much!

All help is much appreciated!

 

Regards,

Devansh.

0 Kudos
Message 3 of 12
(3,474 Views)

Any help would be really appreciated.

 

Thank you so much!

0 Kudos
Message 4 of 12
(3,455 Views)
Solution
Accepted by topic author dshukla

Well, a DBL value is a bit of an overkill for two possible values (0 or 1) why not use a boolean?

 

For example the following will be TRUE if the first element is >2 AND the other three are <1 and FALSE otherwise.

 

altenbach_0-1635840197791.png

 

 

We use "in range and coerce" to see if all values are within their expected range (2...inf or -inf...1).

 

 

(Equal comparisons with DBL are tricky, depending on where the data comes from, but you can change it to include the limits of you want >=2 and <=1, respectively so modify accordingly. Refer to the help)

0 Kudos
Message 5 of 12
(3,450 Views)

Thank You So much for the help!

 

 1) Although, How do I supply the RMS values to the DBL numeric block?

 

error-voltage.jpg

 

2) Also will this work for "N" number of cases ? Right now I have 5 cases for 5 regions depending on the positions.

 

3) Also, how would this work with a case for like: if ai0 > 2.2 volts && ai1>1.2 volts && ai3<ai2 && ai4< 1 volt, then the output should be position B. How would it work for such cases where all 4 filters have a condition?

 

4) Again, I am not able to understand how could I supply 4 values from 4 filters continuously to the "in range and coerce".

Could someone please elaborate and help me with all my questions?

 

Regards,

Devansh.

 

 

0 Kudos
Message 6 of 12
(3,433 Views)
  1. You wire the orange array to the center, create constant for the limits, and enter the desired limits into the array constants. 
  2. I don't see any cases and I don't see 5 "regions". What are "positions"? Please explain.
  3. exactly as I demonstrated.
  4. What is your definition of "continuously"? The code executes for each new iteration with the new data. Hopefully you define a reasonable loop rate.

I think this would be a good time to go over the basic LabVIEW tutorials. Your mindset seems still stuck in some misconceptions. Don't blindly try to stick with ideas from text based code. Forget all that!

0 Kudos
Message 7 of 12
(3,426 Views)

Thank You so much for your patience and yes I have been watching the LabView tutorial videos to get my basics right.

 

Here I have explained the scenario with the help of a diagram:

Case1: When Object is in PositionA

case1.jpg

 

Case2: When object is in position B:

case2.jpg

 

And so on.... for 4 regions (A,B,C,D) for now and later on I will be adding regions such as when the object is in between position A and position B, what voltage values will i be getting from all 4 filter circuits and according form those cases like When V1>2 volts;.....

 

Did this make it clear? Sorry for not explaining it accurately before.

 

Also, the data acquisition from the filter circuit (voltages) will be continuously an example of it is: These are the sample readings from 4 channels of DAQ  when the object is in position A.

Now the idea is thatat without stopping the acquisition I will shift the object to position B and so the voltages will change and case 2 will come into picture and the labview will throughout position B as output or " true" for position B and so on.

case1a.jpg

 

So will this idea work on for all 4 position cases and a few more in the future and how would I go about with this now.

 

Thank You So Much!

I am really new to Labview and so i am struggling to get things right.

Sorry for constantly disturbing you but i really appreciate all the help.

0 Kudos
Message 8 of 12
(3,416 Views)

What does object position have to do with frequency? What is the "object"?

 

So, do we have an IR emitter that flashes at a certain frequency and you want to measure the approximate frequency by using the four detectors, each tuned for a different frequency?

 

Is the frequency the only thing you want to detect or are there other parameters, such as intensity?

 

A truncated picture of an excel sheet is quite useless. Do you have a simple tab delimited data file instead? What's the meaning of the rows? Are these just repeated measurement of the same thing or is the frequency changing?

0 Kudos
Message 9 of 12
(3,411 Views)

1) The object is the IR detector. So the IR emitters, which are placed in 4 positions are actuated to emit at a constant frequency (100Hz,500Hz,1000Hz,1500Hz) as mentioned in the diagram. 

2) The IR detector is connected to a bandpass filter circuit for (100Hz,500Hz,1000Hz and 1500Hz) that filters out the frequency and gives us voltages from each filter (ai0,ai1,ai2,ai3).

So for example when the IR Detector is above the 500Hz emitter (Position A), the filter circuit from 500Hz will give us the maximum voltage and the rest of the filters will give us some voltage. {V0=ai0 i.e(100HZ)=2.2V; V2=ai1 i.e (500HZ)=0.7 VOLTS; V3 i.e (1000HZ)=0.5HZ; V4 i.e (1500Hz)= 0.23V }

 

3) Right now frequency is the inly parameter.

 

4) The rows are timestamps (seconds). That sheet gives us the RMS voltage readings when the IR detector is in position A  for the entire duration of time.

so you can see ai0 is giving us the max voltage than ai1,ai2 and ai3.

 

0 Kudos
Message 10 of 12
(3,405 Views)