LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reset variable value after each execution

Hi people,

I have a .net object invoking a node that counts a certain value when executed (dll is working as it should), and in each VI execution I get the desired value. However when I "Run Continuously" the VI, it seems that LabVIEW is adding up the actual value to the last one of the last execution, and I get a wrong value. I have already tried to create a local variable and zeroed it at the beginning of the script and many others attempts such as cleaning all indicators at the VI properties, but it seems that the reference is just not closed at the end of each execution (but I am closing the reference of the object too)...  I have no idea how to solve this, if anyone could help, I would be grateful!

 

I am not sure if posting the code would help, nor if I can, it is just a Construction Node -> Invoke Node -> Indicator -> Close Reference.

0 Kudos
Message 1 of 16
(3,335 Views)

I have no idea, either.  I might have a better idea if you actually posted the code.  (Meaning, the actual VI and not a picture.  You wouldn't bring a picture of your car to a mechanic so he can figure out why it's not starting, right?)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 16
(3,331 Views)

"Run continuously" is a debugging tool and not a valid way to run or test a VI.

 

(It is impossible to tell from your description what you are actually doing, so seeing some simplified code would definitely help. What is a "script"?)

0 Kudos
Message 3 of 16
(3,327 Views)

Why are you using the "Run Continuously" button anyway?  It's a debugging tool and shouldn't be used for anything other than that.  Actually, I do have an idea or two about what's going on, but I'm going to wait for the code so I don't have to guess.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 16
(3,326 Views)

Billko,

I appreciate your contact, however I am afraid I cant post the code. Do you have any suggestion related to the invoke node, if I can force its reference closure... or if my flat sequence structure (I am using one) is interfering in the "run continuously" execution. Idk...

0 Kudos
Message 5 of 16
(3,318 Views)

altenbach and Billko,

I use the VI in the TestStand software, and there the execution is having the same behavior as the run continously button.

0 Kudos
Message 6 of 16
(3,315 Views)

As shown, the invoke node "getListSize" returns a int value, and after each execution, the value is added to its last execution value.

 

tempsnip.png

0 Kudos
Message 7 of 16
(3,295 Views)

@enzofurlan wrote:

As shown, the invoke node "getListSize" returns a int value, and after each execution, the value is added to its last execution value.

 

tempsnip.png


Capture.PNG

Just post the VI.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 16
(3,285 Views)

Here s the VI, as said, it works perfectly when executed once, but in TestStand, where I execute it multiple times, the "Event Index" indicator is my problem.

 

I appreciate your help.

 

EDIT: simplified version

0 Kudos
Message 9 of 16
(3,271 Views)

Sorry for not getting back to you.  Are you able to save it as previous?  I only have LV 2016.  😞

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 16
(3,225 Views)