TR6143-bas

Togotech (토론 | 기여)님의 2020년 1월 26일 (일) 14:30 판

10  ! Advantest TR6143

20     ! 2020-01-17 배터리 충방전 프로그램
21     ! 2020-01-26 PTC용 표준 VI 측정추가
30     OPTION BASE 1
40     INTEGER No_cycle  !충반전 실험 횟수
50     INTEGER Size,Length,Btn
60     DIM Msg$[25]
70     No_cycle=5
80  !  Wait=.01   !계측기 세팅을 한 후, 첫 측정에서 측정값이 0이 나오는 현상 때문에 잠시 대기 시간
90     GOSUB Dut_select
100    GOSUB Stimulus_select
110    GOSUB Fileopen
120    GOSUB Inst6143_open
130    GOSUB Measure
140    GOSUB Fileclose
150    PAUSE
160    STOP
170 Dut_select:  !
180    INTEGER Dut_no
190    Size=2
200    Length=7
210    ALLOCATE Dut$(Size)[Length]
220    Dut$(1)="BATTERY"
230    Dut$(2)="PTC"
240    Msg$="DUT 종류"
250    DIALOG "LIST",Msg$,Btn;SET("ITEMS":Dut$(*),"COLUMNS":Length,"ROWS":Size),RETURN("SELECTION":Dut_no)
260    Dut_no=Dut_no+1
270    SELECT Dut$(Dut_no)
280    CASE "BATTERY"
290      GOSUB Battery_select
300    CASE "PTC"
310      GOSUB Ptc_select
320    END SELECT 
330    RETURN
340 Battery_select:     !
350    INTEGER Battery_no
360    Size=6
370    Length=6
380    ALLOCATE Battery$(Size)[Length]
390    Battery$(1)="Li"
400    Battery$(2)="NiCd"
410    Battery$(3)="3-NiCd"
420    Battery$(4)="EDLC"
430    Battery$(5)="BAT"
440    Battery$(6)="Li-S4"  !4개 직렬, 각셀을 34970A로 측정
450    Msg$="배터리 종류"
460    DIALOG "LIST",Msg$,Btn;SET("ITEMS":Battery$(*),"COLUMNS":Length,"ROWS":Size),RETURN("SELECTION":Battery_no)
470    Battery_no=Battery_no+1
480    RETURN
490 Ptc_select:  !
500    INTEGER Ptc_no
510    Size=6
520    Length=6
530    ALLOCATE Ptc$(Size)[Length]
540    Ptc$(1)="SPL1"
550    Ptc$(2)="    "
560    Ptc$(3)="    "
570    Msg$="PTC 종류"
580    DIALOG "LIST",Msg$,Btn;SET("ITEMS":Ptc$(*),"COLUMNS":Length,"ROWS":Size),RETURN("SELECTION":Ptc_no)
590    Ptc_no=Ptc_no+1
600    RETURN
610 Stimulus_select: !
620    SELECT Dut$(Dut_no)
630    CASE "BATTERY"
640      SELECT Battery$(Battery_no)
650      CASE "Li"
660        Vc=4.2!4.2V 충전전압         !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
670        Vd=3.2!3.2V 방전종료전압     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
680        Ic=1  !100mA 충전전류       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
690        Ic_end=.5 !충전 종료 전류   !!내부 저항 !!!!!!!!!!!!!!!!!!!!!!!!
700        Id=-1 !100mA 방전전류 음수  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
710      CASE "NiCd"!표준 1.2V
720        Vc=1.3!1.5V 충전전압
730        Vd=.9!0.9V 방전종료전압
740        Ic=.001!100mA 충전전류
750        Ic_end=.0005!충전 종료 전류
760        Id=-.0001!100mA 방전전류 음수
770      CASE "3-NiCd"!표준 3.6V
780        Vc=4.7!4.1V 충전전압
790        Vd=1.5!3.1V 방전종료전압
800        Ic=.0005!100mA 충전전류
810        Ic_end=.00035!충전 종료 전류
820        Id=-5.E-5!100mA 방전전류 음수
830      CASE "BAT"!표준 3.6V
840        Vc=3.5!4.1V 충전전압
850        Vd=2.5!1.V 방전종료전압
860        Ic=.02!100mA 충전전류
870        Ic_end=.006!충전 종료 전류
880        Id=-.005!-10mA 방전전류 음수
890      CASE "Li-S4"
900        Vc=16.8!4.2x4 충전전압         4.2x4=16.8     3.7x4=14.8 nominal
910        Vd=12.8!3.2x4 방전종료전압     3.2x4=12.8
920        Ic=2  !2A 충전전류
930        Ic_end=1!충전 종료 전류
940        Id=-2 !-2A 방전전류 음수
950      CASE ""
960        Msg$="충전전류[A], 방전전류[A], 충전종료전류[A], "
970      END SELECT 
980    CASE "PTC"
990      SELECT Ptc$(Ptc_no)
1000     CASE "SPL1"
1010       Wait=3
1020       Volt_start=0
1030       Volt_stop=1
1040       Volt_step=.01
1050       Limit=2       !2A
1060     CASE "    "
1070     CASE "    "
1080     END SELECT 
1090   END SELECT 
1100 !GOSUB Dialog_string3
1110   RETURN
1120 Fileopen:!
1130   DIM Dhms$[8]
1140   DIM Filename1$[20],Filename2$[20],Filename3$[20]
1150   T=TIMEDATE
1160   Time$=TIME$(T) !하루 추가 +24*3600
1170   Date$=DATE$(T)
1180   Dhms$=Date$[1;2]&Time$[1;2]&Time$[4;2]&Time$[7;2]
1190   Filename1$=Dhms$&".txt"
1200   CREATE Filename1$,1
1210   ASSIGN @File1 TO Filename1$;FORMAT ON
1220   SELECT Dut$(Dut_no)
1230   CASE "BATTERY"
1240     T=T+1       !1초 늦게
1250     Time$=TIME$(T)
1260     Date$=DATE$(T)
1270     Dhms$=Date$[1;2]&Time$[1;2]&Time$[4;2]&Time$[7;2]
1280     Filename2$=Dhms$&".txt"
1290     CREATE Filename2$,1
1300     ASSIGN @File2 TO Filename2$;FORMAT ON
1310     IF Battery$(Battery_no)="Li-S4" THEN!직렬배터리 4개에 대한 각 셀별 전압 기록용
1320       T=T+1     !1초 늦게
1330       Time$=TIME$(T)
1340       Date$=DATE$(T)
1350       Dhms$=Date$[1;2]&Time$[1;2]&Time$[4;2]&Time$[7;2]
1360       Filename3$=Dhms$&".txt"
1370       CREATE Filename3$,1
1380       ASSIGN @File3 TO Filename3$;FORMAT ON
1390     END IF 
1400   END SELECT 
1410   RETURN
1420 Fileclose:!
1430   ASSIGN @File1 TO *
1440   SELECT Dut$(Dut_no)
1450   CASE "BATTERY"
1460     ASSIGN @File2 TO *
1470     IF Battery$(Battery_no)="Li-S4" THEN
1480       ASSIGN @File3 TO *
1490     END IF 
1500   END SELECT 
1510   RETURN
1520 Measure: !
1530   INTEGER I
1540   DIM Cmd$[25],A1$[14],A2$[14],Test$[1]
1550   OUTPUT @File1;"No.,Time[m],Volt[V],Curr[A]"
1560   GOSUB Chart_var
1570   GOSUB Init_chart
1580   Count=0
1590   Time_zero=TIMEDATE
1600   SELECT Dut$(Dut_no)
1610   CASE "BATTERY"
1620     GOSUB Measure_battery
1630   CASE "PTC"
1640     GOSUB Measure_vi
1650   END SELECT 
1660   RETURN
1670 Measure_battery: !
1680   OUTPUT @File2;"Cycle,Charge Time[m],Charge i Capa[mAh],Charge W Capa[Wh], Discharge Time[m],Discharge i Capa[mAh], Discharge W Capa[Wh]"
1690   FOR I=1 TO No_cycle   !배터리 충방전실험을 5회 실시
1700     C_i_capa=0
1710     C_w_capa=0
1720     D_i_capa=0
1730     D_w_capa=0
1740     GOSUB Cycle
1750     OUTPUT @File2;I,C_time,C_i_capa,C_w_capa,D_time,-D_i_capa,-D_w_capa
1760   NEXT I
1770   RETURN
1780 Measure_vi:  !
1790   FOR Volt=Volt_start TO Volt_stop STEP Volt_step
1800     Cmd$="V5" !32V
1810     Cmd$=Cmd$&" D "&VAL$(Volt)&"V"   !D 2.0V
1820     Cmd$=Cmd$&" D "&VAL$(Limit)&"A"   !D 2.0A
1830     OUTPUT @Src;Cmd$   !"V5 D 1V D 2A"
1840     OUTPUT @Src;"E"    !Operate ON
1850     T=TIMEDATE
1860     Time_elapsed=(T-Time_zero)/60
1870     GOSUB Reading
1880     Curr=Data
1890     GOSUB Data_process
1900     WAIT Wait
1910   NEXT Volt
1920   OUTPUT @Src;"H"      !Operate OFF
1930   RETURN
1940 Cycle: !
1950   Pre_v=0 !최초 측정 전압=0으로 가정한다.
1960   GOSUB Charge1
1970   GOSUB Charge2
1980   GOSUB Discharge
1990   RETURN
2000 Charge1: !
2010 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2020 !충전. +부호 정전류, 전압제한(전압을 읽는다.)
2030 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2040   Test$="C"
2050   Cmd$="I4"   !2A range
2060   Cmd$=Cmd$&" D "&VAL$(Ic)&"A"     !D 2.0A
2070   Cmd$=Cmd$&" D "&VAL$(Vc)&"V"     !D 4.2V
2080   OUTPUT @Src;Cmd$   !"I4 D 2A D 4.2V"
2090   OUTPUT @Src;"E"      !Operate ON
2100   WAIT Wait
2110   C_start_time=TIMEDATE
2120   Pre_t=C_start_time
2130   Curr=Ic
2140   LOOP
2150     T=TIMEDATE
2160     Time_elapsed=(T-Time_zero)/60
2170     GOSUB Reading
2180     Volt=Data
2190     IF Volt>Pre_v THEN   !충전 전압이 상승하면
2200       GOSUB Data_process
2210       C_i_capa=C_i_capa+(Curr*1000)*((T-Pre_t)/3600)   !mAh = mA x hour
2220       C_w_capa=C_w_capa+Curr*Volt*((T-Pre_t)/3600)     !Wh = A x V x hour
2230       Pre_t=T
2240     END IF 
2250   EXIT IF Volt>=Vc   !측정 전압이 충전최고 전압에 도달하면
2260   END LOOP 
2270   OUTPUT @Src;"H"      !Operate OFF
2280   RETURN
2290 Charge2:!
2300 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2310 !충전, 충전 최고전압에 도달하면. 정전압, 전류제한(전류를 읽는다.)
2320 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2330   Cmd$="V5"   !32V range
2340   Cmd$=Cmd$&" D "&VAL$(Vc)&"V"     !D 4.2V
2350   Cmd$=Cmd$&" D "&VAL$(Ic)&"A"     !D 2.0A
2360   OUTPUT @Src;Cmd$   !"V5 D 4.2V D 2.0A"
2370   OUTPUT @Src;"E"      !Operate ON
2380   WAIT Wait
2390   Pre_v=Ic  !충전 전류(Ic)를 초기값으로 기억한다.
2400   Volt=Vc   !충전전압은 일정하다.
2410   LOOP
2420     T=TIMEDATE
2430     Time_elapsed=(T-Time_zero)/60
2440     GOSUB Reading   !충전전압에 도달되었기 때문에, 서서히 줄어드는 충전 전류를 측정한다.
2450     Curr=Data
2460     IF Curr<Pre_v THEN   !측정 전류가 서서히 낮아지면
2470       GOSUB Data_process
2480       C_i_capa=C_i_capa+(Curr*1000)*((T-Pre_t)/3600)   !mAh = mA x hour
2490       C_w_capa=C_w_capa+Curr*Volt*((T-Pre_t)/3600)     !WA = A x V x hour
2500       Pre_t=T
2510     END IF 
2520   EXIT IF Curr<=Ic_end   !현재 전류가 종료전류에 도달하면
2530   END LOOP 
2540   C_time=(T-C_start_time)/60
2550   OUTPUT @Src;"H"      !Operate OFF
2560   RETURN
2570 Discharge: !
2580 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2590 !방전 전류는 -로 표기한다.
2600 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2610   Test$="D"
2620   Cmd$="I4"   !2A range
2630   Cmd$=Cmd$&" D "&VAL$(Id)&"A"      !D -2.0A
2640   Cmd$=Cmd$&" D "&VAL$(Vc)&"V"     !D 4.2V
2650   OUTPUT @Src;Cmd$   !"I4 D -2A D 4.2V"
2660   OUTPUT @Src;"E"      !Operate ON
2670   WAIT Wait
2680   Pre_v=Vc
2690   D_start_time=TIMEDATE
2700   Pre_t=D_start_time
2710   Curr=Id    !방전전류(-값을 갖는다.)는 일정하다.
2720   LOOP
2730     T=TIMEDATE
2740     Time_elapsed=(T-Time_zero)/60
2750     GOSUB Reading   !일정 전류 방전      , 전압이 측정된다.
2760     Volt=Data
2770     IF Volt<Pre_v THEN   !측정전압이 서서히 낮아지면(방전이므로)
2780       GOSUB Data_process
2790       D_i_capa=D_i_capa+(Curr*1000)*((T-Pre_t)/3600)   !mAh = mA x hour
2800       D_w_capa=D_w_capa+Curr*Volt*((T-Pre_t)/3600)     !Wh = A x V x hour
2810       Pre_t=T
2820     END IF 
2830   EXIT IF Volt<=Vd   !현재 전압이 충전전압에 도달하면
2840   END LOOP 
2850   D_time=(T-D_start_time)/60
2860   OUTPUT @Src;"H"      !Operate OFF
2870   RETURN
2880 Data_process: !
2890   Count=Count+1
2900   SELECT Dut$(Dut_no)
2910   CASE "BATTERY"
2920     X1=Time_elapsed
2930     Y1=(Volt*2/Vc)*100-100  !전압 [%]
2940     Y2=(Curr/Ic)*100  !전류 [%]
2950   CASE "PTC"
2960     X1=Volt
2970     Y1=Curr
2980     Y2=0
2990   END SELECT 
3000   Y(1)=Y1
3010   Y(2)=Y2
3020   CONTROL @Strip;SET("POINT LOCATION":X1,"VALUES":Y(*))
3030   PRINT "Count=";Count;", T=";PROUND(Time_elapsed,-4);"m, V=";Volt;"V, I=";Curr;"A"
3040   OUTPUT @File1;Count,PROUND(Time_elapsed,-4),Volt,Curr
3050   Pre_v=Data
3060   SELECT Dut$(Dut_no)
3070   CASE "BATTERY"
3080     IF Battery$(Battery_no)="Li-S4" THEN
3090       GOSUB Reading34970
3100       OUTPUT @File3;Count,V(*)
3110     END IF 
3120   END SELECT 
3130   RETURN
3140 Reading: !
3150   LOOP
3160     GOSUB Reading1
3170   EXIT IF Data<>0
3180   END LOOP 
3190   RETURN
3200 Reading1: !
3210 ! 전압을 측정하면 나타나는 데이터 포맷
3220 ! 12345678901234
3230 !"DV +03.857E+0"   원래
3240 !" DV +03.857E+0"  앞에 공백이 하나 추가되어 나온 적이 있다.
3250 ! 전압를 측정하면 나타나는 데이터 포맷
3260 ! 12345678901234
3270 !"DI +0.6310E+0"   원래
3280   ENTER @Src;A1$
3290   A2$=TRIM$(A1$)   !앞뒤 공백 모두 없앤다
3300   Data=VAL(A2$[3,13])
3310   SELECT Dut$(Dut_no)
3320   CASE "BATTERY"
3330 ! Data=PROUND(Data,-3)  !소수점 3자리. 0.1mA까지 측정되면 너무 많은 데이터가 획득되므로
3340     Data=DROUND(Data,3)!유효수자 3자리
3350   END SELECT 
3360   RETURN
3370 Reading34970: !
3380   OUTPUT @Sw;"MEAS:VOLT:DC? (@201:204)"
3390   ENTER @Sw;V(*)
3400   RETURN
3410 Inst6143_open: !
3420   ASSIGN @Src TO 714    !advantest TR6143
3430   OUTPUT @Src;"C"       !initialize
3440   OUTPUT @Src;"OM1"     !ascii, OM0=set value, OM1=meas value
3450   SELECT Dut$(Dut_no)
3460   CASE "BATTERY"
3470     IF Battery$(Battery_no)="Li-S4" THEN
3480       GOSUB Inst34970_open
3490     END IF 
3500   END SELECT 
3510   RETURN
3520 Inst34970_open: !
3530   DIM V(4)      !4채널 전압
3540   ASSIGN @Sw TO 709     !Agilent 34970A
3550  ! OUTPUT @Sw;"CONF:VOLT:DC AUTO (@201:204)"
3560   OUTPUT @Sw;"SENS:VOLT:DC:RANG:AUTO ON,(@201:204)"
3570   OUTPUT @Sw;"SENS:VOLT:DC:NPLC 2,(@201:204)"
3580   RETURN
3590 Chart_var:   !
3600   SELECT Dut$(Dut_no)
3610   CASE "BATTERY"
3620     X_origin=0!time=0
3630     X_range=1*60        !1  hours *60min  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3640     X_axis_label$="Elapsed Time [Min]"
3650     Y_origin=-110
3660     Y_range=220
3670     Y_axis_label$="Volt & Current [%]"
3680   CASE "PTC"
3690     X_origin=Volt_start
3700     X_range=Volt_stop-Volt_start      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3710     X_axis_label$="Applied Volt [V]"
3720     Y_origin=0
3730     Y_range=Limit
3740     Y_axis_label$="Current [A]"
3750   END SELECT 
3760   RETURN
3770 Init_chart:   !
3780   DIM X_axis_label$[25],Y_axis_label$[25]
3790   INTEGER Trace_num
3800   INTEGER Screen_dims(1:2),Gwindow_dims(1:4)
3810   REAL Y(1:2)   !Y(1) Volt, Y(2) Current
3820   GESCAPE CRT,36;Screen_dims(*) ! Get screen width and height.
3830  !
3840  ! Set the dimensions of the graphics window using GESCAPE 33 so
3850  ! that it is centered on the screen.
3860  !
3870   Gwindow_dims(1)=Screen_dims(1)*.25 ! X of upper left.
3880   Gwindow_dims(2)=Screen_dims(2)*.2  ! Y of upper left.
3890   Gwindow_dims(3)=Screen_dims(1)*.7  ! Width.
3900   Gwindow_dims(4)=Screen_dims(2)*.6  ! Height.
3910   GESCAPE CRT,33;Gwindow_dims(*)     ! Set graphics window geometry.
3920  !
3930   GESCAPE CRT,35 ! Move the graphics window to the top.
3940  !
3950  ! Create a stripchart.  Make it invisible until all changes are made.
3960  !
3970   ASSIGN @Strip TO WIDGET "STRIPCHART";SET("VISIBLE":0)
3980  !
3990  ! Set the overall attributes.
4000  !
4010   CONTROL @Strip;SET("TITLE":"Data Logger")
4020   CONTROL @Strip;SET("MINIMUM SCROLL":2)
4030   CONTROL @Strip;SET("MOVABLE":0)
4040   CONTROL @Strip;SET("MAXIMIZABLE":0)
4050   CONTROL @Strip;SET("X":0,"Y":0)
4060  !
4070  ! Size the stripchart to exactly fill the graphics window.
4080  !
4090   Vert_borders=26
4100   Horiz_borders=8
4110   Height=Gwindow_dims(4)-Vert_borders
4120   Width=Gwindow_dims(3)-Horiz_borders
4130   CONTROL @Strip;SET("WIDTH":Width,"HEIGHT":Height)
4140  !
4150   CONTROL @Strip;SET("CURRENT AXIS":"X")
4160   CONTROL @Strip;SET("ORIGIN":X_origin,"RANGE":X_range)
4170   CONTROL @Strip;SET("AXIS LABEL":X_axis_label$)
4180  !CONTROL @Strip;SET("DIGITS":5)
4190  !
4200   CONTROL @Strip;SET("CURRENT AXIS":"Y")
4210   CONTROL @Strip;SET("ORIGIN":Y_origin,"RANGE":Y_range)
4220   CONTROL @Strip;SET("AXIS LABEL":Y_axis_label$)
4230  !
4240   CONTROL @Strip;SET("VISIBLE":1) ! Show the stripchart.
4250  !
4260   RETURN
4270   END