LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array will not change its forced input values.

Solved!
Go to solution

I am trying to change the input values for an cluster -> array.  They say 'adapt to entered data' but I cannot change them.  And when I change them on the block diagram they become 16-bit (blue) instead of 64-bit real (orange).

 

 

Thanks,

 

Kevin

0 Kudos
Message 1 of 9
(3,779 Views)
Can you post an example VI so we can see what you are talking about?
0 Kudos
Message 2 of 9
(3,766 Views)

Here is a copy of the vi.

 

On the front panel there is a set of values which list the minimum location of a slide (there are five or six of them).  [I am not near a computer where I can find out.]  When I try to change the values of the minimum value they always revert to default values everytime the program is loaded.

 

 

 

0 Kudos
Message 3 of 9
(3,754 Views)

You write hardcoded values to e.g. "stage min" in frame 0 of the big sequence structure via a local variable.

 

(btw, you VI suffers from a severe case of localitis&sequencitis)

Message Edited by altenbach on 07-16-2009 11:25 AM
Message 4 of 9
(3,749 Views)

atomless wrote:

On the front panel there is a set of values which list the minimum location of a slide (there are five or six of them).  [I am not near a computer where I can find out.]  When I try to change the values of the minimum value they always revert to default values everytime the program is loaded.


Obviously, you haven't grasped the gist of LabVIEW, why else would you place a diagram comment as follows:

 

It looks like Labview will not allow different array elements to be initialized to
different values.  What a bullshit excuse for a programming language.  In
any case, then, for the motion stage limits to make sense, I need to wire their
limits in here.

 

If you want an array with different values as defaults, simply fill the array, then make the new value the default (of the array, not the element!). Save the VI.

Message 5 of 9
(3,746 Views)

Hi Altenbach, what does localitis and sequencitis mean?

 

(I am not afraid to ask...I have inherited the vi). 

 

Kevin

 

0 Kudos
Message 6 of 9
(3,742 Views)

Hi Altenbach:

 

I am sorry for the 'comment' (it is not mine just like the code  is not mine...funny though it may seem, I was unclear on its meaning), but I will work hard to improve it.

 

I actually like LabVIEW (and will probably remove the comment).

 

Thanks,

 

 

0 Kudos
Message 7 of 9
(3,738 Views)
Solution
Accepted by topic author atomless

Well, this thing was written by a text programmer, because it has no resemblance to dataflow but is written like a text program. Instead of doing a few LabVIEW turorials, he simply started programming like a wild boar in a vegetable garden.

 

He basically declares all "variables" on the left, the reads and writes to them via locals. Since this breaks all dataflow, we need to add sequence structures to make sure things execute in the correct order and avoid race conditions. Each frame being a "statement".

 

Each local variable forces another datacopy in memory, so things are not very efficient.

 

See also this discussion.

 

We also have a long thread about the pitfalls of local variable overuse. I think I add this example to it too. 😄

 

 

Message 8 of 9
(3,736 Views)

Even though the code is peppered with sequence structures, there are still race conditions. Have a look at the code in the image.

 

 

 

This sequence frame has 3 independent code fragments and they can execute in any order. Let's look at the three "stage mv" locals. Most likely, the programmer expects that it receives a new value in A before it gets read at location B. however, there is a 0%--100% chance that location B gets read first, obtaining a stale value, The final value of "stage mv" when the frame finishes could be either from A or C, depending on execution order. The behavior is completly unpredictable. Even if it works now correctly by accident, small code changes or a LabVIEW version upgrade could invert the order, leading to unpredictable results.

 

 

Message Edited by altenbach on 07-16-2009 12:03 PM
0 Kudos
Message 9 of 9
(3,725 Views)