LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

'Unbundle by name' changes without verification

Highlighted

Hello everyone,

 

I noticed some weird (annoying) behavior while developing a measurement tool using 'Classes' and parallel programming. 

 

I typically 'unbundle-by-name' the needed variables from the class. Since the tool is still in development I need to change certain controls ('Typedefs'). After the changes of the Controls take effect LV sometimes rewires references to other variables.

 

For example before the change I unbundle the controls:

 --- Files.Filelocation (String)

 --- Monitor.BatteryVoltage (Double)

 

The I change a Control, that has nothing to do with this variables and LV 'looks' for similar variables und rebundles it

 --- Files.OtherFilelocation (String)

 --- Data.SomeData (Double)

 

It looks like LV search for a similar datatype and reconnects it. This behavior seems very random. The number of changes varies (from 0 up to 20).

 

This is quite a dangerous behavior. Usually when variables are changed the IDE does not try to interpret the new names, datatypes or location of the missing variables. There would be just an error ('variable not found', 'cant find ...'). I would be happy that LV just shows broken links, then I can manually decide where the changes should be applied. I can not trust variables that are randomly set by LV. Especially when some sensible Hardware is connected to this variables.

 

Is there a setting to turn of 'auto-connect' or 'interpret-next-best-varible' or 'use-next variable-with-same-name' feature?

Message 1 of 23
(315 Views)
Highlighted

Hi sh,

 

this behaviour (of changing typedefined clusters) is described quite often in the forum.

 

General conclusion is:

  • Don't change the order of cluster elements (too much)!
  • Append new cluster elements after the last element.
  • Only change/delete one element at a time, then save the typedef, then check the VIs.

 

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 2 of 23
(305 Views)
Highlighted

I was afraid of that. Seems kind of weird\ careless for a programming language to operate in such a way. In other visual programming  languages (VHDL) it does not try to change variables when it feels like it.

 

Now I have to implement a new style of coding: Know beforehand how many classes, variables and functions I need and never change anything.

0 Kudos
Message 3 of 23
(294 Views)
Highlighted

Hi sh,

 


@s.h._tech wrote:

In other visual programming  languages (VHDL) it does not try to change variables when it feels like it.


VHDL is plain pure text in my experience…

 


@s.h._tech wrote:

Now I have to implement a new style of coding: Know beforehand how many classes, variables and functions I need and never change anything.


It's always a good idea to plan ahead, expecially on data structures and classes inheritance!

You still can change clusters (or class definitions), but you should learn to do these changes in a more "careful" way…

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 4 of 23
(287 Views)
Highlighted

We have some tools here where we can use connector blocks with predefined coded elements. Very useful for interfaces between modules.

Its always a good idea to plan ahead, expecially on data structures and classes inheritance!

You still can change clusters (or class definitions), but you should learn to do these changes in a more "careful" way…


This is true in the beginning, but in my experience requirements and conditions change especially when the client needs some added features. A programming language should allow even fundamental changes to the code.

 

Also I found that I asked this question already a few months ago. Apparently it sill haunts me

0 Kudos
Message 5 of 23
(277 Views)
Highlighted

Hi sh,

 


@s.h._tech wrote:

This is true in the beginning, but in my experience requirements and conditions change especially when the client needs some added features.


But that's my point as written in the bullets in my previous message: you can add new elements to a cluster without any problems!

 


@s.h._tech wrote:

A programming language should allow even fundamental changes to the code.


LabVIEW allows fundamental changes to the code: add cluster elements, delete cluster elements.

Reordering/renaming (several) cluster elements isn't "fundamental" IMHO…

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 6 of 23
(265 Views)
Highlighted

Well, how do you suppose the system should react? If you change order and names in a type def, the best LV can guess at is the same item number, which is what happens. Any text based language would also struggle with that.

 

In order to give LV a chance to keep up, only ever change order OR names in one update. Adding items at the end is as mentioned not a problem.

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 23
(244 Views)
Highlighted

I understand that removing\ rearanging existing elements may cause problems but still should show a broken link and not rewire to the next best same datatype. It is still time consuming to find the wrong wires but at least I can  follow the cluster\ variable. After my first time asking I only add elements at the end and never rearrange their numbering. The amount of crashes and randomly rewiring was reduced.

 

My main problem is that LV sometimes changes connection to cluster\ variables that have nothing to do with the changed elements. A cluster in another class which has no connection via a VI or even the same state machine. In this case I do not know where or if LV made changes.

 

Maybe I am just spoiled with the IDEs I work with. In Eclipse for example when I just delete a variable it underlines the callers and shows the position of the missing variable. Even better is the refractor-function, where the IDE follows the variable and makes changes wherever its called. It is also possible to differentiate between a local and a global variable with the same name.

 

I was hoping that there is a setting do disable 'auto-connect' or something similar.

Message 8 of 23
(184 Views)
Highlighted

Hi sh,

 


@s.h._tech wrote:

In this case I do not know where or if LV made changes.


When you use a SCC tool (like SVN or GIT) then you clearly notice changed VIs…

 


@s.h._tech wrote:

In Eclipse for example when I just delete a variable it underlines the callers and shows the position of the missing variable. Even better is the refractor-function, where the IDE follows the variable and makes changes wherever its called. It is also possible to differentiate between a local and a global variable with the same name.


That sounds like you could create your own plugins/tools using LVScripting to do the same.

Using the very same name for global and local variables should be punished - even when the compiler allows to do so…

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 9 of 23
(180 Views)
Highlighted

I do not count the number of times that happened to me! This is really a behavior of LV that I don't like.

A common example is the data cluster of a JKI State Machine.

 

JKI State Machine.png

 

Despite initial reflection, it is often necessary to add elements to the cluster during development. If adding data at the end avoids this dangerous relinking, their order in the cluster often becomes illogical.

 

I have already hesitated several times to post an idea here. If you do, I will vote for it without hesitation.

0 Kudos
Message 10 of 23
(169 Views)