01-23-2010 10:05 AM - edited 01-23-2010 10:06 AM
Is that what you really want? With the program you now have, no matter how long it runs, the only thing that will be saved is a single voltage reading. My comments about placing the write outside the loop was not really a recomendation. I was trying to point out what would happen if that was done that certain way. If you want to record only once but still save multiple results, what you should do is skip that conversion to a array and the string and wire the numeric out of the loop (the output of the Convert From Dynamic Data). Right click on it and select 'Enable Indexing'. That will create an array - an array with a result of each loop. Wire that to the 1D input of Write to Spreadsheet File.
01-25-2010 10:30 AM - edited 01-25-2010 10:37 AM
uncleje wrote:
I am sales guy trying to help in my son's science project. Not the ideal person for this. He wants to record battery drain under load and capture the curve. The drain is to go from fresh to less than 0.6 v in an hour or two. He wants to generate data and record it to then plot voltage vs. time curves to compare the various battery types. If anyone can help in this I would be really greatlful. Also, any suggestions in dressing up the front panel will be greatly appreciate. I understand if you don't have time. Thanks.
Oh... Why didn't you say so? Your son's task is something I do on a regular basis; in fact I am comparing three SLA batteries at different discharge rates right now to see if our units runtime prediction is working.
Yours will obviously be different but I think you will get the general idea...
Now my example is a quick and dirty that I threw together last week when they dropped this bomb on me...
Starting from the top left I open a VISA session for the instrument taking the battery temperature (Agilent 34907A) and a com port to get some data from the UUT's micro.
I also launch a sub-vi that runs a Yokogawa power analyzer; this takes all my voltage and current measurements in the background and puts the measured vales in the "Measurement Value" global variable.
Lower left: I open a data file and put column headers on.
I separate the header labels with a comma, then search and replace the commas with tabs, then I can use an .xls extension and MS Excel can open it directly.
(I used to just use commas and put a .csv extension but my managers don’t like csv files anymore...)
Follow the error cluster through my loop:
Get the battery temperature
Get some data from the UUT
----->The temperature and UUD data arrays are combined with the Measurement Value array and fed to "array to spreadsheet string" a timestamp is then added to the string, the string is written to the data file.
Also the most recent data is displayed on the front panel.
Then there is a for-loop with a 1000mS wait making a 60 second delay that can be aborted.
Loop and continue until stop is pressed
Close all the VISA sessions.
Now for dressing up the front panel you will have to ask someone else as mine always look like crap... We do all our analysis, graphs, and data presentations in Excel.
01-25-2010 08:01 PM
LOL. Now I get it!
It works! Thanks to all of you. How come I am not getting a 2D array with time and voltage? This spits out voltage only. Also, is there a way to round- off the readings to the nearest 10th?
When I change the sample rate and HZ, my program crashes and I don't know why. Any suggestions? Thanks for your help.
01-25-2010 08:39 PM
You don't get an array of time and voltages because the output of the Express VI is just the measured values. It doesn't put out time. Actually, it puts out a Dynamic Datatype which has some other attributes buried in it such as the start time and time interval between data points. Though in reality, the blue wire dynamic data really does hide a lot of information. It is kind of a mystery, which is one of the reasons why more veteran LV users stay away from it and express VI's. In your case, you are taking that data (5 samples at 5 Hz according to your Express VI) and just converting it to a double scalar value. So you only get one value and no time information with it.
If you want to round off readings, you need to set the format input into the Write to Spreadsheet file that way. It is defaulted to %.3f which means 3 decimal places. Try %.1f
What do you mean by crashes? Does LV crash, does Windows crash, or do you get an error message? If so, what does it say? And what do you mean by sample rate and Hz? Sample rate is defined in Hz. Do you actually mean number of samples and sample rate?
01-25-2010 09:26 PM
When I try to change the DAQ data rate from 5 samples at 5 Hz to anything else like 1 sample at 1 Hz. at the building VI stage the program just closes. No errors, no messages. My computer does not crash. Just NI shuts down.
I think I am still taking too many samples. I want to try 1 sample at 1 Hz. If you can change and send it back I would greatly appreciated.
01-25-2010 10:59 PM
Here it is saved for 1 sample 1 Hz.
Remember, you can also change the # of samples, and sample rate by wiring constants into the terminals of the DAQ Assistant Express VI. It wouldn't be necessary to have to open the dialog box and modify it.
Something is certainly not right if trying to modify the DAQ assistant, LabVIEW just closes. What happens if you delete the DAQ assistant and drop a new one in from scratch?
Actually, I have a weird problem going on with the DAQ assistant on my home PC (LV2009 on Win Vista). If I try to edit the DAQ assistant, it says an unknown error has occurred, then an empty MAX window opens up. If I click OK, and try to edit it again, the DAQ assistant initializes and opens up just fine. If I repeat, an error. Repeat again, and it opens. Just back and forth like that. LabVIEW doesn't close. Just every other opening of the DAQ assistant raises an error dialog box.
01-26-2010 09:57 AM
I have Version 8.0 and cannot open your attachement which is an 8.6. Are you able to save it as 8.0?
My last issue is how to save a 2-D matrix with time and voltage. I would not know where to begin on that. If it is a simple fix and you have a few extra minutes, please feel free to adjust. If not, I understand and will try to connect with NI. I am really grateful to you and the rest of the folks here. This has saved me months aggravation. I have talked with NI engineers 2-3 times as well with limited success. Thank you so much.
01-26-2010 10:57 AM
I'm sorry. I knew you had 8.0, and tried to save it back to that, but must have hit 8.6 instead.
Try this one.
01-26-2010 11:12 AM - edited 01-26-2010 11:14 AM
This one converts the time to a double, builds an array with the value. Then autoindexes all the elements and writes it to the file.
Someone else may have a better way to handle this. I don't mess with the Express VI's much, so I don't often think about how to work with their data.
01-26-2010 11:15 AM