Tektronix Technical Forums are maintained by community involvement. Feel free to post questions or respond to questions by other members. Should you require a time-sensitive answer, please contact your local Tektronix support center here.

limited file size

Use this forum for questions about Keithley Test Script Builder software.
Post Reply
pavelkh
Posts: 18
Joined: October 29th, 2012, 6:34 pm
Country: United States

limited file size

Post by pavelkh » October 29th, 2012, 6:40 pm

Hello,

I built script for batteries testing.
The script works fine without errors.
I write all data during measurements to file on USB drive.
For some reason the file is always limited to 52 kB and, hence, contains only part of the data measured.
I use File:write function and then io.flush().
What can be wrong?

Dale C
Keithley Applications
Keithley Applications
Posts: 2846
Joined: June 10th, 2010, 6:22 am
Country: United States
Contact:

Re: limited file size

Post by Dale C » October 30th, 2012, 8:16 am

There should not be a file size limit.
Can you post the script you are using?

pavelkh
Posts: 18
Joined: October 29th, 2012, 6:34 pm
Country: United States

Re: limited file size

Post by pavelkh » October 30th, 2012, 9:42 am

Here it is:

Code: Select all

reset()			-- Reset SourceMeter to default settings
smua.nvbuffer1.clear()		-- Clear buffers
smua.nvbuffer1.appendmode = 1

smua.source.func = smua.OUTPUT_DCAMPS		-- Set source function to DCA 
smua.source.rangev = 5	-- Set source range
smua.source.limiti = 1		-- Set current compliance
smua.measure.rangev = 5	-- Set current measurement range to 5V 
smua.measure.nplc = 1			-- Set integration time to 1PLC (default)
smua.source.output = smua.OUTPUT_ON	-- Turn ON smua output

vmax = 1		-- maximal voltage, V
vmin = 0.01		-- minimal voltage, V
mass = 20		-- mass of sample in mg
maxcap = 370	-- max capacity in mAh/g (370 for Graphite)
pointsnum = 1000	-- number of writing points per lithiation or delithiation

timer.reset()
smua.source.leveli = 0
smub.source.leveli = 0
--delay(10)		-- delay before measurements, s

volt = smua.measure.v()	-- voltage, V
amp = smua.measure.i()	-- current, A 
time = timer.measure.t()	-- time, s

sourceMem = { { crateLi = 1/20, crateDeli = 1/20, cyclesnum = 1 },		-- Define measurements parameters:  
	    { crateLi = 1/4, crateDeli = 1/4, cyclesnum = 3 },		-- crateLi - lithiation c-rate 
	    { crateLi = 1/4, crateDeli = 1/2, cyclesnum = 3 },		-- crateDeli - delithiation c-rate  
	    { crateLi = 1/4, crateDeli = 1, cyclesnum = 3 },		-- cyclesnum - number of cycles
	    { crateLi = 1/4, crateDeli = 2, cyclesnum = 3 },
	    { crateLi = 1/4, crateDeli = 5, cyclesnum = 3 },
	    { crateLi = 1/4, crateDeli = 10, cyclesnum = 3 }, 			
	    { crateLi = 1/4, crateDeli = 20, cyclesnum = 3 },
	    { crateLi = 1/4, crateDeli = 1/4, cyclesnum = 1 }, }
readings = { }			-- Define table readings to hold measurements.

