Jump to content

Recommended Posts

Hello Everyone,

I have created this feature to create named variables of any data type in memory and access its value from any part of data code which is under same scope using its name.
This variables stores instantaneous value. Best use case of this toolkit is acquire data set variable values & read from any loop. Do not use for Read-Modify-Write
Once variables are created in memory, you can be grouped them and access its values using names.
You can create variable for any data datatype & access its value using its Name. I have tested this toolkit for memory & performance, which is much faster than CVT & Tag Bus Library

Please check and let me know your suggestions. use LabVIEW 15 sp1

BR,
Aniket Gadekar,
aniket99.gadekar@gmail.com

DataVariableToolkit.zip

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for your contribution.  A couple of things.  Using polymorphics for this type of thing can become a pain pretty quickly.  I had a similar thing for reading and writing variant attributes and used scripting to generate the 60+ data types I supported.  But even then there were times that the data type wasn't supported.  This also added 120+ extra VIs (read/write) adding to loading overhead.  The more modern way of doing this is with a VIM that adapts to the data type provided.  Your VIs were saved in 2015 when VIMs weren't an official thing, but you say you use 2018 where it is.  Back then I'd still support doing this data type adaption with XNodes.  Posted here is my Variant Repository which does similar read/write anything including type def'd enums and clusters.

Putting these in a global space that any VI can read and write from is pretty trivial.  All that is needed is a VIG, functional global variable, or even global variable in a pinch.  This will keep data in memory as long as the VI is still in memory and reserved to be ran.  This has other benefits of easily being able to load and save data from a file since it is all contained in a single place.  Also with this technique there are no references being opened or closed, so no memory leaking concerns.  Performance-wise I also suspect your method may have some room for improvement.  If I am writing 10 variables 10 times, looking at your code that will mean 100 calls to the obtain notifier, 100 calls to the send, and 100 calls to the release notifier.  I suspect reading a variant, and then calling the set attribute 100 times will likely take less time and processing power.

Share this post


Link to post
Share on other sites
14 hours ago, Aniket Gadekar said:

I have tested this toolkit for memory & performance, which is much faster than CVT & Tag Bus Library

So I took a quick peek, nothing too detailed, but from what I saw there is pretty much no way this is unequivocally faster than the CVT or the tag bus. With the CVT it might be possible this approach is faster if you give it the worst possible load (10000000 simultaneous readers, each of which is reading a random, constantly changing name), but in any sane case you'd lookup a reference beforehand and then write to those, and the write time is bounded at basically the same performance as any reference-based data access. For tag bus...its literally just a cluster with an obscene number of different data types in big arrays. Data access is just indexing an array. There is no way in labview for data access to be faster than indexing an array. In contrast you are obtaining a queue by name which involves several locks, doing a lookup, and writing to the queue which requires another lock. The CVT only needs 1 lock and tag bus requires zero. Memory I'll give you.

Its also worth you looking at this:

 

Share this post


Link to post
Share on other sites
21 hours ago, hooovahh said:

Thanks for your contribution.  A couple of things.  Using polymorphics for this type of thing can become a pain pretty quickly.  I had a similar thing for reading and writing variant attributes and used scripting to generate the 60+ data types I supported.  But even then there were times that the data type wasn't supported.  This also added 120+ extra VIs (read/write) adding to loading overhead.  The more modern way of doing this is with a VIM that adapts to the data type provided.  Your VIs were saved in 2015 when VIMs weren't an official thing, but you say you use 2018 where it is.  Back then I'd still support doing this data type adaption with XNodes.  Posted here is my Variant Repository which does similar read/write anything including type def'd enums and clusters.

Thank you for your attention & time. I think using variant data type you can read/write any data type. Also, Most of the users are still using LV2015 so i kept this code in 2018. 

 

21 hours ago, hooovahh said:

Putting these in a global space that any VI can read and write from is pretty trivial.  All that is needed is a VIG, functional global variable, or even global variable in a pinch.  This will keep data in memory as long as the VI is still in memory and reserved to be ran.  This has other benefits of easily being able to load and save data from a file since it is all contained in a single place.  Also with this technique there are no references being opened or closed, so no memory leaking concerns.  Performance-wise I also suspect your method may have some room for improvement.  If I am writing 10 variables 10 times, looking at your code that will mean 100 calls to the obtain notifier, 100 calls to the send, and 100 calls to the release notifier.  I suspect reading a variant, and then calling the set attribute 100 times will likely take less time and processing power.

I tried to avoid FGV in this feature/toolkit due to some limitation of it. If you wanted to load/read variables from file you can develop that logic outside. I think obtaining queue/notifier reference, set value & close reference for 100 times is much cheaper than calling FGV 100 times. I saw your "Variant Repository" and it was nice, But each time you have to connect wire and pass data in subVI's, to perform read/write operation. Where as in my toolkit you don't have to at all. :)

