LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sanity Check

I think I am losing my mind (what little I have left).
 
I think this is what is happening and I would appreciate either corroboration or "No you're wrong".
 
I am using LabView 7.1.
 
I have an application (top-level VI) in a folder named "NEW".
In that application and folder is a VI named "Fred"
 
Last week I saved a copy in a folder named "OLD".
 
I am editing my NEW application and my VI named Fred.
I know I made some changes and I want to see what Fred looked like last week.
 
When I try to open Fred in OLD, I get a prompt essentially telling me that Fred is already in memory and do I want to revert.
 
To put it simply, NO!  I want to see both Fred's at the same time.
I am assuming that I cannot do this.
 
 
Here's the real problem.
If I load Fred from OLD and then accidentally save it when I exit, it seems to overwrite Fred in NEW.
 
Is that what is happening?
I think I lost about five hours of work like this.
 
Message 1 of 19
(3,401 Views)
You are correct that you cannot open two VIs with the same name. In order to remove the VIs from memory you must close labview completly (even the title window). I would then save your Fred VI in the OLD folder to Fred_old.vi. This will solve any issues you have in case of saving.
Andrew Alford
Production Test Engineering Technologist
Sustainable Energy Technologies
www.sustainableenergy.com
Message 2 of 19
(3,385 Views)
You can't (at least in LV 7.1) load different VIs of the same name. To do what you want, you'd need to rename the old version OldFred, then open it to be able to open it at the same time.
 
Plus, if you rename the old Fred to OldFred, it should stop saving over your "new" Fred.
 
There's probably a more elegant solution, but that has been my experience with it.
0 Kudos
Message 3 of 19
(3,385 Views)

Doesn't this seem a bit like poor memory management.

Every other application and development environment that I use allows to have multiple files with the same name open.

Each file is also tied to its folder.

 

Why doesn't LabView allow it?

Anyone?

 

0 Kudos
Message 4 of 19
(3,382 Views)

@jspaarg wrote:

Doesn't this seem a bit like poor memory management.

Every other application and development environment that I use allows to have multiple files with the same name open.

Each file is also tied to its folder.

Why doesn't LabView allow it?

Anyone?


It's actually mostly inconvenient when you open a VI which calls another VI and a VI with the same name has already been loaded into memory. In such an event, you will get a message informing you of that. If you save, the new location of the subVI will be remembered.
 
I don't know what the original reason is, but here are a couple of options (wild guesses) -
  • LV did not base names on full paths because it used relative paths to find VIs.
  • This was just so in the past and was not changed (remember that Office applications, for instance, used to do this as well until recent versions).
  • This was done to support multiple platforms.

There are solution for this. For example -

  • Rename the files.
  • Create a namespacing convention using prefixes and suffixes. Look at the OpenG VIs for examples.
  • Upgrade to LV 8 which has the project environment and supports multiple instances.
  • Add the line AllowMultipleInstances=True to your LabVIEW.ini file. This will allow you to have a new instance of LabVIEW whenever you run the LV executable. These instances can have VIs with the same name open at the same time. Note that this can get confusing.

___________________
Try to take over the world!
Message 5 of 19
(3,370 Views)
OK, I understand (even if I think it is vers DOSish) what is going on there.
 
Am I correct in my assessment that it overwrote the NEW VI when I did a save with OLD VI?
 
Also, it seemed (at least once) that after I loaded a VI from an OLD directory, sub VIs from that VI that were opened with a double-click also came from the OLD directory.
 
Please tell me that I am hallucinating (I believe that is better than the alternative).
 
0 Kudos
Message 6 of 19
(3,362 Views)
Close all Labview, go to your new folder and open one of the sub VI's that should be different from the old one. If it is different then the Top level vi got resaved with links to the OLD sub vi's. To replace the old sub VIs with the new one's you will have to open the top level vi, on the block diagram right click on each sub vi and select replace, then select the matching vi from the NEW folder. Do this for each sub VI, once complete resave the top level vi in the NEW folder.

Message Edited by AndrewAlford on 02-02-2006 03:51 PM

Andrew Alford
Production Test Engineering Technologist
Sustainable Energy Technologies
www.sustainableenergy.com
0 Kudos
Message 7 of 19
(3,351 Views)

It's not DOSish because LV originated on the Mac 20 years ago and only moved to the PC when windows was around.

In any case, LV should not save the old version in the same place as the new version unless you explicitly tell it to by using Save As. What does happen, as I explained earlier, is this:

  1. c:\foo.VI calls c:\new\bar.vi.
  2. You open c:\old\bar.vi and then you open foo.vi. foo.vi knows it should have a vi called bar.vi and it knows where to find it, but since you already have a bar.vi loaded, it will take the one already in memory and alert you to that.
  3. You save foo.vi, thus telling it that the location it now took bar.vi from is good and it will now forever take it from there. That's why when you double-click you see the VIs from the old directory.

You basically have two options:

  1. Close everything. Rename the old directory and open your top level VI. Since the old directory is missing LV will start searching for the missing VIs, starting at your current directory. Once it loads them from the correct location you can save the top level VI and it will remember the correct locations for next time.
  2. Close everything. Go into the new folder and open the subVIs. Then open the top level VI. Since the VIs are already in memory they will be taken from the new directory. Again, saving should now commit this change to the VI.

The basic solution for all this is to make sure your names are different. This is really not something that should prevent you from using LV and it is usually not a problem if you take the proper precautions.


___________________
Try to take over the world!
Message 8 of 19
(3,344 Views)

I understand how to avoid the problem, but I have been writing software for a lot of years in a lot of different environments.

I have only been using LabView seriously for about four months.

Every other environment that I use, whether Borland (C++ and others in the old days, or Delphi now), Visual Studio, or any of a number of embedded environments (microchip, etc); allows for multiple files with the same name in the environment and knows which to used for a given project.

Do I understand correctly that LabView 8 allows for projects with similar file-handling? 

That is, can I have two files (VIs) open at the same time with the same name from different folders and the compiler knows which one to use?

 

 

0 Kudos
Message 9 of 19
(3,341 Views)
"

Do I understand correctly that LabView 8 allows for projects with similar file-handling? 

That is, can I have two files (VIs) open at the same time with the same name from different folders and the compiler knows which one to use?

"

(emphesis added)

Yes!

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 10 of 19
(3,336 Views)