testFile, testError = io.open("vtest.csv", "a")	
if nil == testError then
	testFile:write("C-rate number", ",", "Cycle number at given C-rate", ",", "Absolute Time s", ",", "Relative Time s", ",", "Voltage V", ",", "Current A", "\n")
	print("START TESTING")

	while volt < vmax do			--precharge
		smua.source.leveli = 0.001
		volt = smua.measure.v()
	end

	for j = 1, table.getn(sourceMem) do
		step = sourceMem[j]
		iLi = -maxcap*0.001*mass*0.001*step.crateLi		-- lithiation current in amps
		iDeli = maxcap*0.001*mass*0.001*step.crateDeli		-- delithiation current in amps
		timeLi = 1/step.crateLi*3600		-- lithiation time in seconds
		timeDeli = 1/step.crateDeli*3600		-- delithiation time in seconds
		delaytime = 1/step.crateLi/pointsnum		-- delay between data writings
		
		for i = 1, step.cyclesnum do
			starttime = timer.measure.t()			-- lithiation start time
			cycletime = 0
			while volt > vmin and cycletime < timeLi do	--lithiation
				print(j, ",", i, ",", time, ",", cycletime, ",", volt, ",", amp, "\n")				
				smua.source.leveli = iLi			-- set lithiation current, A
				delay(delaytime)			-- delay before file writing
				volt = smua.measure.v()	-- current voltage, V
				amp = smua.measure.i()	-- current current, A 
				time = timer.measure.t()	-- time, s
				testFile:write(j, ",", i, ",", time, ",", cycletime, ",", volt, ",", amp, "\n")
				io.flush(testFile)
				cycletime = time-starttime			-- time from lithiation start
			end
			starttime = timer.measure.t()			-- delithiation start time
			cycletime = 0
			while (volt < vmax and cycletime < timeDeli) do		--delithiation
				print(j, ",", i, ",", time, ",", cycletime, ",", volt, ",", amp, "\n")				
				smua.source.leveli = iDeli			-- set delithiation current, A
				delay(delaytime)			-- delay before file writing
				volt = smua.measure.v()	-- current voltage, V
				amp = smua.measure.i()	-- current current, A 
				time = timer.measure.t()	-- time, s
				testFile:write(j, ",", i, ",", time, ",", cycletime, ",", volt, ",", amp, "\n")
				io.flush(testFile)
				cycletime = timer.measure.t()-starttime		-- time from delithiation start time
			end
		end
	end
end


waitcomplete()
smua.source.output = smua.OUTPUT_OFF	-- turn off smua
io.close(testFile)
print("END CYCLING")
exit()
	

pavelkh
Posts: 18
Joined: October 29th, 2012, 6:34 pm
Country: United States

Re: limited file size

Post by pavelkh » October 30th, 2012, 2:43 pm

I use Keithley 2612A

Dale C
Keithley Applications
Keithley Applications
Posts: 2846
Joined: June 10th, 2010, 6:22 am
Country: United States
Contact:

Re: limited file size

Post by Dale C » November 1st, 2012, 8:34 am

Thanks for the code.
Tried this with some slight modifications and could get more than 56kB onto USB flash drive.
1. What firmware revision do you have on the 2612A?
2. What brand USB flash drive are you using?

pavelkh
Posts: 18
Joined: October 29th, 2012, 6:34 pm
Country: United States

Re: limited file size

Post by pavelkh » November 1st, 2012, 11:21 am

1. Firmware is 2.1.1
2. Flash drive is Kingstone 4GB

pavelkh
Posts: 18
Joined: October 29th, 2012, 6:34 pm
Country: United States

Re: limited file size

Post by pavelkh » November 1st, 2012, 12:47 pm

Now I upgraded to 2.1.6 version of firmware.
The script leaded to device freezing at 52 kB file size.
Actually the device freezes each time during script execution, sometimes file size is less than 52 kB but never more than that.
Same with 2.2.2 firmware.
Very strange...

pavelkh
Posts: 18
Joined: October 29th, 2012, 6:34 pm
Country: United States

Re: limited file size

Post by pavelkh » November 1st, 2012, 2:05 pm

Wow!
Solved!
Could write more than 800 kB of good data without any errors or freezing.
The cause was flash drive - I tried different flash drive (Transcend, 2GB) and it worked.
So unexpected...
Thank you.

Post Reply

Return to “Test Script Builder”

Who is online

Users browsing this forum: No registered users and 3 guests