06-08-2010 05:13 AM
Hi all
I'm having some problems with a VI: I need to get a speed profile from a tacho signal.
The acquisition is inside a state machine, and I have to extract the speed profile in 2 of its states: so there are 2 instances of the "OAT Analog Tacho Process" VI, and Reset is set to true only at the very first cicle of the main loop (see the rip-off in the attached VI). The problem arises because it seems to me that the two instances of OAT Analog Tacho Process behave as if they had their own internal state, instead of having only a shared one, as I would expect.
When I switch state, indeed, the speed profile seems to be computed according to the last waveform seen by that VI instance, instead of the last waveform acquired (and that was seen by the instance in the other state of the state machine).
So, do 2 non-reentrant VI's share the same internal state? Or has any of the 2 its own internal state? In the latter case, how can I force 2 different instances of the same VI to share it?
Thanks in avdance for any answer
Paolo
06-09-2010 05:14 AM
Hi Paolo,
I cannot fully understand what you mean with "the two instances of OAT Analog Tacho Process behave as if they had their own internal state, instead of having only a shared one".
I also noticed that execution is set as "reentrant" for the subVI and not "non-reentrant" as you wrote...
In this document you will find more explanation about the different execution modes which can be set for a VI, so that you can choose the more suitable for your purposes.
I hope it helps!
Bye!
Licia
06-14-2010 03:55 AM
Hi Licia
thanks for the answer.
My VI's are set "non-reentrant", but maybeI've set them reentrant in the attached VI by mistake...
I'm sorry I wasn't clea, I'll try to explain it again by example. Assuming:
-A section Wn of the waveform is acquired at every loop (W1,W2,W3...)
-The state machine can be in the state S1 or S2 at every loop
-In both states there is an instance of "OAT Analog Tacho Process", call them T1 and T2.
-When T1 or T2 are called, in order to compute a correct speed profile, they need to know not only the current section Wn, but also Wn-1. This is possible, because the internal state of T1 and T2 are not reset.
What I expect from non-reentrant execution is simply the following:
- T1 processes W2, then the state switches
- T2 processes W3, and since it has the same internal state of T1, computes a speed profile considering also W2.
Unluckily what I get is different because T1 and T2 behave as if they had two different state (in spite of "non-reentrant" execution):
- T1 processes W2 then the state switches
- T2 processes W3 then the state switches again
- T1 processes W4 but, instead of considering W3, it considers W2 (which is the last waveform section seen by T1 itself).
So, my problem is: how can I force 2 different instances of OAT Analog Tacho Process to work keeping in account the state of the last one of the two which was called?
I hope I've been a bit clearer, but it's a complicate thing to explain...
Thanks in advance