From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
02-12-2019 12:13 AM
Hello.. I have made a software program to interface a PID controller through Modbus. I implemented this using state machine algorithm where it monitors different parameters (P, I, D, SP, PV etc) in a chained manner. Now I am storing the values of Level% (input Set-Point) and Valve% (output) with real timestamps to a file and then reading & displaying this data on a waveform graph. And this is where I have been stuck. 😞
If I put the Delete function (as shown in the attached pic), it always overwrites the values whenever I rerun the program (not acceptable) and if I enable the Append, it stores the data in a wrong iterative manner (maybe because of the while loop: not acceptable). If I don't use Delete or Append, then it keeps on asking to replace the existing file.
The software program is running fine except the waveform part.
What I want is, it should keep storing the timestamped data continuously to a file and by reading that file, we can display the past as well as the current data on to a graph even after rerunning. Can anyone help me out?
It would be great if somebody is having a piece of code to do this, for a quick reference.
02-12-2019 01:53 AM
Below is some hints:
1.read out all the data (Array1)from file at the beginning of your VI.
2. save test data with append enabled.
3. Insert recent data to Array1. You can use shift register at this step.
4. Let the graph to indicate the data of Array1.
02-12-2019 01:56 AM - edited 02-12-2019 01:58 AM
You're building an array and save the complete array each time, as can be clearly seen on your result picture. It's 1 sample the 1st time, 2 the 2nd and so on. Only save the new sample(s) if appending.
Keeping the built array in memory as now is good, though. Also, writing twice and reading it back is wrong, just use the shift register'd array. (I realize you might just be reading it back to check, but still)
/Y
02-15-2019 05:27 AM
I don't understand how can I get rid of this repetitive samples and how can I save only the new samples. And yes, I am writing the data twice, first to a text (.txt) file (Export Waveform to Spreadsheet file) and then to a binary (.dat) file (Write Waveform to File). I am forced to do this because "Read Waveforms from File.vi" doesn't accept a text file. Text file will be used as a visual reference to display the timestamped data and binary .dat file will be used by Read Waveforms from File.vi. (I don't know if some function is there to read and display the waveform data from a text file).
I have attached a separate write/read graph.vi which I am using in my project. Can you plz help me out with the necessary modifications in the vi?
02-15-2019 07:22 AM - edited 02-15-2019 07:22 AM
You are just growing your array and writing the whole thing to the file. And writing to 2 files is just silly. My recommendation would be to write to a TDMS file. You can install a simple plugin (installed with LabVIEW) so you can view the data in Excel and it is just simple to use.
02-18-2019 11:40 PM
Moved to another board