Showing results for 
Search instead for 
Did you mean: 

Malfunctioning VI

Go to solution

The purpose of the attached .vi is to determine a correction factor based on the input "current frequency" and TVC standard.


You'll notice when you open it there is a rather large case structure, and the only case that seems to be malfunctioning is case 25, where I always get infinity or NaN as the resulting correction factor.


The purpose of this case is for when the TVC standard in use does not match one in the database, so the user can input his own data.


Correction factors are input at specific frequencies, and if the current frequency is between frequency points, a linear fit is calculated.


Things to note: 

The default frequencies in the front panel are a little screwy, I'm working on fixing that so they don't default as they do, but

it shouldn't matter what frequencies you enter as long as they are sequential and not duplicated.


Also, all of the other 24 cases should work fine and work under the same principle (the current frequency determines the range, which determines which case structure/formula node to run through) except they all use constants, so I imagine I just mixed up the wiring somewhere when I tried to replace all the constants with user input/clusters.  Use these cases to test it out if you're confused about how it should work.

0 Kudos
Message 1 of 4

That is just too large and unwieldy to try to debug for you.


There are two tips.


1.  Why are you using multiple copies of current frequency in every case when there is a perfectly good indicator sitting outside unused that you could tunnel into the case structure?

2.  It looks like all of those formula node Express VI's have the same formula.  Rather than copying that more than 100 times, create a subVI that contains the formula.  That way you don't risk having one formula be wrong, or if you need to change it, don't need to change 100 copies.

3.  The multiple parallel case structures seem unnecessary.  With a good data structure, perhaps using arrays, and a good looping mechanism, you can come up with a single case structure that has multiple cases.

0 Kudos
Message 2 of 4
Accepted by LarsUlrich

In case 25 you do not have anything wired to Frq L and Frq H. With nothing wired LV will use the default values. Divide by 0-0 and you get NaN.


In addition to Ravens Fans comments You can use In Range and Coerce in place of two comparisons and an AND gate.  I suspect that if you used arrays of frequencies and correction factors, everything would fit in one small for loop.



Message 3 of 4

Thanks, I figured it was something stupid like that. 


Also, thanks for the tips to condense it, I'll try playing around with it to see what I can do to take out some of those parallel case structures.

0 Kudos
Message 4 of 4