LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Re-assigning shared variable node pin assignments

Skip to bottom for Code Development

I have a need to re-assign over 100 shared variable pin assignments because the hardware engineers have decided to "move some of the inputs around" for their convenience. In my project tree, I have a long list of inputs with convenient alias names (see picture for a small snapshot of the project tree), but they are no longer pointing to the right pins. In their properties menu, you can't change the pin assignment, so I'm left with the need to:

  1. Rename each alias to match the new hardware connection
  2. Find each shared variable node on every block diagram and replace it with the appropriate node

As I have so many block diagram nodes in so many programs (Real-Time and Windows vis), I was thinking of developing a script to:

  1. Drill through every vi in my project to find every block diagram shared variable node.
  2. Use a mapping table (predefined?) to replace each node with the correct one.
  3. Use the mapping table to re-define each of the shared variable alias names.

I've used scripting only briefly before, and found it very powerful, but I've not ventured into something like this. I have only a little time to spare on my project so I want to get this right from the begininng, and thought that if I posted a little discussion on here I might get some useful advice from other LabVIEW Scripters before I start!

So, can anyone think of a good way to manage this?

Anyone already have something that does this? Is it even possible!?

If the Mapping Table was configurable in a GUI, presumably made available after stage 1 (finding all block diagram nodes), it could be a versatile tool for others perhaps?

I'll obviously post the VIs when I'm done, so any contributions are welcome 🙂

svnames.jpg

---------------------

Code Development 9th July 2010

OK, so I spent a day putting something useful together, and finally have a new tool that works for me: Re-Map IO Nodes.lvproj

With this tool I can programmatically analyse a whole Project tree for all VIs that have Shared Variable Nodes on their block diagram.

I can then create a re-assignment strategy, called a Map Plan, for each node. This basically needs to represent the changes in hardware wiring to the cRIO I/O.

I can then apply the Map Plan, and the code will re-associate each SVNode with it's new destination.

On top of that, there is the option to use Tags, which are useful for marking SVNodes as being 'Done'. This way I can keep an audit trail of all the nodes I've already changed, and those I haven't. Tags get saved 'magically' with the node object, so if I need to run the Re-Map tool again I'll be able to see those SVNodes I've already re-assigned.

I included a Test vi within the Project, as a tutorial to its use:

RIONpic1.jpg

1. Run Remap Master.vi and select the Project you want to work on from the list.

RIONpic2.jpg

2. Select Analyse and the code will search the entire Project for any Shared Variable Nodes. On the right is shown the Front Panel and Block Diagram of Test Me.vi

RIONpic3.jpg

3. Select Map Plan, and create a re-assignment strategy for the Shared Variable Nodes. Here, there are only three, so for the tutorial I'm inter-changing the first with the second, the second with the third, and the third with the first.

RIONpic4.jpg

4. Select Re-Map and the code will apply the re-assignment strategy to the Shared Variable Nodes, and report a short summary of progress. You can see in the Test Me.vi block diagram that the Shared Variables have been re-assigned, as per the Map Plan. You can also see I've had to turn on "Ignore Existing Done Tags" because the SVNodes in Test Me.vi are already tagged as Done!

Attached is the code, LV2009 SP1. It was created using scripting, so if you wish to edit it you might want to install the scripting features.

Thoric (CLA, CLED, CTD and LabVIEW Champion)


Message 1 of 2
(4,158 Views)

Thanks for that Ben

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 2 of 2
(2,766 Views)