VBAI: How to read a shared variable?

I'm doing my inspection to do things that depend on the value of shared Variables. How to set the VBAI Shared variables, it is obvious, but I didn't understand how to read them and then create some kind of a structure of MATTER using this variable.

Any ideas on how to implement such an architecture?

I create two different States and use the transitions that are based on the value of the shared variable. You can read the value of the variables or the previous measures in stages that allow this (not all stages, but most don't) or transitions. To create a new State, go to the state diagram (click on the 'toggle window view hand' so the State-transition diagram is in the main part of the window). Right click in an empty part of the state diagram and select "create a new State".

To create a transition, right-click on a State and select 'Create a new Transition' and drag the transition to the new State.

To change the transition, double click it and you will be able to select the shared variable as measurement, and comparison operations to make the decision. If this comparison is false, the default transition is taken instead.

Select help > Show context Help if you change the schema of the State for more details on how to use it.

Hope this helps,

Brad

Tags: NI Hardware

Similar Questions

  • TPC-2012 cannot read the shared variable

    Hello

    I have a TPC-2012 and can not read variables shared with him. I welcomed the shared on a cRio-controller Variable. On another PC, the variable is read correctly, but not on the tpc-2012. What can I do? No error message is displayed on the TPC-2012 (Windows CE 5). The PTC can not write values in a shared Variable.

    Thank you

    Christian

    What LabVEIW Touch Panel version do you use? I don't know why static variables do not work correctly on your device. TPC-2012 comes with support preinstalled for shared variables, and it would be possible that it has been deleted or corrupted. Here are some steps you can follow:

    Install the Support of shared Variables
    How do we install the Support of Variables shared on the TPC-2012?

  • How to make a shared variable, which is an update on the host channel?

    Hi all

    I'm relatively new to LabVIEW, so I apologize in advance.  I'm working on a vision for research application and I'm trying to convey an image of the smart camera target to the host.  I flattened the IMAQ image to a string and pass the string to a shared variable.  On the end of the host, I unflatten image and try to post to see if I don't really get the image data on the host.  However, it only displays the first image and after that the image is not updated.  In addition, the shared variable itself is not up-to-date.  I have a loop timed on the target and a loop of simulation on the host.  Help or direction would be appreciated.

    Thank you very much.

    I thought about it and will post here just in case it might help someone else.  For some reason, the IMAQ flatten channel gives a format that did not like the unflatten of the chain.  When I have no flat chain, it didn't recognize it as an image.  Instead, I just used the generic flatten the string on the target and then block when I have not flattened image on the host computer, I had to only give the guy I got to report the allocation of memory IMAQ.  Maybe I'm just slow, but if this helps someone else, fine.  Thanks again.

    mkillpack

  • How to choose which shared variables to read

    I am trying to clean up a code and I'm looking for style tips. The following code actually works as you wish, but I wonder if there is a more elegant way to do it.

    I have a number of variables shared playing of Modbus devices. The problem is that these can be disabled as needed. When the unit is off, all vi to try to read that variable sharing waits a time out, then gives an error.

    What I did is to put each read operation in a case structure and then have an array of Boolean to tell which ones is turned on (see screenshot). It works fine, but I wonder if there is a better way to do it?

    Thank you

    Mike

    Replace all the tables index and case with a single loop and use 'I' connected to a case to choose which variable to read.

    /Y

  • How to use the shared variables to address several Watlow controllers on the same COM port

    Hello

    I am using LabVIEW 2010 to control 4 Watlow temperature controllers on a port com 3 are model 96 and 1 is a zone EZ controller. The controller has a unique modbus address and I'm trying to read from and write in the individual records (for example, setpoint closed-loop) variable shared help. I would return the data during playback (even if the data is displayed as invalid), but I am unable to change the value in the registry in writing. How can I be sure that's the Modbus server send commands to the correct controller?

    Chuck

    Hi Chuck,

    Sorry for the delay in response, I was away last week. You can create as many servers for Modbus on one COM port that you would like, the only problem you'd see is if you tried to call the port from different locations at the same time. With respect to the documentation to cross, I'd start with the tutorial below for a comprehensive manual of Modbus. There are also quite a few listed under Datalogging and supervisory control Module help topics that may be useful if you want to solve specific issues.

    Introduction to MODBUS

    Kind regards

    Peter W.

  • How to sort the shared Variable libraries

    I have large libraries SV in my project I want to sort by variable name.  I tried to export to Excel, sort and then import them into the library, but the type did not appear.  It looked like loading each variable then the multiple variables Editor opens with the original (unsorted) list I pressed the fact and then is back to were I started.  Any ideas?

    "In LabVIEW, you can sort variables shared libraries by right-clicking on the library" arrange by "name.

  • Why cant a shared variable be read as a diagram in SignalExpress

    In SignalExpress I add a step to read a shared variable. I can display it in graphical mode, but not the graphics mode. Can someone explain why this is? I'm doing something wrong?

    Kind regards

    Frank Greenslade

    Christchurch

    New Zealand

    I found that the problem was the type of data. SignalExpress discovers double graph table.

  • How to access a shared on a remote device with a variable IP different during execution?

    I need expert advice. I need to do something that sort of violates the assumptions behind the model of variable communication shared LV I have to be able to read a shared variable since a cRio device when the IP address of the device is not fixed.  In other words, the IP address of the device is known only at run time. Is it still possible?

    The only way I can think that LV would be able to find variable motor device/shared on the remote device is by changing the alias the runtime file and then try to access the variable shared again hoping this will cause also the sv engine note the new IP address and use it.

    Hi Rob,

    Yes it is possible. There are several ways to do so, but here are two. If you have LabVIEW 2009, use the new features for programming of the shared variables in the data communication palette. These just have an address that you can determine at run time. The address is of the form ni.var .psp://machinename_or_ip/libraryname/variablename. Here is an example of selecting a name at run time using these features:

    If you are using a version prior to 2009, you can use DataSocket roughly the same way except that the address forms a little different - psp:\\machinename_or_IP\libraryname\variablename. These are also present in the same range of data communication.

    Either of these methods, you will get better performance if you open the connection once, write several times and close the connection when you are finished. You should avoid opening and closing of the reference variable whenever you want to access the variable.

    Good luck

    Gerardo

  • Read a session variable

    I set a session variable 'var1' in the pagedef using ADFUtil.setEL ("#(sessionScope.var1)", myValue);

    How to read this session variable, 'var1' in the select statement in a view object please?


    Thank you

    Do NOT attempt to access variables stored in a scope of application in a project to directly view controller in the Model layer. It breaks the MVC paradigm.

    For your use case.
    (1) create a display object with a view criteria that has a single binding variable.
    (2) has an AMImpl method that takes a single parameter and apply the criteria to view for the View object Instance in 1) by setting the value of the variable binding with the input parameter and to execute the View object and expose this method via the client interface.
    (3) use this method in the ViewController project and call the method.

    Thank you
    Nini

  • Shared variable RT FIFO (multi element) - read both

    Hi all!

    I'm trying to collect data from analog inputs on my cRIO with a time step of 1 second. For this I use a timed loop and a variable shared with RT FIFO active (several table of doubles). Along with the timed loop, I also use a while loop that is significantly slower (lets say 10 sec period) who must read all the berries stored in the FIFO and write it in a .txt file (everything is run locally on target RT). Is it possible to empty the shared variable RT FIFO at the same time, and if not how can I get a number of tables that are currently stored in a shared variable?

    What is the difference between one created using the palette of FIFO of Real-Time/RT and RT FIFO created by a shared variable? I prefer to use the shared variable instead of Real-Time/RT FIFO allowing also time stamp.

    Best regards

    Marko.

    Marko,

    We recommend that the nondeterministic loop run faster than your deterministic loop and remove samples when they become available. If you don't want to do this, you can simply place your RT FIFO loop for the value to perform 10 iterations and then put that in your loop. For more information about the differences between the RT FIFO and Variables shared with RT FIFO active, please see pages 32 to 35 of the CompactRIO Developers Guide link below.

    http://www.NI.com/PDF/products/us/fullcriodevguide.PDF

    I hope this helps!

  • Delay weird read shared variables

    Hello

    I'm working on a project were I am followed a few lines of production. I use an OPC server on the DSC module to connect to PLCs on the production line and I created variables related to my labview tags of the PLC project.

    On my project, I have a main VI were I show information on production lines and I can access several subVIs were I see more information on these lines. Then I a VI that runs in the background were I read about 50 shared the PLC variables and where I save data in a MySQL database, data entry of data on the database of the Citadel and the recording of alarms.

    The problem I have is that I noticed a delay read variables that read weight of containers from the production line the VI that runs in the background. It seems that all shared variables suffer no delay, only the variables weight start to make some delay when the values are on the rise. It also seems that when I run only one VI, without running the main VI, there is no any kind of delay. I read shared variables shared as variable nodes.

    Can someone help me understand what is happening and how can I fix this delay? The VI that runs in the background is time critical and a strange delay like that messes up my data.

    Hi Mateus23,

    The shared variable has various capabilites buffering, including integration with real-time FIFO functionality in LabVIEW Real-time.

    I guess that buffering settings are causing the unexpected behavior.

    Check out these resources:

    Buffer Network-Published static Variables (white paper)

    Properties shared Variables dialog box

    - Network Page

    - Page FIFO in real-time

  • How the shared variable affects determinism RT?

    I continue to read again and again that ' If you activate the FIFO in real-time to a shared variable, you can deterministically share data active without affecting the determinism of the screws on an RT target. "

    Could someone help me understand how shared variable affects RT determisim and how FIFO variable sharing does not work.

    Thank you!

    If you send something comes the RT to the host, you use the network, which is inherently not deterministic.

    To use an SV to maintain determinism, you want to stay on target to RT.  You would use this to pass the latest value of a loop to the other.  If you enable the FIFO, you create separate read and write the points so that you have not the same access point in both your curls deterministic and non-deterministic.  With this, you are able to maintain the determinism to nondeterministic loops the last value of a variable.

    The idea is that do not break the determinism of your deterministic loop while accessing these data elsewhere.  If you do not select the FIFO, you have a shared resource that may eventually block the deterministic loop and could potentially go beyond your jitter related.

  • How can I dynamically select the shared Variable API programming data type?

    I am trying to create a configuration of open connections of variable shared using the programming API. It seems to me that the cleanest way to do would be to put one "open and check" routine in a loop, then call it for each variable in the library.

    The question that I am running is that I have different types of data in my library (to help a server Modbus i/o and data types 'boolean' and 'single' in my library.) How can I dynamically select the data type of the shared variable API?

    See the attached snipit.

    Thank you

    What I ended up doing was doing a Subvi to open, read, write, and close each data type, I use the packaged in 4 polymorphic SubVIs (polymorphic Open, read, etc...)

    Now all I have to do I drop in the polymorphic Subvi and it switches automatically to the appropriate data type

  • Shared variable problem reading after deployment

    Hello

    I tried to create an OPC client to communicate with a server KUKA. I have a project with an i/o library configuration server. When I run the project, I can perfectly read/write my variables using the Distributed System Manager. If I put all the variables, I can read the correctly updated value at the server end. However, as soon as I start a VI that contains variables (which deploys them automatically), everything stops working and I can not write them to the VI or the DSM.

    I would be very happy if anyone knows how I could handle it.

    Best,

    Glauber

    OK, so it seems that the problem was that the request from the client to the server rate was too high. I added a wait on the loop that r/w, the variables and now this works. There is no need to be a single writer, and the autodeploy option can be.

    in any case, thanks to those who responded to the message.

  • Are published network shared variable write & read Atomic actions

    Hello

    I have a very basic question about shered (published network) variable.

    I think I know the answer already, but since I couldn't find in my documentation, I thought that it is more prudent to request...

    Are reading and writing on a shared variable of stocks Atomic?

    To be more precise: on my target real time I create an array with data (each element being the configuration item or a cluster containing name, value, and type) and when the table is finished I am this store in a published network shared variable.

    On my host (Windows), I'm voting (in a loop) until the table contains at least 1 item, when this is true I'm parsing all the elements in the table.

    Is there a chance that, reading of the shared variable, the table contains a subset of the original painting on RT target (i.e. the action of reading takes place while writing is still ongoing).

    Or is the action of reading delayed until the write is completed? (i.e. both write and read actions are atomic even over the network)

    I think the latter is true but not could find no evidence in the documentation.

    Kind regards

    SoC

    Hello Rob,

    Yes, you can access the entire value, data type - you use both. For the table data type, the integer value is actually the full picture. So, Yes, you can see reading and writing as Atomic actions.

    But, on the other hand, you can lose data if the RT system rewrites the variable before the host had the time to read. To avoid this, you can enable buffering for the variable. See the following links for more information:

    http://www.NI.com/white-paper/4679/en

    http://zone.NI.com/reference/en-XX/help/371361H-01/lvconcepts/buffering_data/

    Finally, you can also activate a FIFO RT on your target RT if you need to send data through the variable in a deterministic section of the RT. See also, more information:

    http://zone.NI.com/reference/en-XX/help/370622H-01/lvrtconcepts/rt_projectvariable/

Maybe you are looking for