07-05-2021 03:21 PM
Hello LabVIEW Community,
I have a physical testing apparatus with many sensors and a few actuators. I rely on active thermocouple signals as input to a PID control system to control said actuators. I need the PID to run continuously at all times. However, when I observe desired conditions on the test apparatus, I want the option to log/record all sensor data signals over time for one minute, then send this data to a file destination - all while allowing the main while loop to continue to execute. So far, I have only found how to send data upon stopping the main while loop.
I am using a cDAQ with 4 modules (AI channels module, strain load cell module, thermocouple module, AO module).
I have been stuck on an admittedly arduous method of sending data to excel (preferred file format). See attached screenshot. [Basically, I let the code run for some time, stop the program which then plots data v. time on the chart, then, I right-click and send this data to Excel, where I am able to save it. I know, there must be a better way. Also, it stops the while loop, which is a no no for me.]
With that said, my questions are restated here as:
1. How can I record signal data and send to file without interrupting the main while loop?
2. Is there a simpler method of just sending my data to excel, compared to my current method?
I have watched more tutorial videos than I can count, but still nothing has answered my question. Looking forward to receiving any and all help.
Thank you!
Solved! Go to Solution.
07-05-2021 03:46 PM
Well you are going to have to use a proper programming architecture. I know all the tutorials make in look like Express VI's and everything in one loop is how you program LabVIEW. But as you see that does not actually work in a "real" application.
You need to learn a simple state machine architecture and have a state for:
As for the Express VI's, they are only there for the tutorials and those 4 hours LabVIEW seminars sales pitches. You will soon find they are not very useful in a "real" application due to their lack of flexibility.
07-05-2021 06:09 PM
You already got some good advice.
Obviously, you have a basic dataflow issue, but I cannot see anything that is "sending" data. Inside the loop you are continuously overwriting the same file and once the while loop stops, the read function executes. I don't see anything resembling "excel" anywhere. Did you really attach the correct VI?
I don't have any DAQmx installed, so I cannot look at your DAQ assistant configuration. How is it configured? (e.g. how many points do you read? at what rate, etc. Since you connect scalar indicators maybe you are really only interested in one point?) What is the resulting loop rate? Don't you want to append to the current file instead of starting over with each iteration?
At this point you should graduate from "baby LabVIEW" (express VIs and dynamic data) and do some real tutorials. Look a the examples and design templates that ship with LabVIEW.
07-06-2021 09:27 AM
Thank you for your feedback RTSLVU,
I had a feeling that this was the direction I should be pursuing. I had used simple express VIs in the past to gather small quantities of data quickly using an NI DAQ, but my project has evolved into something much greater. Was not initially anticipating the LabVIEW code to represent such a large portion of my project, but your advice definitely seems to be pointing me in the right direction.
Thanks again!