02-17-2015 02:13 PM
We have a study involving sound localization -- we move a speaker with a robotic arm, play sounds through the speaker, ask our subjects to point a laser where they perceive the sound location, and push a button. We can also turn on LEDs and lasers, adjust parameters of timing, even move the sound source. The various Trials are "programmed" by entries in an Excel WorkBook with columns for timing, sound position, sound parameters, etc. Besides the Excel WorkBook, we generate 3 output files -- an XML Header file that describes the recording configuration (Analog and Digital Channel names and scales) and records the parameters of each Trial as it is run, an XML Event file that records all "point-in-time" events, such as Messages, State changes, or Digital I/O changes, and a Samples file that contains the N (typically 16) sampled Analog and Digital channels, sampled at 1KHz. We control all of this from a LabVIEW Real-Time Project, which also includes the routines to examine, manipulate, and analyze the output data files.
The Project is (slowly) evolving -- we are currently at Version 2.0 (Version 1.x was developed in LabVIEW 7.0, this is the 2012/2014 complete rewrite, "Start from Scratch and Do it Right, or at least Better"). We are contemplating adding the ability to study sounds delivered via stereo headphones (varying the left-right loudness or adding a small time discrepancy between the channels), and would call this Version 2.1.
To try to prevent "Version Hell", we plan to make Versions "backward-compatible" -- we will add new columns to the Excel WorkBook for the new Headphone parameters, but set up the LabVIEW code to simply "do nothing" (with Headphones) if it reads a Version 2.0 WorkBook where these parameters are lacking. This lets us use Version 2.1 code to do a Version 2.0 Experiment.
One problem we are grappling with is how to read back and analyze or manipulate the resulting Data Files. For example, the Header File contains Version-specific sets of Data, which get parsed by the XML Parser and converted directly into a LabVIEW Cluster. Thus a Version 2.0 file needs to be read by code that "knows about" a Version 2.0 Trial Cluster, while a 2.1 File needs a 2.1 Trial Cluster.
When I read the Header File, the first thing I encounter is the Version Number (e.g. 2.0 or 2.1). Knowing this, I could, in principle, use a Case statement to call a Version 2.0 or Version 2.1 Analysis routine. But I'm trying to "avoid a mess", and Project Libraries seem like a good way to go, if I can figure out how to use them properly.
[At this time, I should say that I tried a small experiment -- I created a new Project, built Library1 inside a Library1 Folder with a "Hello" and "Testing", built Library2 (inside folder Library2) with "Hello" and "Testing" (different), and called them from the Top Level. Worked fine. I then "took a short cut", and copied the Library1 folder (outside of LabVIEW) to Library3. When I told the Project to add Library 3, I got a mess of Conflicts, which I couldn't resolve. And I "broke" LabVIEW -- even after deleting all of the .lvlib and the .lvproj files, I could not create a Project and do an Add Folder (Snapshot) without an Missing File error popping up. I made the Experiment using LabVIEW 2012 -- this problem affected not only LabVIEW 2012, but also LabVIEW 2013 and LabVIEW 2014, but not LabVIEW 2011. I've talked with NI Support, who also are mystified. I'm currently working in a new VM until I can get LabVIEW "repaired"].
What I would like to do is to identify all of the Version-specific routines in my Analysis folder, and include in this folder the TypeDefs for the Version-specific parts of the Data. I would then "encapsulate" all of this into a Version 2.0 Project Library. The code "on the Outside" would have its own copy of the TypeDefs (it could use the "latest Version", as the outer routines are supposed to be "backward-compatible".
So here are my questions.
I apologize for the long-winded nature of this question. I did look for tutorials on Project Libraries (there are some), but none covered this topic. To repay your patience, I'm happy to write this up and submit it to NI for a future White Paper on Project Libraries -- whom would I contact?
Bob Schor
P.S. -- Moderator -- if this belongs in another Forum, feel free to move it.
Solved! Go to Solution.
02-17-2015 02:33 PM - edited 02-17-2015 02:34 PM
a "Save As" of the library from Project Explorer should be the first thing you try. Never from Windows explorer! the lvlib will not know the member's locations changed, the members will think they belong to the parent lvlib, and you'll break things
Altrnately, if you are going to do a lot of these, use a library template and stick it in New...
02-17-2015 02:37 PM
Boy, did I ever Break Things! I think I know how I broke them, but haven't (yet) found how to "repair" my 2012, 13, and 14 versions of LabVIEW. At least it isn't "contagious" (the files, with the .lvlib and .lvproj removed, can be safely opened on other LV2012 installations).
02-17-2015 02:39 PM
Jeff, am I correct that this is the answer to Question 2, namely "Now that I have one library, how to I make a copy as another Library that I can modify as appropriate?"? (I rarely get the chance to have two Question marks in a row ...)
BS
02-17-2015 03:37 PM
@Bob_Schor wrote:
Boy, did I ever Break Things! I think I know how I broke them, but haven't (yet) found how to "repair" my 2012, 13, and 14 versions of LabVIEW. At least it isn't "contagious" (the files, with the .lvlib and .lvproj removed, can be safely opened on other LV2012 installations).
Just remember that the lvlib knows its members and where they reside. and library members know the library they belong to. Auto-populating folders are not your friend! use only virtual folders! if you do want to make some sub folders on disk "save as"...the source files to the new project/lvlib first, then move the members from the Project Explorer files view (That way the lvlib and the members get updated with the new locations) Better yet, do a source distro of the original lvlib.
Resolving those conflicts you created is not easilly done. You are likely better off deleting them and starting again the right way. AND Don't forget to stop using auto-populating folders! Even project templates don't work right with Auto-pop folders (Unless that got fixed in 2014)
02-17-2015 03:54 PM
@JÞB wrote:
Just remember that the lvlib knows its members and where they reside. and library members know the library they belong to. Auto-populating folders are not your friend! use only virtual folders! if you do want to make some sub folders on disk "save as"...the source files to the new project/lvlib first, then move the members from the Project Explorer files view (That way the lvlib and the members get updated with the new locations) Better yet, do a source distro of the original lvlib.
Resolving those conflicts you created is not easilly done. You are likely better off deleting them and starting again the right way. AND Don't forget to stop using auto-populating folders! Even project templates don't work right with Auto-pop folders (Unless that got fixed in 2014)
I never use auto-populating folders! Let me see if I understand the steps you are outlining.
Does that sound right? I'm actually getting ready to do something like this (in a VM, so I don't hurt myself too badly), but if there's a detail I've missed, now would be a good time to hear about it ...
It's actually pretty logical and consistent, so once I do it the "right way", I'm unlikely to make this mistake again!
BS
02-17-2015 04:14 PM - edited 02-17-2015 04:19 PM
On the money Bob! Save As... Duplicate heirarchy to new location (Requires that the new library has a new name)
To convert a virtual folder to a lvlib just create a new lvlib in the project and move the desired project members into the new lvlib Project Explorer does the rest of the nitty gritty work about saving the lvlib members with the new ownership information. (You will be promted to save the members when the membership changes)
And yes, That's the kind of mistake you don't make twice. And, believe it or not, I've had this type of issue used to justify not using projects! "they are too much of a hassle when you muck around in windows explorer" Then I asked them if the ever borrowed their father's car and didn't tell him you parked it over on the next street. They use projects now.
02-17-2015 04:54 PM
Thanks, Jeff. I always learn something from you (and a few others, it shouldn't go to your head ...).
BS
02-18-2015 07:11 AM - edited 02-18-2015 07:15 AM
@Bob_Schor wrote:
Thanks, Jeff. I always learn something from you (and a few others, it shouldn't go to your head ...).
BS
I won't let it swell my head but, its not often that I get a solution from a forum heavy hitter so, I'll cherish the mark. Stay well!
04-02-2019 10:57 AM
Thanks to all,
This idea let me do something I have had trouble with. I have an instrument driver where all of the functions reside in a library. I want to use the entire project to seed a new driver for a different instrument, as some but not all functions are common.
It is three steps along the same the same lines as the above discussion to achieve this.
Step one:
Save the project: Save as\Duplicate LVPROG file and all its contents... This creates a new project with the existing library.
Step two:
Open the new project and right click the library. Select save as\copy and click the add this copy to the project check box. Now you have the two copies of the VIs in two separate libraries
Step three:
Right click the old library and select remove from project. Now I can modify VIs in the new library as required without affecting VIs that reference the old library.
Can't tell you how much time I wasted trying other ways to achieve this. Thanks for the idea.
Andrew