LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

subtract function error

Solved!
Go to solution

 


Phatin a écrit :

  I did drop in some temporary indicators.  I also went ahead and expanded the screen capture to show a bit more of the local VI so you can see that the results being fed to the subtract function should not be changing, and that because of the error, it essentially locks up the VI since it won't read any more values with the read VI.  Anyway, it can still be seen that the subtract function is still errs.

 

  I've never really noticed a lag in performance with the retain value feature turned on; however, I did for the heck of it turn it off.  And to my extreme astonishment, the subtract function begins to operate correctly.  Because as I understand the feature, it should not be influencing the results of the program in any way; it should just be recording the results for later viewing.  And it doesn't interfere if I try it in a simpler VI.  So unfortunately I'm still at a loss as to why the error is occuring, but at least that helps to narrow down the issue, and it's one more option for working around it.


Since the problem should be related only to the probe display, you could also wire the subtraction result out of the loop, using autoindexation, and check in the resulting array that the result of the operation is actually correct. 

Chilly Charly    (aka CC)
Message 11 of 16
(945 Views)

Except by adding in the indicators, that shows that the actual result of the operation is wrong.  Also, as mentioned, the result as it goes into the shift register uses the wrong value, so that when the next iteration of the while loop runs, the read function tries to read "0" files.  And even though it isn't shown in the prior images, the while loop is set to end when the total number of samples read reaches a certain value; which can never happen when the read function isn't reading any samples.  So that also goes to show that the actual result from the subtract function is the -2, and that "-2" is not just the result being displayed by the probe.

 

I think I'd have to go with Ravens Fan and Ben that this must be a bug with the retain value function.  In which case, it becomes an issue for NI to solve.

0 Kudos
Message 12 of 16
(921 Views)

We're interested. Did you have any luck recreating the behavior in a VI I can test?

Verne D. // Software R&D // National Instruments
0 Kudos
Message 13 of 16
(896 Views)

No luck so far.  But I haven't been dedicating a lot of time to trying this.  I can see about getting approval to send the actual program to National Instruments though if I can get an official request for it.

0 Kudos
Message 14 of 16
(886 Views)

Hi:

 

. I am using LabView 2012 SP1 f4. I recently run into this problem in my program the result I get is always zero no matter I put in. In my program I created a sub VI to calculate the speed of a moving object using the current position minus the last position to find the defference over the current time. The answear I get is always zero. I even try using the math formula with the same error. If I invert one of the inputs to a negative value then I get an output which it is an addition of the two values.

 

I try something else, I placed an addition tool in the same VI and using the same two signals get a result, it works fine. If I negate one of the signals I get zero for result. Now I have a program that does not work.

0 Kudos
Message 15 of 16
(652 Views)

@Toro wrote:

Now I have a program that does not work.


I don't think your problem is related to the issues discussed in this three year old thread that has alredy been marked as solved. You should really start a new thread, giving you the opportunity to mark the solution to your issue once we solve it.

 

In any case, you say that you have a program that does not work. Can you attach it? How do you get the "last position" (e.g. feedback node, event data node, local variable, etc.). What is the datatype of your "signal"? Could it be you have a race condition?

0 Kudos
Message 16 of 16
(645 Views)