Error Reading a Shared Variable Array
Hi,
I am having a problem reading an array of 20 unsigned integers from an Allen Bradley ControlLogix PLC with Labview.
I have set up a shared variable for this purpose. I have set the Data Type of the shared variable to ArrayOf Unit16. The Variable Type is Network-Published, and I have check the Bind To Source checkbox. I think my problem is in the shared variable path. I have tried the following with no success:
MyComputer\ControlLogixTags.lvlib\RsLinx\ProjectX\Online\Faults\Faults
MyComputer\ControlLogixTags.lvlib\RsLinx\ProjectX\Online\Faults\Faults[0]
MyComputer\ControlLogixTags.lvlib\RsLinx\ProjectX\Online\Faults\Faults[]
MyComputer\ControlLogixTags.lvlib\RsLinx\ProjectX\Online\Faults\
MyComputer\ControlLogixTags.lvlib\RsLinx\ProjectX\Online\Faults
I have created a simple vi for testing. I have wired the shared variable to an indicator which is an array of UInt16 items. When I run the vi, I get an error which says "Error 91 occurred at Variant to Data in Text.vi. Possbile Reason: The data type of the variant is not compatible with the data type of the input."
Does anyone have a suggestion as to what I am doing wrong?
Thanks in advance for your help,
Phil
Phil,
In order to determine that you can correctly communicate with your OPC server, I would suggest creating a shared variable bound to a single tag. It sounds as if you already have an RSLinx I/O Server in your project library. Now you can create a new shared variable and use the browse option to browse the items of your I/O server. Be sure to select a tag that has a known value such that you can verify successful communication.
Also, does your VI utilize a dynamic data conversion? The error code mentioned (error 91) is normally associated with this data type. Our next step will be to look at this VI once we can establish successful communication. I hope this was useful for you. Please let me know if I can be of further assistance.
Mike
National Instruments
Applications Engineer
Similar Messages
-
Error codes for shared variables in Labview 8.5?
I am trying to use Shared Variables in Labview 8.5 to enable real-time loops (similar to some of the examples in "Using the LabVIEW Shared Variable", published Aug 28, 2007). I created it to hold the result of a 16-channel A/D converter (so a 16-element I16 array). To avoid losing samples, I used buffering, with a buffer of 5. To test this, I made a pair of VIs, one a producer that stuffs a 16-element I16 array into the shared variable "every so often" (controlled by a timed loop), and a consumer loop that reads the shared variable and does something with the data.
If I think of the buffered shared variable as a Real Time FIFO (as the article suggests it is), I was curious how I would know (a) when the queue was empty, and (b) if the queue had overflowed. Both are necessary if this is to be a practical means of exchanging data -- you want the producer and consumer to run more-or-less at the same rate, but only the producer is deterministic. The consumer needs to be able to run "faster" if it falls behind (for example, because it is writing data to disk), but you don't want it to read data from the shared variable if there's nothing there. [One can always read a shared variable, after all -- as the article states, it simply "holds" the last value written to it].
Snooping around, I discovered that there are "error codes" associated with the shared variable. In particular, a code of -2220 (FFFFF754) seems to signify an empty queue (or a shared variable that has not yet been written to), while a code of -1950678981 (8BBB003B) appears to be "buffer overflow".
Is this documented anywhere? Are there other "error codes" that would be helpful to know? Is there some rationale to these seemingly-random numbers? [It would help to develop code to utilize shared variables if there was a bit less "magic" and "mystery" involved].
For what it is worth, with a buffer of size 40, I could generate 16 I16 values at 1 KHz (simulating sampling from a 16-channel A/D at 1 KHz) and pass it to a consumer node that (a) read from the shared variable until it was empty, then (b) "went to sleep" for 20 msec (simulating "doing something else non-deterministically"), and not miss any data (because I could then empty the Shared Variable RT-FIFO, which should have been half full, before it overflowed on me). Not bad throughput -- I bet I could push it even higher.
Bob SchorHey Bob,
The errors are documented in the LabVIEW help:
Shared Variable Error Codes
Real-Time Shared Variable Error Codes
There are several error messages for buffer underflow/overflow depending on the settings of the network or RT FIFO buffers. In particular the -2220 and -2221 are useful for the producer/consumer use case. For example (as you probably know) the consumer can flush a variable using the error code (see the attached image).
Gerardo
Attachments:
variable1.png 3 KB -
Read LabVIEW shared variables ( network variables?) with VB6
Hi, i need to read some LabVIEW shared variables (network variables?) using a VB6 program.
Is it possible?
I think that yes, using Measurement Studio for VB6 but I don't know how and I haven't found information in the Measurement Studio for VB6 help file
Could some one send me a program example or explain me how it is possible to read LabVIEW shared variables fromVB6?Hello quintella,
To be able to interface with LabVIEW
Shared Variables with Visual Basic 6 you will need to use NI Measurement
Studio, which ships with examples on how to use VB6 with DataSocketing. Apart
from Data Sockets, if you are using Measurement Studio 8.1 or higer, with the
Network Variable Library introducted in NI Measurement Studio 8.1, you can read
and write to shared variables in ANSI C, Visual Basic .NET or Visual C#. (http://zone.ni.com/devzone/cda/tut/p/id/4679)
Here you have two links where you can
find more information about how to use the datasocket option. In addition, there
are several examples included in Measurement Studio with Network Variables and
Datasocket.
http://forums.ni.com/ni/board/message?board.id=230&message.id=2945&requireLogin=False
http://forums.ni.com/ni/board/message?board.id=230&message.id=3324&requireLogin=False
Regards, -
I am passing data between a PXI RT Target to a PC Host using Shared Variables. Everything passes correctly between the Host and the Target, but Shared Variables that are arrays do not pass between the Target and the Host. Single elements whether boolean, numeric, or string pass from Target to Host with no problem. I use NI Distribution Manager to examine Shared Variables. How can you find the content of a Shared Variable that is an array, without writing my own VI?
This tool doesn't give me any more information than the Dist Sys Mgr. The SVs that are working show quality "good" vs "no know value" for the SVs that are not working.
My network-published SVs are single-writer 1D arrays (U32/SGL) of varying sizes (64-1005).
When I write to the SV I get error -2147024891 with the source being \\My Computer\Lib\mySV\\xxx.xxx.xxx.xxx\Lib\mySV where xxx.xxx.xxx.xxx. is the IP address of My Computer.
When I read the SV I get warning -1950679044with the source being \\My Computer\Lib\mySV\\xxx.xxx.xxx.xxx\Lib\mySV where xxx.xxx.xxx.xxx. is the IP address of My Computer. I get this warning when I'm reading the SV either from the target or the host.
I've checked the properties pages for the SVs and I don't see how LabVIEW is interpreting the network path twice. What could be causing this?
Also, if I delete a SV from my library of SVs it still shows up in the Dist Sys Mgr until I restart LabVIEW. Why? -
Error programmatically deploying shared variable lvlib from an installed app
I'm using shared variables in my app. According to what I've read, I need to deploy the lib programmatically using the app invoke node deploy library. I do this and it works fine for the app exe on my machine. But then I created an installer and tried it on a "virgin" machine and I get a "error 1 at invoke node" saying "an input parameter is invalid." I added an indicator that shows the lib file path I'm using and it's fine. I had left the target IP addr unwired but I also tried 127.0.0.1 just in case. Any ideas what's going wrong here?
Hi:
If including the SVE installer didn't resolve the issue then it looks like there are some other possibilities that are discussed in the following forum threads. Not sure if you've seen these yet, but hopefully they will help.
http://forums.ni.com/ni/board/message?board.id=170&message.id=240865
http://forums.ni.com/ni/board/message?board.id=170&message.id=230033
http://forums.ni.com/ni/board/message?board.id=170&message.id=249345
Message Edited by A Person on 03-23-2009 02:40 PM
Message Edited by A Person on 03-23-2009 02:40 PM
Alex Person
NI-RIO Product Support Engineer
National Instruments -
Slow performanc​e to read/write shared variables programati​cally
We are using datasocket read and write functions to read and write shared variables programatically (in the same machine) but we only achieve a performance of aprox. 200 reads/writes per second. We are using Labview 8.6 with DSC.
Is possible to get better results? That performance is normal?
Any help would be appreciated. Thank you in advance.Hi MMCDAT,
I think this value can
be normal as you can see in this link:
http://zone.ni.com/devzone/cda/tut/p/id/5037
As you can see, the
limit for datasocket depends on your Ethernet limitations, even if you as using
it just in one PC:
http://digital.ni.com/public.nsf/websearch/6AC9E65734E53F9A8625672400637ECC?OpenDocument
You can improve the
performance changing the update mode or Vis configurations:
http://digital.ni.com/public.nsf/allkb/F8F7DE98856B50588625672400648045?OpenDocument
http://digital.ni.com/public.nsf/allkb/2D9C6D73A160537986256B290076456E?OpenDocument -
Error connecting to shared variable OPC item
I have a DSC application that has a bunch of shared variables. Some of those variables are bound to an OPC server(Eurotherm). When I place controls or indicators in a VI and bind them to the shared variable, some of them get the "green light" and some of them get the "red light". If I hover over the red light, there is a message about an error connecting to the shared variable. However, all the values update and appear to be working correctly. Why would I get this error?
Hi Brian,
Which version of the DSC Module is this? Is the OPC Server that you are trying to connect to on your local machine or on a remote machine?
Have you tried deleting the front panel object and redragging it from the project explorer? What type of value is this (boolean, double, etc?)
What are you referring to when you mean an "identical instrument" - are you connection to two different OPC I/O servers in your projects?
Would you be able to post a screenshot of this error please?
Best regards,
-Sam F, DAQ Marketing Manager
Learn about measuring temperature
Learn how to take voltage measurements
Learn how to measure current -
VBAI: how do I read a shared variable?
I am trying to make my inspection to do things that are contingent on the value of Shared Variables. It is obvious how to set the Shared variables from VBAI, but I have not figured out how to read them and then create some kind of a CASE structure using that variable.
Any ideas on how to implement such an architecture?
Solved!
Go to Solution.I would create two different states and use transitions that are based on the shared variable value. You can read the value of variables or previous measurements in steps that allow this (not all steps do, but most do) or transitions. To create a new state, go to the state diagram (click on the "Toggle Main Window View" so the state diagram is in the main part of the window). Right click in an empty part of the state diagram and select "Create New State".
To create a transition, right click on a state and select "Create New Transition" and drag the transition to the new state.
To edit the transition, double click on it and you will be able to select the shared variable as the measurement, along with comparison operations to make the decision. If this comparison evaluates to False, the Default transition will be taken instead.
Select Help>>Show Context Help while editing the state diagram to get more details on how to use it.
Hope this helps,
Brad -
Error with the Shared Variable Engine
Hi,
I have a problem with the Shared Variable Engine,
A .doc File is attached to this message, decribing the problem with pictures.
I will be glad if anyone can help me.
Sincerely yours
Amitai Abramson
Attachments:
Question.doc 819 KBHi Amitai,
Good afternoon and I hope your well.
A member of the team from NI Israel contacted me regarding this post.
I want to provide you with extra details on how to resolve your issue - i.e. Repair (Or Re-install) the Shared Variable Engine.
If you use the MsiBlast Tool it will populate a list of all MSI NI Installers. One of these will be NI Variable Engine. On the right-hand side you can the click 'Repair'. I would also Repair the engine support for the versions of LabVIEW you have installed. Please see attachments for MsiBlast and a screenshoot of the MSIBlast screen.
If this doesn't work I would recommend re-installing LabVIEW using the following guide, which I posted on this forum. (second post by me).
Please let me know how you get on,
Kind Regards,
James.
Message Edited by Hillman on 12-03-2008 12:19 PM
Message Edited by Hillman on 12-03-2008 12:19 PM
Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help!
Attachments:
Repair Shared Variable Engine.JPG 97 KB
msiBlast.zip 110 KB -
Error -195067896​5 Shared Variable
I have a VI that reads a SV array. If I just plop this down on a blank vi and hit the run key it works fine with no errors. But when I put it inside of a loop it runs once then gives me this error. It doesn't matter how long of a wait I put into the loop. I've tested it as long as 5 seconds and it always errors after the 1st iteration. If I just run it manually I can hit the run button as fast as I can it does not error.
PaulG.
"I enjoy talking to you. Your mind appeals to me. It resembles my own mind except that you happen to be insane." -- George OrwellThere is bug fix 130186 for this error
-
Data Logging a programmatically created shared variable of cluster or array datatype into citadel DB
Hi,
Is there a way to log a programmatically created shared variable of cluster or array datatype into citadel DB?
I have attempted to programmatically create a shared variable of type 'double' and was able to successfully log the same into Citadel DB. In the attachment, Please refer to the attached project SV_TC.lvproj and specifically to SV_W.vi for the code that i have used (W.png file shows the dB in MAX and shared variable in NI Distributed System Manager)
However when i tried the same approach to create a shared variable 'array of double', i noticed that traces are not getting created and hence data logging isn't happening into the Citadel DB. I was however able to write and read the shared variable array without issues. The same is true with cluster datatype also. Please refer to SN_NW.vi for the code that i have used - only difference from SV_W.vi is that i have tried to create a shared variable of type 'array of double'
One observation is that if i create an 'array of double' or cluster in a shared variable library using the project explorer and deploy, i could see that these being logged into Citadel DB.
Hence i want to understand what could be done to achieve the same programmatically? Could you please advice?
Regards,
Sridhar
Attachments:
SV_TC.zip 3925 KBWhy is the transaction happening over remote?
Because we need the information to be on our database immediately when they submit it.
I don't know anything about streams or replication.....
The web database is run by the company that hosts our web site. We use PL/SQL to show the pages and output the html. It fetches the data the customer is requesting from our database, but I'm struggling to get the best way to insert into our database from there. -
Unable to read shared variable in signal express
Dear all,
I am trying to read a shared variable with data type 'Array of Double Waveform' and the signal express gives a network variable error stating
"The data type of specified shared variable xxxxxx is not supported".
could any one explain why is this not supported or suggest a work around.
Munir.
Attachments:
Untitled-1.jpg 66 KBHi Munir,
the datatype you want to use is not supported in Signal Express. So if you choose this datatype you always get this error massage. As a work around I can recomment you to take the Double Waveform datatype this is supported, create a shared variable for each array element (waveform) and read this variable in Signal Express. This should help you out.
If you got any questions feel free to ask me.
Regards
TomBaum -
Problem with dsc shared shared variables and error 1950679023
I'm having trouble using shared variables on my laptop PC (with Windows XP) using Labview 8.2 and DSC. I've set up a simple project with one VI and one shared variable library. In the VI, I have a while loop that writes a number from a front panel control to the shared variable. Another loop running in parallel reads the shared variable and displays to an indicator on the front panel. The VI resides on my PC (no remote targets). This program executes just fine on my desk top PC; however I get the following error codes out of the shared variable nodes when I run the project and VI on my laptop for the write and read, respectively: ni_tagger_lv_Write 180121604 ni_tagger_lv_Read -1950679023 I've tried to manually deploy the shared variable library without success. The NI knowledge base and other entries on this forum suggested that the Windows firewall should be disabled for a quick fix, however, the firewall was already disabled on my lap top. I didn't see any entries regarding the 180121604 error code.
Any suggestions would be appreciated.The problem has mysteriously gone away. For about the 10th time, I manually deployed the share variable library, and it started to work properly.
-
hi ,
im having problems reading a shared variable value from a vi ,
i created a project library , periodic i/o server deployed it. created the shared variables i needed . bound them , created my new vi draged the shared variable i wanted to read , just a time value , set it to a indicator , then ran the two vi s the triangle has apeared on both the main vi and the hmi vi ,and is green , no conflicts arose , but the hmi vi isnt displaying the data ,
both vi s are on the same computer , have i missed somthing ,?Hi Vadajooz,
Good Morning and I hope your well today.
I was wondering how you got on with your application and if you still require support?
If so, I would be interested to know what version of LabVIEW you are using?
I would make two simple VIs, one to write to the variable and one to read from the variable.
1. Create the bound variable.
2. Deploy the library, make sure it appears in the Distributed System Manager (DSM - LabVIEW 8.6+) or Variable Manager (LabVIEW 8.5 - ).
3. Run the writer VI, for example, just have a switch (true/false) and when you change the switch state does the status update in the DSM or Variable Manager?
4. If so, then run the reader VI, is the status matching the writer and there DSM/Variable Manager.
*DSM/Variable Manager can be found by going to tools>>... in the VI toolbar.
If you are still having problems,
A. There is a known issue with bound variables in LabVIEW 8.6 - so I can inform you on this if you are using it.
B. I would confirm that the variable is deployed - to do this right-click the library and select Deploy All.
C. Make sure you write to the variable before reading from it.
D. Add error cluster indicators and note any errors you see.
E. Please attach your simple (test) project - so we can confirm its correct.
I hope this helps,
Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! -
Weird delay reading shared variables
Hello,
I'm working on a project were I'm monitoring some prodution lines. I'm using DSC module's OPC server to connect to PLCs on the production line and I've created bound variables on my labview project of the PLC's tags.
On my project I have one main VI were I show information about the production lines and were I can access several subVIs were I show other information about those lines. Then I have a VI that is running in background were I'm reading about 50 shared variables from the PLC and where I'm registering some data in a MySQL database, datalogging data on the Citadel database and registering alarms.
The problem I'm having is that on the VI that runs in background I noticed a delay reading the variables that are reading containers weights from the production line. It seems that all the other shared variables don't suffer any delay, only the weight variables start having some delay when the values are increasing. It also seems like that, when I'm only running that VI alone, without running the main VI, there isn't any kind of delay. I'm reading the shared variables as shared variable nodes.
Can anybody help me understand what's happening and how can I fix this delay? The VI that runs in background is time critical and a weird delay like that messes up my data.
Solved!
Go to Solution.Hi Mateus23,
The shared variable has various buffering capabilites, including integration with the Real-Time FIFO feature in LabVIEW Real-Time.
I guess that the buffering settings are causing the unexpected behavior.
Check these resources:
Buffered Network-Published Shared Variables (whitepaper)
Shared Variables Properties Dialog
- Network Page
- Real-Time FIFO Page
~~
Maybe you are looking for
-
How do i find the url for my iMac
How di I find the URL for my iMac?
-
IPod nano Shuts Down my Windows 7 in the middle of syncing
What the heck... I received this iPod Nano as a gift, moved all of my items into iTunes, only to have it repeatedly shut down my PC mid-sync. I've seen this issue in threads dating back to 2010, but I haven't been able to find any posting that actua
-
Itunes literally freezes every 10 seconds doing anything
Itunes literally freezes every 5 seconds, anything that i click on eg. music, deleting a song, renaming a song, clicking on the movies tab, basically any basic function of clicking something on itunes. It freezes up for 10-15 secs then works again. A
-
Multiple .jar in libary directory
Hi. My application is using more and more libraries that are packed as jars. Is there anyway to include all jar files in applications /lib when executing the program whit out that every jar must be declared in the classpath...
-
Configuration Assistant FAILED during Oracle 10.2.0.1.0 g installation
The Configuration Assistant Failed during set up. Can someone tell me how to resolve this problem. My reading reveals that I can use the database, however, it may not function properly? What should I do?