Code:
#scriptMenu Discharge
#logcmds 0
="Battery discharging with DL24 / PX100"
=var endVoltage=0
=var testCurrent=1
=var endVoltageLoad = endVoltage-0.05
=var stepTime=1
=var Voltage
=var startCurrent
=var stopByLoad=2
=var addCapacity=1;
=var addEnergy=1;
=var reset=1
=var Timelimit=0
=var timelimit=72000
=var Timecheck=0
=var load=getDevice("Load")
="Loaddevice = " + load
=setOn(load,0);
=setCurrent(load,testCurrent)
; --------------------------------------------------------------
#popupInit "Battery discharge DL24 / PX100"
#popupNumber "Minimum voltage" endVoltage 0.5 60 "The fully discharged voltage for the battery"
#popupNumber "Discharge current" testCurrent 0.1 5 "Current used for discharge"
#popupNumber "Max. Discharge time" Timelimit 0 72000 "Max. Discharge time in Seconds"
#popupCheckbox "Add calculated capacity (Ah)" addCapacity "Add Math.Capacity expression"
#popupCheckbox "Add calculated energy (Wh)" addEnergy "Add Math.Energy expression"
#popupCheckbox "Time limited discharge" Timecheck "Activate Time limit"
#popupCheckbox "Reset Load" reset "Reset Load before start"
#popupButtons Start ok Abort
#popupShow
; --------------------------------------------------------------
#if !ok
="Test aborted"
#return
#endif
#math
#if addCapacity
#math Capacity Ah SumTimeHour 0 (nameCurrent(load))
#endif
#if addEnergy
#math Energy Wh SumTimeHour 0 (nameCurrent(load)+"*"+nameVoltage(load))
#endif
#if Timecheck
=timelimit=Timelimit
="Max. Discharge time = " +Timelimit + " Seconds"
#endif
#if reset
(load):reset
#endif
#delay 1
=endVoltageLoad=(endVoltage-0.05)
#delay 0.5
=setCurrent(load,testCurrent)
#delay 0.5
="Discharge with "+testCurrent+"A to "+endVoltage+"V";
=setVoltage(load,endVoltageLoad)
#delay 0.5
=setCurrent(load,testCurrent)
#delay 0.5
#delay 0.5
=setOn(load,1);
#delay 0.5
#log (stepTime)
#ChartCurves (load+".Voltage") (load+".Current) (load+".Temperature) RD6012.Voltage RD6012.Current
#haslogged
#haslogged
="Start Voltage = "+tableCalcMax((load+".Voltage"),tableRows()-2)+" Volt"
="Discharge Current = "+tableCalcMax((load+".Current"),tableRows()-2)+" Ampere"
=startCurrent=tableCalcMax((load+".Current"),tableRows()-2)
#haslogged
#haslogged
#haslogged
#haslogged
#if Timecheck then {
#wait (tableCalcMax((load+".Voltage"),tableRows()-6)>endVoltage) and (tableCalcMax((load+".Current"),tableRows()-6)>(0.5*testCurrent)) and timeendVoltage) and (tableCalcMax((load+".Current"),tableRows()-6)>(0.5*testCurrent))
}
#endif
=setOn(load,0);
#log 0
#if (tableCalcMax((load+".Current"),tableRows()-6)<(0.5*testCurrent)) then {
=stopByLoad=1
}
#endif
#log 0
#if startCurrent<0.1 then
="Discharge not started, Input Voltage to low"
#else
#endif
#if stopByLoad<2 then {
="Discharge stopped by Load"
}
#endif
#if stopByLoad>1 then {
="Discharge stopped by TestController"
}
#endif
="End Voltage = "+tableCalcMax((load+".Voltage"),tableRows()-3)+" Volt";
="Discharged with Current = "+testCurrent+" Ampere"
="Capacity = "+(tableCalcMax((load+".Capacity"),tableRows()-2))+"Ah"
="Energy = "+(tableCalcMax((load+".Energy"),tableRows()-2))+"Wh"
Code:
#scriptMenu Battery Discharge with Internal Resistance Check
#scriptInterface Load setCurrent setOn readVoltage setVoltage readCurrent readCapacity readTemperature
;; Battery Discharge with Internal Resistance Check
;; Loaddevice = ATDL24P
;;
;; Battery under Test = Giant Fietsaccu 2
;; Specifications: Nominal Voltage = 25.9 V and Rated Capacity = 9000 mAh
;;
;; Start Voltage = 28.764 Volt
;; Discharge Current = 3.0 Ampere
;; Minimum Voltage = 20.0 Volt
;; Rated Battery Capacity = 9000.0 mAh
;; Temperature limit Load is set to: 50.0 C
;;
;; Internal Resistance Check in Progress
;; 10 Seconds low Current (0.2*C) Discharge (= 1.8 A)
;; 1 Second high Current (1*C) Discharge (= 3.129 A)
;; Internal Resistance = 279m ohm
;;
;; Logging already running, interval adjusted
;; 20:33:14 Discharge started with 3.0 A to 20.0 V
;; 22:55:47 Discharge stopped at 19.998 V
;;
;; Discharge stopped by TestController (Minimum voltage detected)
;; End Voltage = 19.998 Volt
;; Discharged with Current = 3.0 Ampere
;; Capacity = 7126.0 mAh
;; Energy = 179.8 Wh
;;
;; Chart, Log en CSV files are saved as: Giant Fietsaccu 2.png, Giant Fietsaccu 2.log and Giant Fietsaccu 2.csv