Again, this feature can store large data also and can be accessed by Named reference.

Please let me know if you have any suggestions.

Share this post


Link to post
Share on other sites
13 hours ago, smithd said:

So I took a quick peek, nothing too detailed, but from what I saw there is pretty much no way this is unequivocally faster than the CVT or the tag bus. With the CVT it might be possible this approach is faster if you give it the worst possible load (10000000 simultaneous readers, each of which is reading a random, constantly changing name), but in any sane case you'd lookup a reference beforehand and then write to those, and the write time is bounded at basically the same performance as any reference-based data access. For tag bus...its literally just a cluster with an obscene number of different data types in big arrays. Data access is just indexing an array. There is no way in labview for data access to be faster than indexing an array. In contrast you are obtaining a queue by name which involves several locks, doing a lookup, and writing to the queue which requires another lock. The CVT only needs 1 lock and tag bus requires zero. Memory I'll give you.

Its also worth you looking at this:

 

Thank you for your kind attention & valuable time.

I checked this functionality, In this you are using Queued message handler to request for read/write. I thing it will increase latency to read/write variable if there are many request. We never know how many times developer will call read/write operation. So instead, I obtained reference directly without any message request. And VI Register uses implementation similar to FGV, which i tried to avoid.

This toolkit strictly not used for Read-Modify-Write operations, Since each feature can have pros-cons. Again, Thank you for your time. Please let me know if you have any improvement suggestions.

:)

Share this post


Link to post
Share on other sites

Aniket, thank you for posting this and congrats on starting your journey with lavag 🙂

Share this post


Link to post
Share on other sites
1 hour ago, Neil Pate said:

Aniket, thank you for posting this and congrats on starting your journey with lavag 🙂

You are welcome Neil. :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Similar Content

    • By David Akinpelu
      I am implementing a TCP connection between MyRio(client) and Python(server). The goal is to send data from the server to the client, perform some calculations, and send the result to the server. I need to keep changing the data being sent to the client. I noticed the first data works fine and the result returned to the server, but the client could not read subsequent data. I debugged and was able to detect that the error is coming from the first read function is the "Reading values subvi"  but I don't know how to correct it. How do I go about it?
      I have attached the files below.
      Reading Unknown Bytes from TCP.vi Second_client.vi SimpleServer.py
    • By Deon
      The Threshold Hysteresis VI allows an input (for example, a sensor) to drift out of an inner limit without generating an invalid flag, but if it drifts outside an outer limit it then becomes invalid. For the reverse, when the input crosses back into the outer limit it remains invalid until the value falls inside the inner limit.
      For simplicity, only one input parameter is provided for both the inner & outer limits, and is negated for the lower limit, as generally tolerance limits are equidistant from the nominal.
    • By Deon
      View File Threshold Hysteresis v1.0 LV8.6.1
      The Threshold Hysteresis VI allows an input (for example, a sensor) to drift out of an inner limit without generating an invalid flag, but if it drifts outside an outer limit it then becomes invalid. For the reverse, when the input crosses back into the outer limit it remains invalid until the value falls inside the inner limit.
      For simplicity, only one input parameter is provided for both the inner & outer limits, and is negated for the lower limit, as generally tolerance limits are equidistant from the nominal.
      Submitter Deon Submitted 11/10/2014 Category General LabVIEW Version License Type  
    • By jossie
      Hello I am quite new to labview and I have some questions regarding labview. We have came up with a simulation build in labview as shown in the folder. However, we will be making use of Myrio to connect current and voltage sensors to send the data to labview when labview is running. We are currently having difficulties trying to search if it is possible to send the wave files and the popout messages ( messagebox.vi and Player2Wins.vi) to NI Dashboard for Labview in Ipad by using myrio. Is it possible for myrio to store wave files and the additional VIs and sending these to NI Dashboard for Labview? 
       
      Otherwise, it is possible for Labview to send the entire program.vi, messagebox.vi and Player2Wins.vi to cloud and people are able to see the GUI in program.vi remotely? ( We have found information like Labview web services etc. We hope that people are able to view our GUI and press the " Press start" button as well as closing the popout messages in a website not from our local network). 
       
      I sincerely apologize if what I am asking does not make sense to people who are reading this. I hope that someone will help me with this as it is very difficult for me to do and I need some guidance from people who are familiar with these. Thanks for taking your time to read and your reply. 
      Simulation_Build_(3).zip Pop-up_Message.vi Player2Wins.vi
    • By edupezz
      Hello, i created a new tips repository in:
      https://edupez.com/
      English and Portuguese
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.