LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data is not updating in calss & Convert vi reference to strictly type reference vi

Hi,

In the attached project file there is a Class called 'ClassSample.lvclass' having 3 different data types Boolean, Numeric and Variant(not really sure, Variant can be use for strict data type reference). From this three we careated the 'VIs for data member access' you can see them in project file

My questions are,(Please refer attached screenshot)

1. Though member of same class, why value is not updating at probe 16 ?

2. How to convert vi reference to strictly type reference vi ?

 

Thank you.

-
Amit
CLAD
Download All
0 Kudos
Message 1 of 5
(3,162 Views)

LVOOP is by value OOP. So two object accessors working in parallel on the "same" object really work on two different copies of the same object. You would have to make the data element (or entire object data) a Data Value Reference in order to be able to share the same value between two independent paths of your object wire, but before going down that road you really should think hard if this is what you need. There are many things to say about by reference object hierarchies but they come with their own problems and the LabVIEW by value approach has its advantages. Starting to add by reference values to your object certainly will muddy the waters for anyone trying to understand your object hierarchy a few months from now, including yourself.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 5
(3,152 Views)

Hi,

 

Thank you for your reply.

My aim is to do above example is to apply it for updating different VIs asynchoronously(asynchounsly start, run, Stop and Update data and UI).

 

Among following 3three ways whatis good way to do this ?

1. Use value data reference
2. Use Notifier
3. Use queue

Thank you.

-
Amit
CLAD
0 Kudos
Message 3 of 5
(3,081 Views)

Hi,

Thanks for your reply.

Basically the objective of my example is to perform asynchronous call but using two different dispatch methods VI to Start and Stop the actual VI doing the job loop (Work) within a class instance.

To make it short and a little more clear:

Let's say we do have a class Person with the following methods:

Person

{

                Methods

                o Public

                  - Start.vi (Start asynchronously Work.vi, otherwise throw error if already running)

                  - Stop.vi (Wait asynchronously running Work.vi, otherwise throwing error if not running)

               o Protected

                  - Work.vi (Performing a loop and updating (incrementing) a field Number in the private data of class cluster)

               o  Private Data

                * Numerical Number (incremented every time there is an iteration in the loop of Work.vi)

                 * Boolean Is Running? (if the Work.vi is currently asynchronously running)

}

 

To communicate the information across the different vi what is the best way:

- Value Data Reference

- Notifier

- Queue

 

Thanks,

-
Amit
CLAD
0 Kudos
Message 4 of 5
(3,062 Views)

It depends a bit on your final intention. Bascially you have a shared state that you want to access asynchronously from different places. If you know that the actual object is only created once (terminilogie here is a bit shaky as every wire split would create a copy of the LVOOP object but I hope you know what I mean), you could use a global or Action Engine to store the state. Using a DVR for this state and adding the DVR to your object class data is however a more scalable approach as it will allow you to instantiate more than one object of that class and each one will contain its own DVR that will reference the same value for the specific object instance even if you split the object wire, creating actually two copies of that object (but for the purpose of this discussion they would be still the same object instance).

 

Queues could work if you create a single element queue but you would always need to use Preview Queue rather than Dequeue in order to maintain the value in there.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 5 of 5
(3,050 Views)