bbosse

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by bbosse

  1. Hi all! I have a LabJack with the Mux80 AIN expansion board with 3 CB37 terminal boards connected - I'm using it to record from 40 channels simultaneously. It works fine (for the channels I've tested) but I'm running up against a maximum sampling frequency of 100,000 Hz / 40 channels = 2500 Hz maximum samples per second per channel. I would like to increase the sampling frequency to perhaps 8,000 Hz, but if I try to record from all 40 channels at the same time at 8K Hz, it is above the limit of 100,000 Hz overall. I'm only recording data for 2 seconds every 10 minutes - I'm thinking of making part of the recording in series rather than parallel. For example, instead of recording from all 40 channels at the same time, record from the first 10 channels, then 11-20, 21-30, and 31-40 one group after the next in series. Is this a good solution? Would I just create different LJM_eStreamStart's with different identifiers? scanRate = 8000 LJM_eStreamStart(identifier1, {"AIN0", "AIN1", "AIN2", "AIN3", "AIN120", "AIN121", "AIN122", "AIN123", "AIN124", "AIN125",}, scanRate, scansPerRead, 1) LJM_eStreamStart(identifier2, {"AIN126", "AIN127", "AIN48", "AIN49", "AIN50", "AIN51", "AIN52", "AIN53", "AIN54", "AIN55",}, scanRate, scansPerRead, 1) LJM_eStreamStart(identifier3, {"AIN62", "AIN63", "AIN64", "AIN65", "AIN66", "AIN67", "AIN68", "AIN69", "AIN72", "AIN73",}, scanRate, scansPerRead, 1) LJM_eStreamStart(identifier4, {"AIN74", "AIN75", "AIN76", "AIN77", "AIN78", "AIN79", "AIN86", "AIN88", "AIN90", "AIN92"}, scanRate, scansPerRead, 1) Then I would read from each one of these streams separately, one at a time. Would that work? Thank you, B
  2. Hi there! I'm using a Lua script to control the output of my LabJack T7 to set DAC0 to 5V and DAC1 to 5V using: MB.W(1002, 3, 5) -- this turns the LED light off by turning the DAC1 to 5V MB.W(1000, 3, 5) -- TURN DAC0 to 5 V which is used as a reference for the BuckPuck Reference channel This works just fine. Now what I want to do is to send a trigger from Kipling to DAQFactory to tell it to start recording data. What is the best way to send a trigger signal from Kipling (Lua script) to DAQFactory sequence script? The approach I'm attempting is to set FIO0 channel to 1 using: MB.W(2000, 0, 1) -- set FIO0 to 1 to trigger DAQFactory to run its save script -- do other stuff here MB.W(2000, 0, 0) -- set FIO0 to back to 0 to after the trigger happens but, it isn't working. When I read channel FIO0 in DAQFactory using: // Set scans/second. private scanRate = 2000 // Set scans/read. This is how many scans are retrieved per call to the stream read // function, and thus controls the iteration rate of the loop below. private scansPerRead = scanRate / 2000 // Start the stream with a scan list of AIN0, AIN1, etc. These are streamable Names from the LabJack Modbus Map, not DF Channel names. LJM_eStreamStart(identifier, {"AIN0", "AIN1", "AIN2", "AIN3", "AIN4", "AIN5", "AIN6", "AIN7", "FIO0"}, scanRate, scansPerRead, 1) dataIn = LJM_eStreamRead(identifier) FIOvalue = dataIn.data.FIO0 FIOvalue just stays 1. Even if I try to set it back to 0 in Lua with MB.W(2000, 0, 0) it just stays 1 when I read it in DAQFactory. Perhaps I'm not using the MB.W function properly? I have searched for the documentation for the mbWrite function to know what each of the 3 parameters are, but haven't found the documentation yet. Or perhaps there is a better way to communicate from Kipling Lua script to DAQFactory sequence to trigger events? Thank you! B
  3. 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!
  4. 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!
  5. 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
  6. 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
  7. 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!