09-20-2019 02:15 AM
I want to know about DATA VALUE REFERENCES in LabVIEW .. where it is mainly used.
Help me out if you can
Solved! Go to Solution.
09-20-2019 03:56 AM
@Ramprakash0111 wrote:
I want to know about DATA VALUE REFERENCES in LabVIEW .. where it is mainly used.
Help me out if you can
In short; When you want to make sure you work on the same data on several places and/or when you want to isolate a small data set from a big cluster.
As you probably knows, splitting a wire will create a data copy, this can sometimes create issues. A DVR is basically used the same way as a reference in other languages.
When using clusters you get data copies when using Unbundle, which can affect performance if the internal data is big, with DVRs you can 'aim' for the correct data and avoid this. I posted a solution long ago where someone had a cluster of a couple of single values and a big array and reading the single values was slow. This proved to be due to the big array being copied as part of the read, so by using DVR the performance increased a lot.
In G#, e.g. we use it to get reference based classes instead of getting class copies whenever a wire is split.
/Y
09-22-2019 11:26 PM
Can you please share me any documents or codes related to Data Value Reference [DVR]..
Thank you in advance !!!
09-23-2019 06:03 AM
09-23-2019 06:18 AM
Note that in other languages (C\C++), using a reference causes new problems when multithreading (A-Synchronous data access). You'd need to somehow prevent race conditions between threads accessing the referenced object.
LabVIEW DVRs solve this, by only allowing access to the data in a In Place Element Structure.
One of the biggest downsides of DVRs is that they are not persistent. The moment the hierarchy the DVR was created in stops running, the DVR is released. This often that means after stopping the main VI, the subVIs can't be debugged anymore, as the DVR data is gone.
09-23-2019 06:32 AM
A Look At Race Conditions. I should also note that, with the advice of a fellow Champion, I redid the linked benchmarks using a large array and the DVRs became a lot more performant than the other alternatives. So I find DVRs best used for large data structures that you need to access and/or modify from multiple loops.
The other place I used DVRs was for a modular power supply driver where multiple classes (the power supply modules) needed access to the mainframe class (commands had to go through the mainframe). So this goes along with the By-Reference OOP mentioned earlier.
09-23-2019 06:37 AM
Thank you so much for your time and help ... kudos !!
09-23-2019 06:39 AM
Thank you very much for your help ! will be so happy if u can share any examples vis based on DVRs ..Thank you in advance !!! kudos !!
09-23-2019 06:41 AM
Thank you very much for your help.. pls share any vis you have , based on DVR concept .. Thank you
09-23-2019 07:23 AM
Can anyone send me the code for solving this using DVR.. i am currenly working in DVR and this will help me in knowing where to use it. Thank you in advance !!