LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Formula Node result of NaN

Hello to all,
I have done a Formula Node with the next formula:B=(2*16/3.14159*(asin(sqrt(V/Ab))-3.14159/4))-(2*16/3.14159*(asin(sqrt(Uoffset/Ab))-3.14159/4));
Ab=3.269.
V is the data entry to the formula node.
Uoffset is the mean of the 100 first values of the data that I obtain it previosly.
I know that I can not do the square of the negative number and the asin I can not do it for values greater than 1 for that reason I don´t put values greater than 3.269 into the V value never and negative values either.
I take this precautions but I obtain several times the output value of NaN I use the entry V for example:0.00061035 could be that the format of the entry it is very extends.
Also when I introduce the same data to this formula, one times I obtain some values in the out and when I execute the subVI with the same data I obtain other values in the out.  Said it diferently I obtain different out for the same data in. How it is possible????

The other hand I need to do the integral and the derivate of one array, how can I do it??? And the more important how I can or what I use for the parameter dt of the derivate???
Thanks a lot
Gonzalo De Francisco Ortiz
0 Kudos
Message 1 of 8
(4,478 Views)


@Talo wrote:
Also when I introduce the same data to this formula, one times I obtain some values in the out and when I execute the subVI with the same data I obtain other values in the out.  Said it diferently I obtain different out for the same data in.

UOffset depends on the last 100 values, so if the history is different, the output will be different.

Please attach your VI so we can test. What LabVIEW version do you have?

Message 2 of 8
(4,473 Views)

Thanks Altenbach,

I use the version 8.0 of LabView.

I attached the subVI which I have problem and ones examples of the data file that I use how the input. The first file "In1" don't give me usually problems, but the other two files give me different results each time that I execute it.

 

0 Kudos
Message 3 of 8
(4,456 Views)
Hi Gonzalo,

after having a first look: You have a race condition in your code: why do you use a local for the mean value instead of simple wiring?
I think that's the reason for your unexpected results!

Other small items:
- when you use auto-indexing you don't need to provide 'num of iterations' to the for-loop.
- the only difference between the 2 cases is the 'abs'-function used for negative inputs. Just do the 'abs'-function everytime and you don't need the case-structure...
- when testing numbers against zero you can use specialized functions from the comparision palette

Editing:
I attached a changed example in LV8.0

Message Edited by GerdW on 02-01-2007 01:22 PM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 8
(4,449 Views)
Hi Gonzalo,

again some changes in the code. Now the calculation is fully in LabView primitives (IMHO faster and easier to read than formula node!).

This way I also could check your calculated data: ln1 & ln3 run fine, but ln2 is giving NaN because of the NEGATIVE Uoffset of the first 100 values!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 8
(4,444 Views)
Thanks GerdW,
I am going to check the changes that you made in the subVI.
Thank you very much, I try to tell you the results that I obtain with it
Gonzalo De Francisco
0 Kudos
Message 6 of 8
(4,423 Views)
Wonderfull GerdW,
I think that it work perfectly I am very thankfully.
Another think I need to to the next things with the data that I obtain:
-max(data)
-max(ddata/dt).(diferential of the data)
-integral(data).
-integral(data*data):
I attached one subVI where I try to do it.
It is correct?????
Thanks again
PD: I don't know what is the correct way, using the time domain subVI or without it.
Gonzalo De Francisco
0 Kudos
Message 7 of 8
(4,413 Views)
Hi Gonzalo,

from a first impression it seems to be ok.
Usually I don't use those express vi's, all of the included functions can be found as primitives somewhere in the palettes. The express vi's also introduce some overhead, at least in terms of vi size...

And please: do your programming according to style guide (data flow from left to right, straight wires)! Especially when you want others to comment your code 🙂
I also favorize to show terminals in the block diagram not as icons as I'm interested in the datatype - and not in the look of the front panel element...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 8
(4,407 Views)