bbosse

Members
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

0 Neutral

About bbosse

  • Rank
    Newbie
  1. Hmm, okay well it worked in the sense that I can adjust the number of decimal places saved (e.g. I tried format("%.1f", Channel0.Time)  and got 1 decimal place). But when I tried format("%.6f", Channel0.Time) I still only got 3 decimal places, which leads me to believe that the Channel0 is only generating 3 decimal places so there's nothing to show beyond 3. I looked into the Channel settings to see if I could specify the number of decimals, but didn't see anything. Is there a way I can specify that Channel0 saves up to 4 decimal places? Thank you!
  2. Now that I'm saving data directly to file, I'm trying to figure out how to save the time points with microsecond precision. I see from the manual the the data logging (which I was previously using) has the option to change the Sig Figs: " Time Sig Figs: Determines how many significant figures are used to write time values. A value of 9 yields timeprecise to the second, 12 to the millisecond and 15 to the microsecond. The maximum value is 15. " But now that I'm using the File.WriteDelim function to save my data, how do I specify that I want the time to be saved with 14 sig figs? Thank you!
  3. Cool. Thanks. I have switched to using the direct File writing. Code pasted below in case it helps someone else. Let me know what you think // Loop to read stream data and append it to the DF Channels. while(1) dataIn = LJM_eStreamRead(identifier) if (systime() <= timestamp + 10) // If the first 10 seconds of every 10 minutes, log the data - otherwise don't read the data data = insertTime(dataIn.data.AIN0, st, 1 / scanRate) Channel0.AddValue(data) // Needs to match channel defined in "Channels". data = insertTime(dataIn.data.AIN1, st, 1 / scanRate) Channel1.addValue(data) data = insertTime(dataIn.data.AIN2, st, 1 / scanRate) Channel2.addValue(data) data = insertTime(dataIn.data.AIN3, st, 1 / scanRate) Channel3.addValue(data) data = insertTime(dataIn.data.AIN4, st, 1 / scanRate) Channel4.addValue(data) data = insertTime(dataIn.data.AIN5, st, 1 / scanRate) Channel5.addValue(data) data = insertTime(dataIn.data.AIN6, st, 1 / scanRate) data = data*55.45 - 17.78 // Convert channel voltage from mV to degrees C Channel6.addValue(data) data = insertTime(dataIn.data.AIN7, st, 1 / scanRate) data = data*55.45 - 17.78 // Convert channel voltage from mV to degrees C Channel7.addValue(data) endif if (systime() > timestamp + 10 && notsavedyet == 1) // Open File and get handlePrivate Private.handle = File.Open("D:\ALT DAQFactory Saves\ALTfile_" + formatDateTime("%y%m%d_%H%M%S", systime()) + ".csv",0,1,1,1) // Put all the channel data into one array myArray[][0] = Channel0.Time myArray[][1] = floor(Channel0 * 1000 + 0.5) / 1000 // rounds to 3 decimals myArray[][2] = floor(Channel1 * 1000 + 0.5) / 1000 // rounds to 3 decimals myArray[][3] = floor(Channel2 * 1000 + 0.5) / 1000 // rounds to 3 decimals myArray[][4] = floor(Channel3 * 1000 + 0.5) / 1000 // rounds to 3 decimals myArray[][5] = floor(Channel4 * 1000 + 0.5) / 1000 // rounds to 3 decimals myArray[][6] = floor(Channel5 * 1000 + 0.5) / 1000 // rounds to 3 decimals myArray[][7] = floor(Channel6 * 1000 + 0.5) / 1000 // rounds to 3 decimals myArray[][8] = floor(Channel7 * 1000 + 0.5) / 1000 // rounds to 3 decimals // Write the array to the file File.WriteDelim(Private.handle, myArray, ",", chr(10)) // once saved, dont repeat until next read notsavedyet = 0 // close the file after it has been written File.Close(Private.handle) endif if (systime() >= timestamp + 600) // dont log data for next 10 minutes (600 seconds) timestamp = systime() // 10 minutes complete - reset timestamp to current system time saveCount += 1 // 10 minutes completed! - update saveCount notsavedyet = 1 endif st += scansPerRead / scanRate backlog = dataIn.ljmscanBacklog timeLeft = 600 - (systime() - timestamp) endwhile
  4. bbosse

    Custom Time Formatting for Milliseconds

    Thanks this worked
  5. Hello there! I'm trying to log data for 10 seconds every 10 minutes - each 10 seconds of data saved to its own separate file. So I have 2 problems with my script pasted below: 1) For some reason the file will have the first 6 or 7 seconds of data and not the entire 10 seconds 2) but even more annoying is that when the 10 minutes is up and it is supposed to switch to a new file, for some strange reason it records the first second or two in the previous file before finally making the switch to a new file. It's like it starts logging in the file from 10 minutes ago for a second or two before finally opening a new file to begin logging. I've tried troubleshooting this in a variety of ways but still have been unable to get 10 seconds of data to save in its own file every 10 minutes. Any help is appreciated, thank you. Logging.DataLog.FileName = "D:\ALT DAQFactory Saves\ALT_" + formatDateTime("%y%m%d_%H%M%S", systime()) + ".csv" beginlogging(DataLog) // Loop to read stream data and append it to the DF Channels. while(1) dataIn = LJM_eStreamRead(identifier) if (systime() <= timestamp + 10) // If the first 10 seconds of every 10 minutes, log the data - otherwise don't read the data data = insertTime(dataIn.data.AIN0, st, 1 / scanRate) Channel0.AddValue(data) // Needs to match channel defined in "Channels". data = insertTime(dataIn.data.AIN1, st, 1 / scanRate) Channel1.addValue(data) data = insertTime(dataIn.data.AIN2, st, 1 / scanRate) Channel2.addValue(data) data = insertTime(dataIn.data.AIN3, st, 1 / scanRate) Channel3.addValue(data) data = insertTime(dataIn.data.AIN4, st, 1 / scanRate) Channel4.addValue(data) data = insertTime(dataIn.data.AIN5, st, 1 / scanRate) Channel5.addValue(data) data = insertTime(dataIn.data.AIN6, st, 1 / scanRate) data = data*55.45 - 17.78 // Convert channel voltage from mV to degrees C Channel6.addValue(data) data = insertTime(dataIn.data.AIN7, st, 1 / scanRate) data = data*55.45 - 17.78 // Convert channel voltage from mV to degrees C Channel7.addValue(data) endif if (systime() >= timestamp + 600) // dont log data for next 10 minutes (600 seconds) // From the DAQFactory Manual: "changing the file name while the logging or export set is running will close the current file and open the new file" // We change the filename for each new 10 minute interval of data Logging.DataLog.FileName = "D:\ALT DAQFactory Saves\ALT_" + formatDateTime("%y%m%d_%H%M%S", systime()) + ".csv" timestamp = systime() // 10 minutes complete - reset timestamp to current system time saveCount += 1 // 10 minutes completed! - update saveCount endif st += scansPerRead / scanRate backlog = dataIn.ljmscanBacklog timeLeft = 600 - (systime() - timestamp) endwhile
  6. I am using custom time formatting on my data logging and it works great! Here's what I've been using %m/%d/%y %H:%M:%S But if I also wanted to include the milliseconds what is the % for that? I checked the help, manual, and forum but didn't find anything. Thanks!