04-13-2017 04:19 PM - edited 04-13-2017 04:20 PM
04-13-2017 04:36 PM - edited 04-13-2017 04:36 PM
How could I do this differently?
--- You could make your diagram bigger 😉
The way I do this is to have a separate "data manager" VI.
It would have several functions you can call:
INIT
STORE TYPE 1 DATA
STORE TYPE 2 DATA
STORE TYPE 3 DATA
WRITE
SHUTDOWN
Each source loop calls it with a STORE command.
Somebody calls it periodically with a WRITE command.
The STORE commands only stash the given data in local shift registers )one for each data type).
The WRITE command takes ALL the data from all ShiftRegs, and writes a line to the file.
No interference.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
04-14-2017 04:57 AM
What you need to do is put all of your Analog Input into a single task. They are all in the same chassis and run at the same rate, so it only makes sense to put them together. This could solve your "buffer issues".
As far as logging, you really should be using a separate loop. Every iteration of the AI loop, you just send all of the data you got so far. When there is an update to the frequency measurement, send that. The logging loop can hold the RPM measurement in a shift register to keep logging that value until an update comes in. You might want to have a look at the Producer/Consumer for a better idea of how to log in a separate loop.
04-17-2017 05:35 PM - edited 04-17-2017 05:36 PM
Thank you for your answers,
Separating the while loops fixed my buffer issues. I implemented the producer/consumer model and I am now logging temperature, torque, thrust, and x, y, z acceleration into a csv file.
1) However, I am unsure how to add the RPM to that same file. All of the other data is being acquired continuously, but RPM only generates a frequency when the optical sensor sends a 5V signal. So the while loop won't be able to keep logging the value in a shift register, since the while loop won't be executed until the rising edge is detected.
2) Also, all of the producer loops are producing 1D array of waveform. The RPM sensor is the only one that is on demand, and hence producing a scalar, that I then convert to dynamic data to get time associated with the y. How could I get this as a 1D array of waveform as well, and bypassing the dynamic data altogether?
Thanks again!
04-17-2017 06:58 PM
Cannot look at your code right now, but you should have a cluster with a string (or enum) and a variant as your queue data type. The string tells the logger what to do with the data. So when the frequency gets updated, it sends the message to the logger. The logger holds the latest frequency value in a shift register and uses that value when logging everything else.
04-28-2017 04:53 PM
Thank you for your help. I used the producer/consumer model with data queues to log data from my different loops.