"TR6143-bas"의 두 판 사이의 차이
1번째 줄: | 1번째 줄: | ||
10 ! [[Advantest TR6143]] <pre> | 10 ! [[Advantest TR6143]] <pre> | ||
− | 20 ! 2020-01- | + | 20 ! 2020-01-10 |
− | 30 | + | 30 OPTION BASE 1 |
− | + | 40 GOSUB Battery_select | |
− | + | 50 GOSUB Fileopen | |
− | + | 60 GOSUB Inst_open | |
− | + | 70 GOSUB Stimulus_select | |
− | + | 80 GOSUB Measure | |
− | + | 90 GOSUB Fileclose | |
− | + | 100 STOP | |
− | + | 110 Measure: ! | |
− | + | 120 INTEGER Count,I | |
− | + | 130 DIM Cmd$[25],A1$[14],A2$[14],Test$[1] | |
− | + | 140 OUTPUT @File1;"No.,Time[m],Volt[V],Curr[A]" | |
− | + | 150 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]" | |
− | + | 160 GOSUB Chart_var | |
− | + | 170 GOSUB Init_chart | |
− | + | 180 Wait=.001 !계측기 세팅을 한 후, 첫 측정에서 측정값이 0이 나오는 현상 때문에 잠시 대기 시간 | |
− | + | 190 Count=0 | |
− | + | 200 Time_zero=TIMEDATE | |
− | + | 210 FOR I=1 TO 100 !배터리 충방전실험을 5회 실시 | |
− | + | 220 C_i_capa=0 | |
− | + | 230 C_w_capa=0 | |
− | + | 240 D_i_capa=0 | |
− | + | 250 D_w_capa=0 | |
− | + | 260 GOSUB Cycle | |
− | + | 270 OUTPUT @File2;I,C_time,C_i_capa,C_w_capa,D_time,-D_i_capa,-D_w_capa | |
− | + | 280 NEXT I | |
− | + | 290 RETURN | |
− | + | 300 Cycle: ! | |
− | + | 310 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
− | + | 320 !충전. +부호 정전류, 전압제한(전압을 읽는다.) | |
330 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 330 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
− | 340 | + | 340 Test$="C" |
− | + | 350 Cmd$="I4" !2A range | |
− | + | 360 Cmd$=Cmd$&" D"&VAL$(Ic)&"A" !D1.0A | |
− | + | 370 Cmd$=Cmd$&" D"&VAL$(Vc)&"V" !D4.2V | |
− | + | 380 OUTPUT @Src;Cmd$ !"I4 D1A D4.2V" | |
− | + | 390 OUTPUT @Src;"E" !Operate ON | |
− | + | 400 WAIT Wait | |
− | + | 410 C_start_time=TIMEDATE | |
− | + | 420 Pre_v=0 !최초 측정 전압=0으로 가정한다. | |
− | + | 430 Pre_t=C_start_time | |
− | + | 440 Curr=Ic | |
450 LOOP | 450 LOOP | ||
− | 460 | + | 460 T=TIMEDATE |
− | + | 470 Time_elapsed=(T-Time_zero)/60 | |
− | + | 480 GOSUB Reading | |
− | + | 490 Volt=Data | |
− | 500 IF | + | 500 IF Volt>Pre_v THEN !충전 전압이 상승하면 |
510 GOSUB Data_process | 510 GOSUB Data_process | ||
− | 520 END IF | + | 520 C_i_capa=C_i_capa+(Curr*1000)*((T-Pre_t)/3600) !mAh = mA x hour |
− | + | 530 C_w_capa=C_w_capa+Curr*Volt*((T-Pre_t)/3600) !Wh = A x V x hour | |
− | + | 540 Pre_t=T | |
− | + | 550 END IF | |
− | + | 560 EXIT IF Volt>=Vc !측정 전압이 충전최고 전압에 도달하면 | |
− | + | 570 END LOOP | |
− | + | 580 OUTPUT @Src;"H" !Operate OFF | |
590 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 590 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
− | 600 | + | 600 !충전, 충전 최고전압에 도달하면. 정전압, 전류제한(전류를 읽는다.) |
− | 610 Cmd$="V5" !32V range | + | 610 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
− | + | 620 Cmd$="V5" !32V range | |
− | + | 630 Cmd$=Cmd$&" D"&VAL$(Vc)&"V" !D4.2V | |
− | + | 640 Cmd$=Cmd$&" D"&VAL$(Ic)&"A" !D1.0A | |
− | + | 650 OUTPUT @Src;Cmd$ !"V5 D 4.2V D 1.0A" | |
− | + | 660 OUTPUT @Src;"E" !Operate ON | |
− | + | 670 WAIT Wait | |
− | + | 680 Pre_v=Ic !충전 전류(Ic)를 초기값으로 기억한다. | |
− | + | 690 Volt=Vc !충전전압은 일정하다. | |
− | + | 700 LOOP | |
− | + | 710 T=TIMEDATE | |
− | + | 720 Time_elapsed=(T-Time_zero)/60 | |
− | + | 730 GOSUB Reading !충전전압에 도달되었기 때문에, 서서히 줄어드는 충전 전류를 측정한다. | |
− | + | 740 Curr=Data | |
− | + | 750 IF Curr<Pre_v THEN !측정 전류가 서서히 낮아지면 | |
− | + | 760 GOSUB Data_process | |
− | + | 770 C_i_capa=C_i_capa+(Curr*1000)*((T-Pre_t)/3600) !mAh = mA x hour | |
− | + | 780 C_w_capa=C_w_capa+Curr*Volt*((T-Pre_t)/3600) !WA = A x V x hour | |
− | + | 790 Pre_t=T | |
− | + | 800 END IF | |
− | + | 810 EXIT IF Curr<=Ic_end !현재 전류가 종료전류에 도달하면 | |
− | + | 820 END LOOP | |
− | + | 830 C_time=(T-C_start_time)/60 | |
− | + | 840 OUTPUT @Src;"H" !Operate OFF | |
− | + | 850 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
− | + | 860 !방전 전류는 -로 표기한다. | |
− | + | 870 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
− | + | 880 Test$="D" | |
− | + | 890 Cmd$="I4" !2A range | |
− | + | 900 Cmd$=Cmd$&" D"&VAL$(Id)&"A" !D-1.0A | |
− | + | 910 Cmd$=Cmd$&" D"&VAL$(Vc)&"V" !D4.2V | |
− | + | 920 OUTPUT @Src;Cmd$ !"I4 D1A D4.2V" | |
− | + | 930 OUTPUT @Src;"E" !Operate ON | |
− | + | 940 WAIT Wait | |
− | + | 950 Pre_v=Vc | |
− | + | 960 D_start_time=TIMEDATE | |
− | + | 970 Pre_t=D_start_time | |
− | + | 980 Curr=Id !방전전류(-값을 갖는다.)는 일정하다. | |
− | + | 990 LOOP | |
− | + | 1000 T=TIMEDATE | |
− | + | 1010 Time_elapsed=(T-Time_zero)/60 | |
− | + | 1020 GOSUB Reading !일정 전류 방전 , 전압이 측정된다. | |
− | + | 1030 Volt=Data | |
− | + | 1040 IF Volt<Pre_v THEN !측정전압이 서서히 낮아지면(방전이므로) | |
− | + | 1050 GOSUB Data_process | |
− | + | 1060 D_i_capa=D_i_capa+(Curr*1000)*((T-Pre_t)/3600) !mAh = mA x hour | |
− | + | 1070 D_w_capa=D_w_capa+Curr*Volt*((T-Pre_t)/3600) !Wh = A x V x hour | |
− | + | 1080 Pre_t=T | |
− | + | 1090 END IF | |
− | + | 1100 EXIT IF Volt<=Vd !현재 전압이 충전전압에 도달하면 | |
− | + | 1110 END LOOP | |
− | + | 1120 D_time=(T-D_start_time)/60 | |
− | + | 1130 OUTPUT @Src;"H" !Operate OFF | |
− | + | 1140 RETURN | |
− | + | 1150 Data_process: ! | |
− | + | 1160 ! Count=Count+1 | |
− | + | 1170 Y1=(Volt*2/Vc)*100-100 !전압 [%] | |
− | + | 1180 Y2=(Curr/Ic)*100 !전류 [%] | |
− | + | 1190 Y(1)=Y1 | |
− | + | 1200 Y(2)=Y2 | |
− | + | 1210 CONTROL @Strip;SET("POINT LOCATION":Time_elapsed,"VALUES":Y(*)) | |
− | + | 1220 PRINT "Count=";Count;", T=";PROUND(Time_elapsed,-4);"m, V=";Volt;"V, I=";Curr;"A" | |
− | + | 1230 OUTPUT @File1;Count,PROUND(Time_elapsed,-4),Volt,Curr | |
− | + | 1240 Pre_v=Data | |
− | + | 1250 RETURN | |
− | + | 1260 Reading: ! | |
− | + | 1270 LOOP | |
− | + | 1280 GOSUB Reading1 | |
− | + | 1290 EXIT IF Data<>0 | |
− | + | 1300 END LOOP | |
− | + | 1310 RETURN | |
− | + | 1320 Reading1: ! | |
− | + | 1330 ! 전압을 측정하면 나타나는 데이터 포맷 | |
− | + | 1340 ! 12345678901234 | |
− | + | 1350 !"DV +03.857E+0" 원래 | |
− | + | 1360 !" DV +03.857E+0" 앞에 공백이 하나 추가되어 나온 적이 있다. | |
− | + | 1370 ! 전압를 측정하면 나타나는 데이터 포맷 | |
− | + | 1380 ! 12345678901234 | |
− | + | 1390 !"DI +0.6310E+0" 원래 | |
− | + | 1400 ENTER @Src;A1$ | |
− | + | 1410 A2$=TRIM$(A1$) !앞뒤 공백 모두 없앤다 | |
− | + | 1420 Data=VAL(A2$[3,13]) | |
− | + | 1430 ! Data=PROUND(Data,-3) !소수점 3자리. 0.1mA까지 측정되면 너무 많은 데이터가 획득되므로 | |
− | + | 1440 Data=DROUND(Data,3) !유효수자 3자리 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
1450 RETURN | 1450 RETURN | ||
− | 1460 | + | 1460 Fileopen: ! |
− | 1470 DIM | + | 1470 DIM Filename1$[20],Filename2$[20],Dhms$[8] |
− | 1480 | + | 1480 T=TIMEDATE |
− | 1490 | + | 1490 Time$=TIME$(T) !하루가 늦게 계산되므로 하루 추가 +24*3600 |
− | 1500 | + | 1500 Date$=DATE$(T) |
− | 1510 | + | 1510 Dhms$=Date$[1;2]&Time$[1;2]&Time$[4;2]&Time$[7;2] |
− | 1520 | + | 1520 Filename1$=Dhms$&".txt" |
− | 1530 | + | 1530 CREATE Filename1$,1 |
− | 1540 | + | 1540 ASSIGN @File1 TO Filename1$;FORMAT ON |
− | 1550 | + | 1550 T=T+1 !1초 늦게 |
− | 1560 | + | 1560 Time$=TIME$(T) !하루가 늦게 계산되므로 하루 추가 +24*3600 |
− | 1570 | + | 1570 Date$=DATE$(T) |
− | 1580 | + | 1580 Dhms$=Date$[1;2]&Time$[1;2]&Time$[4;2]&Time$[7;2] |
− | 1590 | + | 1590 Filename2$=Dhms$&".txt" |
− | 1600 | + | 1600 CREATE Filename2$,1 |
− | 1610 | + | 1610 ASSIGN @File2 TO Filename2$;FORMAT ON |
1620 RETURN | 1620 RETURN | ||
− | 1630 Inst_open: ! | + | 1630 Fileclose:! |
− | + | 1640 ASSIGN @File1 TO * | |
− | + | 1650 ASSIGN @File2 TO * | |
− | + | 1660 RETURN | |
− | + | 1670 Battery_select: ! | |
− | + | 1680 DIM Msg$[25] | |
− | + | 1690 INTEGER Size,Length,Btn,Battery_no | |
− | + | 1700 Size=4 | |
− | + | 1710 Length=6 | |
− | + | 1720 ALLOCATE Battery$(Size)[Length] | |
− | + | 1730 Battery$(1)="Li" | |
− | + | 1740 Battery$(2)="NiCd" | |
− | + | 1750 Battery$(3)="3-NiCd" | |
− | + | 1760 Battery$(4)="EDLC" | |
− | + | 1770 Msg$="배터리 종류" | |
− | + | 1780 DIALOG "LIST",Msg$,Btn;SET("ITEMS":Battery$(*),"COLUMNS":Length,"ROWS":Size),RETURN("SELECTION":Battery_no) | |
− | + | 1790 Battery_no=Battery_no+1 | |
− | + | 1800 RETURN | |
− | + | 1810 Inst_open: ! | |
− | + | 1820 ASSIGN @Src TO 714 !advantest TR6143 | |
− | + | 1830 RETURN | |
− | + | 1840 Stimulus_select: ! | |
− | + | 1850 SELECT Battery$(Battery_no) | |
− | + | 1860 CASE "Li" | |
− | + | 1870 Vc=4.2 !4.2V 충전전압 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
− | + | 1880 Vd=3.2 !3.2V 방전종료전압 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
− | + | 1890 Ic=2 !100mA 충전전류 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
− | + | 1900 Ic_end=.5 !충전 종료 전류 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
− | + | 1910 Id=-2 !100mA 방전전류 음수 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
− | + | 1920 CASE "NiCd" !표준 1.2V | |
− | + | 1930 Vc=1.3 !1.5V 충전전압 | |
− | + | 1940 Vd=.9 !0.9V 방전종료전압 | |
− | + | 1950 Ic=.001 !100mA 충전전류 | |
− | + | 1960 Ic_end=.0005 !충전 종료 전류 | |
− | + | 1970 Id=-.0001 !100mA 방전전류 음수 | |
− | + | 1980 CASE "3-NiCd" !표준 3.6V | |
− | + | 1990 Vc=4.7 !4.1V 충전전압 | |
− | + | 2000 Vd=1.5 !3.1V 방전종료전압 | |
− | + | 2010 Ic=.0005 !100mA 충전전류 | |
− | + | 2020 Ic_end=.00035 !충전 종료 전류 | |
− | + | 2030 Id=-5.E-5 !100mA 방전전류 음수 | |
− | + | 2040 CASE "" | |
− | + | 2050 Msg$="충전전류[A], 방전전류[A], 충전종료전류[A], " | |
− | + | 2060 END SELECT | |
− | + | 2070 !GOSUB Dialog_string3 | |
− | + | 2080 RETURN | |
− | + | 2090 Chart_var: ! | |
− | + | 2100 X_origin=0 !time=0 | |
− | + | 2110 X_range=.1*60 !1 hours *60min | |
− | + | 2120 X_axis_label$="Elapsed Time [Min]" | |
− | + | 2130 Y_origin=-110 | |
− | + | 2140 Y_range=220 | |
− | + | 2150 Y_axis_label$="Volt & Current [%]" | |
− | + | 2160 RETURN | |
− | + | 2170 Init_chart: ! | |
− | + | 2180 DIM X_axis_label$[25],Y_axis_label$[25] | |
− | + | 2190 INTEGER Trace_num | |
− | + | 2200 INTEGER Screen_dims(1:2),Gwindow_dims(1:4) | |
− | + | 2210 REAL Y(1:2) !Y(1) Volt, Y(2) Current | |
− | + | 2220 GESCAPE CRT,36;Screen_dims(*) ! Get screen width and height. | |
− | + | 2230 ! | |
− | + | 2240 ! Set the dimensions of the graphics window using GESCAPE 33 so | |
− | + | 2250 ! that it is centered on the screen. | |
− | + | 2260 ! | |
− | + | 2270 Gwindow_dims(1)=Screen_dims(1)*.25 ! X of upper left. | |
− | + | 2280 Gwindow_dims(2)=Screen_dims(2)*.2 ! Y of upper left. | |
− | + | 2290 Gwindow_dims(3)=Screen_dims(1)*.7 ! Width. | |
− | + | 2300 Gwindow_dims(4)=Screen_dims(2)*.6 ! Height. | |
− | + | 2310 GESCAPE CRT,33;Gwindow_dims(*) ! Set graphics window geometry. | |
− | + | 2320 ! | |
− | + | 2330 GESCAPE CRT,35 ! Move the graphics window to the top. | |
− | + | 2340 ! | |
− | + | 2350 ! Create a stripchart. Make it invisible until all changes are made. | |
2360 ! | 2360 ! | ||
− | 2370 CONTROL @Strip;SET("CURRENT AXIS":"X") | + | 2370 ASSIGN @Strip TO WIDGET "STRIPCHART";SET("VISIBLE":0) |
− | + | 2380 ! | |
− | + | 2390 ! Set the overall attributes. | |
− | + | 2400 ! | |
− | + | 2410 CONTROL @Strip;SET("TITLE":"Data Logger") | |
− | + | 2420 CONTROL @Strip;SET("MINIMUM SCROLL":2) | |
− | + | 2430 CONTROL @Strip;SET("MOVABLE":0) | |
− | + | 2440 CONTROL @Strip;SET("MAXIMIZABLE":0) | |
− | + | 2450 CONTROL @Strip;SET("X":0,"Y":0) | |
− | + | 2460 ! | |
− | + | 2470 ! Size the stripchart to exactly fill the graphics window. | |
− | + | 2480 ! | |
− | + | 2490 Vert_borders=26 | |
+ | 2500 Horiz_borders=8 | ||
+ | 2510 Height=Gwindow_dims(4)-Vert_borders | ||
+ | 2520 Width=Gwindow_dims(3)-Horiz_borders | ||
+ | 2530 CONTROL @Strip;SET("WIDTH":Width,"HEIGHT":Height) | ||
+ | 2540 ! | ||
+ | 2550 CONTROL @Strip;SET("CURRENT AXIS":"X") | ||
+ | 2560 CONTROL @Strip;SET("ORIGIN":X_origin,"RANGE":X_range) | ||
+ | 2570 CONTROL @Strip;SET("AXIS LABEL":X_axis_label$) | ||
+ | 2580 !CONTROL @Strip;SET("DIGITS":5) | ||
+ | 2590 ! | ||
+ | 2600 CONTROL @Strip;SET("CURRENT AXIS":"Y") | ||
+ | 2610 CONTROL @Strip;SET("ORIGIN":Y_origin,"RANGE":Y_range) | ||
+ | 2620 CONTROL @Strip;SET("AXIS LABEL":Y_axis_label$) | ||
+ | 2630 ! | ||
+ | 2640 CONTROL @Strip;SET("VISIBLE":1) ! Show the stripchart. | ||
+ | 2650 ! | ||
+ | 2660 RETURN | ||
+ | 2670 END |
2020년 1월 16일 (목) 12:19 판
10 ! Advantest TR6143
20 ! 2020-01-10 30 OPTION BASE 1 40 GOSUB Battery_select 50 GOSUB Fileopen 60 GOSUB Inst_open 70 GOSUB Stimulus_select 80 GOSUB Measure 90 GOSUB Fileclose 100 STOP 110 Measure: ! 120 INTEGER Count,I 130 DIM Cmd$[25],A1$[14],A2$[14],Test$[1] 140 OUTPUT @File1;"No.,Time[m],Volt[V],Curr[A]" 150 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]" 160 GOSUB Chart_var 170 GOSUB Init_chart 180 Wait=.001 !계측기 세팅을 한 후, 첫 측정에서 측정값이 0이 나오는 현상 때문에 잠시 대기 시간 190 Count=0 200 Time_zero=TIMEDATE 210 FOR I=1 TO 100 !배터리 충방전실험을 5회 실시 220 C_i_capa=0 230 C_w_capa=0 240 D_i_capa=0 250 D_w_capa=0 260 GOSUB Cycle 270 OUTPUT @File2;I,C_time,C_i_capa,C_w_capa,D_time,-D_i_capa,-D_w_capa 280 NEXT I 290 RETURN 300 Cycle: ! 310 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 320 !충전. +부호 정전류, 전압제한(전압을 읽는다.) 330 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 340 Test$="C" 350 Cmd$="I4" !2A range 360 Cmd$=Cmd$&" D"&VAL$(Ic)&"A" !D1.0A 370 Cmd$=Cmd$&" D"&VAL$(Vc)&"V" !D4.2V 380 OUTPUT @Src;Cmd$ !"I4 D1A D4.2V" 390 OUTPUT @Src;"E" !Operate ON 400 WAIT Wait 410 C_start_time=TIMEDATE 420 Pre_v=0 !최초 측정 전압=0으로 가정한다. 430 Pre_t=C_start_time 440 Curr=Ic 450 LOOP 460 T=TIMEDATE 470 Time_elapsed=(T-Time_zero)/60 480 GOSUB Reading 490 Volt=Data 500 IF Volt>Pre_v THEN !충전 전압이 상승하면 510 GOSUB Data_process 520 C_i_capa=C_i_capa+(Curr*1000)*((T-Pre_t)/3600) !mAh = mA x hour 530 C_w_capa=C_w_capa+Curr*Volt*((T-Pre_t)/3600) !Wh = A x V x hour 540 Pre_t=T 550 END IF 560 EXIT IF Volt>=Vc !측정 전압이 충전최고 전압에 도달하면 570 END LOOP 580 OUTPUT @Src;"H" !Operate OFF 590 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 600 !충전, 충전 최고전압에 도달하면. 정전압, 전류제한(전류를 읽는다.) 610 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 620 Cmd$="V5" !32V range 630 Cmd$=Cmd$&" D"&VAL$(Vc)&"V" !D4.2V 640 Cmd$=Cmd$&" D"&VAL$(Ic)&"A" !D1.0A 650 OUTPUT @Src;Cmd$ !"V5 D 4.2V D 1.0A" 660 OUTPUT @Src;"E" !Operate ON 670 WAIT Wait 680 Pre_v=Ic !충전 전류(Ic)를 초기값으로 기억한다. 690 Volt=Vc !충전전압은 일정하다. 700 LOOP 710 T=TIMEDATE 720 Time_elapsed=(T-Time_zero)/60 730 GOSUB Reading !충전전압에 도달되었기 때문에, 서서히 줄어드는 충전 전류를 측정한다. 740 Curr=Data 750 IF Curr<Pre_v THEN !측정 전류가 서서히 낮아지면 760 GOSUB Data_process 770 C_i_capa=C_i_capa+(Curr*1000)*((T-Pre_t)/3600) !mAh = mA x hour 780 C_w_capa=C_w_capa+Curr*Volt*((T-Pre_t)/3600) !WA = A x V x hour 790 Pre_t=T 800 END IF 810 EXIT IF Curr<=Ic_end !현재 전류가 종료전류에 도달하면 820 END LOOP 830 C_time=(T-C_start_time)/60 840 OUTPUT @Src;"H" !Operate OFF 850 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 860 !방전 전류는 -로 표기한다. 870 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 880 Test$="D" 890 Cmd$="I4" !2A range 900 Cmd$=Cmd$&" D"&VAL$(Id)&"A" !D-1.0A 910 Cmd$=Cmd$&" D"&VAL$(Vc)&"V" !D4.2V 920 OUTPUT @Src;Cmd$ !"I4 D1A D4.2V" 930 OUTPUT @Src;"E" !Operate ON 940 WAIT Wait 950 Pre_v=Vc 960 D_start_time=TIMEDATE 970 Pre_t=D_start_time 980 Curr=Id !방전전류(-값을 갖는다.)는 일정하다. 990 LOOP 1000 T=TIMEDATE 1010 Time_elapsed=(T-Time_zero)/60 1020 GOSUB Reading !일정 전류 방전 , 전압이 측정된다. 1030 Volt=Data 1040 IF Volt<Pre_v THEN !측정전압이 서서히 낮아지면(방전이므로) 1050 GOSUB Data_process 1060 D_i_capa=D_i_capa+(Curr*1000)*((T-Pre_t)/3600) !mAh = mA x hour 1070 D_w_capa=D_w_capa+Curr*Volt*((T-Pre_t)/3600) !Wh = A x V x hour 1080 Pre_t=T 1090 END IF 1100 EXIT IF Volt<=Vd !현재 전압이 충전전압에 도달하면 1110 END LOOP 1120 D_time=(T-D_start_time)/60 1130 OUTPUT @Src;"H" !Operate OFF 1140 RETURN 1150 Data_process: ! 1160 ! Count=Count+1 1170 Y1=(Volt*2/Vc)*100-100 !전압 [%] 1180 Y2=(Curr/Ic)*100 !전류 [%] 1190 Y(1)=Y1 1200 Y(2)=Y2 1210 CONTROL @Strip;SET("POINT LOCATION":Time_elapsed,"VALUES":Y(*)) 1220 PRINT "Count=";Count;", T=";PROUND(Time_elapsed,-4);"m, V=";Volt;"V, I=";Curr;"A" 1230 OUTPUT @File1;Count,PROUND(Time_elapsed,-4),Volt,Curr 1240 Pre_v=Data 1250 RETURN 1260 Reading: ! 1270 LOOP 1280 GOSUB Reading1 1290 EXIT IF Data<>0 1300 END LOOP 1310 RETURN 1320 Reading1: ! 1330 ! 전압을 측정하면 나타나는 데이터 포맷 1340 ! 12345678901234 1350 !"DV +03.857E+0" 원래 1360 !" DV +03.857E+0" 앞에 공백이 하나 추가되어 나온 적이 있다. 1370 ! 전압를 측정하면 나타나는 데이터 포맷 1380 ! 12345678901234 1390 !"DI +0.6310E+0" 원래 1400 ENTER @Src;A1$ 1410 A2$=TRIM$(A1$) !앞뒤 공백 모두 없앤다 1420 Data=VAL(A2$[3,13]) 1430 ! Data=PROUND(Data,-3) !소수점 3자리. 0.1mA까지 측정되면 너무 많은 데이터가 획득되므로 1440 Data=DROUND(Data,3) !유효수자 3자리 1450 RETURN 1460 Fileopen: ! 1470 DIM Filename1$[20],Filename2$[20],Dhms$[8] 1480 T=TIMEDATE 1490 Time$=TIME$(T) !하루가 늦게 계산되므로 하루 추가 +24*3600 1500 Date$=DATE$(T) 1510 Dhms$=Date$[1;2]&Time$[1;2]&Time$[4;2]&Time$[7;2] 1520 Filename1$=Dhms$&".txt" 1530 CREATE Filename1$,1 1540 ASSIGN @File1 TO Filename1$;FORMAT ON 1550 T=T+1 !1초 늦게 1560 Time$=TIME$(T) !하루가 늦게 계산되므로 하루 추가 +24*3600 1570 Date$=DATE$(T) 1580 Dhms$=Date$[1;2]&Time$[1;2]&Time$[4;2]&Time$[7;2] 1590 Filename2$=Dhms$&".txt" 1600 CREATE Filename2$,1 1610 ASSIGN @File2 TO Filename2$;FORMAT ON 1620 RETURN 1630 Fileclose:! 1640 ASSIGN @File1 TO * 1650 ASSIGN @File2 TO * 1660 RETURN 1670 Battery_select: ! 1680 DIM Msg$[25] 1690 INTEGER Size,Length,Btn,Battery_no 1700 Size=4 1710 Length=6 1720 ALLOCATE Battery$(Size)[Length] 1730 Battery$(1)="Li" 1740 Battery$(2)="NiCd" 1750 Battery$(3)="3-NiCd" 1760 Battery$(4)="EDLC" 1770 Msg$="배터리 종류" 1780 DIALOG "LIST",Msg$,Btn;SET("ITEMS":Battery$(*),"COLUMNS":Length,"ROWS":Size),RETURN("SELECTION":Battery_no) 1790 Battery_no=Battery_no+1 1800 RETURN 1810 Inst_open: ! 1820 ASSIGN @Src TO 714 !advantest TR6143 1830 RETURN 1840 Stimulus_select: ! 1850 SELECT Battery$(Battery_no) 1860 CASE "Li" 1870 Vc=4.2 !4.2V 충전전압 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1880 Vd=3.2 !3.2V 방전종료전압 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1890 Ic=2 !100mA 충전전류 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1900 Ic_end=.5 !충전 종료 전류 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1910 Id=-2 !100mA 방전전류 음수 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1920 CASE "NiCd" !표준 1.2V 1930 Vc=1.3 !1.5V 충전전압 1940 Vd=.9 !0.9V 방전종료전압 1950 Ic=.001 !100mA 충전전류 1960 Ic_end=.0005 !충전 종료 전류 1970 Id=-.0001 !100mA 방전전류 음수 1980 CASE "3-NiCd" !표준 3.6V 1990 Vc=4.7 !4.1V 충전전압 2000 Vd=1.5 !3.1V 방전종료전압 2010 Ic=.0005 !100mA 충전전류 2020 Ic_end=.00035 !충전 종료 전류 2030 Id=-5.E-5 !100mA 방전전류 음수 2040 CASE "" 2050 Msg$="충전전류[A], 방전전류[A], 충전종료전류[A], " 2060 END SELECT 2070 !GOSUB Dialog_string3 2080 RETURN 2090 Chart_var: ! 2100 X_origin=0 !time=0 2110 X_range=.1*60 !1 hours *60min 2120 X_axis_label$="Elapsed Time [Min]" 2130 Y_origin=-110 2140 Y_range=220 2150 Y_axis_label$="Volt & Current [%]" 2160 RETURN 2170 Init_chart: ! 2180 DIM X_axis_label$[25],Y_axis_label$[25] 2190 INTEGER Trace_num 2200 INTEGER Screen_dims(1:2),Gwindow_dims(1:4) 2210 REAL Y(1:2) !Y(1) Volt, Y(2) Current 2220 GESCAPE CRT,36;Screen_dims(*) ! Get screen width and height. 2230 ! 2240 ! Set the dimensions of the graphics window using GESCAPE 33 so 2250 ! that it is centered on the screen. 2260 ! 2270 Gwindow_dims(1)=Screen_dims(1)*.25 ! X of upper left. 2280 Gwindow_dims(2)=Screen_dims(2)*.2 ! Y of upper left. 2290 Gwindow_dims(3)=Screen_dims(1)*.7 ! Width. 2300 Gwindow_dims(4)=Screen_dims(2)*.6 ! Height. 2310 GESCAPE CRT,33;Gwindow_dims(*) ! Set graphics window geometry. 2320 ! 2330 GESCAPE CRT,35 ! Move the graphics window to the top. 2340 ! 2350 ! Create a stripchart. Make it invisible until all changes are made. 2360 ! 2370 ASSIGN @Strip TO WIDGET "STRIPCHART";SET("VISIBLE":0) 2380 ! 2390 ! Set the overall attributes. 2400 ! 2410 CONTROL @Strip;SET("TITLE":"Data Logger") 2420 CONTROL @Strip;SET("MINIMUM SCROLL":2) 2430 CONTROL @Strip;SET("MOVABLE":0) 2440 CONTROL @Strip;SET("MAXIMIZABLE":0) 2450 CONTROL @Strip;SET("X":0,"Y":0) 2460 ! 2470 ! Size the stripchart to exactly fill the graphics window. 2480 ! 2490 Vert_borders=26 2500 Horiz_borders=8 2510 Height=Gwindow_dims(4)-Vert_borders 2520 Width=Gwindow_dims(3)-Horiz_borders 2530 CONTROL @Strip;SET("WIDTH":Width,"HEIGHT":Height) 2540 ! 2550 CONTROL @Strip;SET("CURRENT AXIS":"X") 2560 CONTROL @Strip;SET("ORIGIN":X_origin,"RANGE":X_range) 2570 CONTROL @Strip;SET("AXIS LABEL":X_axis_label$) 2580 !CONTROL @Strip;SET("DIGITS":5) 2590 ! 2600 CONTROL @Strip;SET("CURRENT AXIS":"Y") 2610 CONTROL @Strip;SET("ORIGIN":Y_origin,"RANGE":Y_range) 2620 CONTROL @Strip;SET("AXIS LABEL":Y_axis_label$) 2630 ! 2640 CONTROL @Strip;SET("VISIBLE":1) ! Show the stripchart. 2650 ! 2660 RETURN 2670 END