06-10-2008 02:21 AM
08-11-2008 02:49 AM
08-17-2009 12:14 PM
Hi,
I am trying to programmatically create and add shared variable to an existing library. The problem is on opening the library, which I am ot sure if I'm doing it correctly. I am using an 'Invoke Node Invoke Method: Library: Open', and am taking the 'Library Refnum' to the 'Library Reference In' of the 'Add Shared Variable To Library' module. I am feeding the Invoke Node with the full path including the library name (....lvlib). error comes as Not a Refnum.
If this is not the correct way to do the above purpose, then what is it?
I actually have tried some other configurations, no luck yet!
Comments welcome.
08-17-2009 01:13 PM - edited 08-17-2009 01:16 PM
08-17-2009 01:55 PM
Wow. Talk about bringing back a thread that just turned 3 yo. It would have probably been better to make a new thread.
In response to the push of information to BUY a module just to have some of the functionality that NI should have just built into the Shared Variable Engine to begin with: Look into DataSockets as I found them much easier to use over Shared Variables (which IMO is kind of a mess). LabVIEW 2009 may have fixed some of this so that Shared Variables are more usable, but I haven't evaluated the new Shared Variable VIs.
08-17-2009 03:04 PM
Nickerbocker wrote:... Look into DataSockets as I found them much easier to use over Shared Variables (which IMO is kind of a mess)....
From what I can tell there are DataSocket Reads or write hiding inside those shared variable nodes but we just aren't allowed (empowered?) to change them. DataSockets on the other hand require you know a little more about URLs etc but are much more flexible.
Ben
08-17-2009 03:21 PM
@Ben - I see. I found Shared Variables to work well with two computers that both had a version of LabVIEW installed, but once you go into the world of executables and application distribution the complexity shot up. DataSockets, on the other hand, follow a simple server/client paradigm.
Seemed like if I needed FIFO Shared Variables extra "packaging" seemed like a better solution (such as a Waveform). However, if I was transporting boolean signals such that I'm really only interested in what is the "latest" value DataSockets worked a lot better for me. Ultimatly I prefer DataSockets though and try to avoid complex time sensitive data over the network.
08-17-2009 04:27 PM - edited 08-17-2009 04:30 PM
well, not sure about the last two comments,... I am using DataSockets as well anyway, for read and write access to the created Shared Variables (Network Published) from the multiple VIs.
For my paroblem above, a little better but not perfectly fixed yet, I had to completely open and close project and create library and save it everytime adding a new SV. It actually may be working (I see libaries and SVs in them on the Project Explorer), reason for not %100 sure: Now after run, I am having one of my multiple subVIs, actually the last one called to run, getting stock on resetting (the little window; resetting subVI:...)
I am suspicious to the closing project last time the last SV is added. the project is the same containing all VIs and libraries, does closing the project affect access etc.?
08-17-2009 04:45 PM
Ah, I seem to be able to fix this recent issue now... closing opened references,...
still question remains on whether there is a shorter approach to reference an existing library to add a dynamic number of SVs to it without having to open and close project everytime.
Cheers all,
Siamak
08-18-2009 10:04 AM
Hi,
Attached VI is capable of creating SVs and adding them to the defined Library in a project.
I have taken different approaches including simple DataSocket (open, read, close) and also DataSocket Server to write into the SVs and read them from different VIs, tried different URLs, none worked! on the diagnostics with Shared Variable Monitor, can not see written values, however it shows access is being made to the created SVs.
Not sure where it goes wrong yet,
Comments welcome.
Sia