12-15-2023 06:07 PM
Hello everyone,
I have been learning the class with LabVIEW, and I have created a "MonitorVoltage" class. The code is in the attachment (you can run "ContinousVoltageMonitoring.lvlib").
With this class I want to monitor a static voltage (using DAQmx) and store the value if the voltage is outside predefined limits.
I also want to be able to access the measured voltage outside the "monitoring" VI while the measurement is on going (which means the voltage is inside the limits).
So basically, I have few main methods:
Additionally I have a "TestWithEvent.vi" (which is not part of the class), to be able to test my class.
So my issue is that "Start Measurement.vi" is blocking as long as the voltage is inside the limits. So I cannot call "End Measurement.vi" to stop the measurement, or "Read averageValue.vi" to get the latest "average voltage" measured in "Start Measurement.vi".
I know I can use an invoke node to call a VI so that it is not blocking, but i don't know how to do it with a parameter (the instance of my class).
Even if the invoke node would be successful, during the runtime of "Start Measurement.vi", I don't think I would really get the latest "average voltage" by calling "Read averageValue.vi".
Indeed I think the instance of my class (with the latest "average voltage") would not be propagated outside of the "Start Measurement.vi" as long as the VI doesn't end.
Does anyone know what would be the proper way to reach my goal? Being able to access "average voltage" while "Start Measurement.vi" is on going?
Best regards,
Ludovic
Solved! Go to Solution.
12-16-2023 07:45 AM
I would recommend you use run Start Measurement VI outside of the main loop. Use User Event or Notifier to wait for the stop command. Use Data Value Reference to pass data between the Measurement and main loops.
12-16-2023 04:05 PM
Thanks for the tips! I haven’t heard about DVR before but after reading a bit about it, that’s definitely what I need.
My end goal will be to use this class/VI through TestStand and DVR sounds helpful for that.
However it’s still quite fuzzy how to use that properly, do you have some good code example or articles which would describe how to use DVR with class instances? Otherwise I will make my own tests and probably create a new post for my DVR related questions.
12-17-2023 11:52 AM
Actually, I could understand how to use DVR with classes (at least one way).
I continue on a different post dedicated to the DVR questions, it can be found here:
https://forums.ni.com/t5/LabVIEW/Data-value-reference-DVR-how-to-write-and-read-without-using-IPE/td...
It also contact my updated LabVIEW code with DVR.
Thank you again!