6612c-bas.txt

6612C

10     ! 2018-12-18   measure1 = 충전시 전압 측정(배터리 내부 저항이 낮아 반드시 4-wire)
20     ! 2019-06-20   measure2 = 전류에 따른 8842로 전압 전류측정
30     ! 2019-06-26   measure3 = 전압 전류 측정
40     ! 2020-08-11   measure31 = 전압 전류 차이 측정
50     ! 2019-06-26   measure4 = V-I       측정
60     OPTION BASE 1
70     ASSIGN @Ps6612c TO 701  !오븐도 701이다. 오븐은 보통 켜져 있다. 주의
80     GOSUB Fileopen
90     GOSUB Measure31
100    GOSUB Fileclose
110    STOP
120 Measure2:  !
130    ASSIGN @Dmmv TO 702 !
140    ASSIGN @Dmmi TO 703
150    Set_volt_max=20  !
160    Set_curr_max=.05  !6612C max 2A
170    Nop=201
180    Set_time=100  ! x축 그래프 최대 시간 초
190    OUTPUT @Ps6612c;"VOLT ";Set_volt_max!charge
200    OUTPUT @Ps6612c;"CURR ";0
210    OUTPUT @Ps6612c;"OUTP ON"
220    OUTPUT @File;"No.,Time[s],Volt[V],Curr[A]"
230    T0=TIMEDATE
240    I=0
250    GOSUB Chart_var
260    GOSUB Init_chart
270    FOR I=1 TO Nop
280      Time=(TIMEDATE-T0)
290      Set_curr=Set_curr_max/Nop*(I)
300      OUTPUT @Ps6612c;"CURR ";Set_curr
310      GOSUB Reading2
320      Y(1)=Volt
330      Y(2)=Curr
340      CONTROL @Strip;SET("POINT LOCATION":Time,"VALUES":Y(*))
350      PRINT "I=";I;", T=";Time;", V=";Volt;", I=";Curr
360      OUTPUT @File;I,Time,Volt,Curr
370      WAIT .01
380      BEEP
390    NEXT I
400    OUTPUT @Ps6612c;"OUTP OFF"
410    RETURN
420 Measure3:  !
430    OUTPUT @Ps6612c;"VOLT 3"
440    OUTPUT @Ps6612c;"CURR 1"
450    OUTPUT @Ps6612c;"OUTP ON"
460    OUTPUT @File;"No.,Time[s],Volt[V],Curr[A]"
470    T0=TIMEDATE
480    I=0
490    LOOP
500      Time=TIMEDATE-T0
510      I=I+1
520      GOSUB Reading1
530    ! PRINT "I=";I;", T=";Time;", V=";Volt;", I=";Curr
540      OUTPUT @File;I,Time,Volt,Curr
550    EXIT IF Time>600
560    END LOOP 
570    OUTPUT @Ps6612c;"OUTP OFF"
580    RETURN
590 Measure31:  !
600    OUTPUT @Ps6612c;"VOLT 3"
610    OUTPUT @Ps6612c;"CURR 0.01"
620    OUTPUT @Ps6612c;"OUTP ON"
630    OUTPUT @File;"No.,Time[s],Volt[V],Curr[A]"
640    T0=TIMEDATE
650    I=0
660    Pre_volt=0
670    Pre_curr=0
680    LOOP
690      GOSUB Reading1
700      Diff_v=ABS(Volt-Pre_volt)/Volt*100  !전압차이를 %
710      Diff_i=ABS(Curr-Pre_curr)/Curr*100   !전류차이를 %
720      IF (Diff_v>.1) OR (Diff_i>.1) THEN           !전압이 0.1% 차이 또는 전류가 0.1% 차이가 발생되면
730        Time=TIMEDATE-T0
740        BEEP
750        I=I+1
760        DISP I
770   !    PRINT "I=";I;", T=";Time;", V=";Volt;", I=";Curr
780        OUTPUT @File;I,Time,Volt,Curr
790        Pre_volt=Volt
800        Pre_curr=Curr
810      END IF 
820    EXIT IF Time>1200
830    END LOOP 
840    OUTPUT @Ps6612c;"OUTP OFF"
850    RETURN
860 Measure4:  !
870    OUTPUT @Ps6612c;"CURR 1"
880    OUTPUT @Ps6612c;"OUTP ON"
890    OUTPUT @File;"No.,Time[s],Volt[V],Curr[A]"
900    T0=TIMEDATE
910    I=0
920    FOR Volt=0 TO 12 STEP .1
930      I=I+1
940      WAIT .1
950      Time=TIMEDATE-T0
960      OUTPUT @Ps6612c;"VOLT ";Volt
970      GOSUB Reading1
980      PRINT "I=";I;", T=";Time;", V=";Volt;", I=";Curr
990      OUTPUT @File;I,Time,Volt,Curr
1000   NEXT Volt
1010   OUTPUT @Ps6612c;"OUTP OFF"
1020   RETURN
1030 Measure1: !
1040   Set_volt_max=4.2  !9  !1.5V x 6ea
1050   Set_volt_min=3.2 !5.4  !0.9V x 6ea
1060   Set_current=1
1070   Set_time=6  ! x축 그래프 최대 시간 hours
1080   OUTPUT @Ps6612c;"VOLT ";Set_volt_max    !charge
1090   OUTPUT @Ps6612c;"CURR ";Set_current
1100   OUTPUT @File;"No.,Time[h],Volt[V],Curr[A]"
1110   I=0
1120   GOSUB Chart_var
1130   GOSUB Init_chart
1140   Pre_volt=0
1150   Pre_curr=0
1160   T0=TIMEDATE
1170   OUTPUT @Ps6612c;"OUTP ON"
1180   LOOP
1190     Time=(TIMEDATE-T0)/3600.  !초를 시로
1200     GOSUB Reading1
1210     Diff_v=ABS(Volt-Pre_volt)/Volt*100  !전압차이를 %
1220     Diff_i=ABS(Curr-Pre_curr)/Curr*100   !전류차이를 %
1230     IF (Diff_v>.5) OR (Diff_i>.5) THEN           !전압이 0.1% 차이 또는 전류가 0.1% 차이가 발생되면
1240       BEEP
1250       I=I+1
1260       !Y(1)=LOG(Volt)/LOG(10)
1270       Y(1)=Volt
1280       Y(2)=(Set_volt_max-Set_volt_min)/Set_current*Curr+Set_volt_min
1290       CONTROL @Strip;SET("POINT LOCATION":Time,"VALUES":Y(*))
1300       PRINT "Count=";I;", T=";DROUND(Time,3);", V=";DROUND(Volt,3);", I=";DROUND(Curr,3)
1310       OUTPUT @File;I,Time,Volt,Curr
1320       Pre_volt=Volt
1330       Pre_curr=Curr
1340     ! WAIT 1
1350     END IF 
1360   EXIT IF Time>Set_time
1370   EXIT IF Curr<.1             !전류가 0.1A 이하이면 중단
1380 ! EXIT IF Curr<Set_current*.1
1390   END LOOP 
1400   OUTPUT @Ps6612c;"OUTP OFF"
1410   RETURN
1420 Reading1: !
1430   OUTPUT @Ps6612c;"MEAS:VOLT?"
1440   ENTER @Ps6612c;Volt
1450  !Volt=DROUND(Volt,5)  !유효자리수 5자리로
1460   OUTPUT @Ps6612c;"MEAS:CURR?"
1470   ENTER @Ps6612c;Curr
1480  !Curr=DROUND(Curr,5)  !유효자리수 5자리로
1490   RETURN
1500 Reading2:  !
1510   ENTER @Dmmv;Volt
1520   ENTER @Dmmi;Curr
1530   RETURN
1540 Fileopen: !
1550   DIM Filename$[20],Dhms$[8]
1560   Time$=TIME$(TIMEDATE)
1570   Date$=DATE$(TIMEDATE)
1580   Dhms$=Date$[1;2]&Time$[1;2]&Time$[4;2]&Time$[7;2]
1590   Filename$=Dhms$&".txt"
1600   CREATE Filename$,1
1610   ASSIGN @File TO Filename$;FORMAT ON
1620   RETURN
1630 Fileclose:!
1640   ASSIGN @File TO *
1650   RETURN
1660 Chart_var:   !
1670   X_origin=0
1680   X_range=Set_time
1690   X_axis_label$="Time [hour]"
1700   Y_origin=Set_volt_min
1710   Y_range=(Set_volt_max-Set_volt_min)
1720   Y_axis_label$="Volt [V]"
1730   RETURN
1740 Init_chart:   !
1750   DIM X_axis_label$[25],Y_axis_label$[25]
1760   INTEGER Trace_num
1770   INTEGER Screen_dims(1:2),Gwindow_dims(1:4)
1780   REAL Y(1:2)   !Y(1) 전압 (2) 전류
1790   GESCAPE CRT,36;Screen_dims(*) ! Get screen width and height.
1800  !
1810  ! Set the dimensions of the graphics window using GESCAPE 33 so
1820  ! that it is centered on the screen.
1830  !
1840   Gwindow_dims(1)=Screen_dims(1)*.25 ! X of upper left.
1850   Gwindow_dims(2)=Screen_dims(2)*.2  ! Y of upper left.
1860   Gwindow_dims(3)=Screen_dims(1)*.7  ! Width.
1870   Gwindow_dims(4)=Screen_dims(2)*.6  ! Height.
1880   GESCAPE CRT,33;Gwindow_dims(*)     ! Set graphics window geometry.
1890  !
1900   GESCAPE CRT,35 ! Move the graphics window to the top.
1910  !
1920  ! Create a stripchart.  Make it invisible until all changes are made.
1930  !
1940   ASSIGN @Strip TO WIDGET "STRIPCHART";SET("VISIBLE":0)
1950  !
1960  ! Set the overall attributes.
1970  !
1980   CONTROL @Strip;SET("TITLE":"Data Logger")
1990   CONTROL @Strip;SET("MINIMUM SCROLL":2)
2000   CONTROL @Strip;SET("MOVABLE":0)
2010   CONTROL @Strip;SET("MAXIMIZABLE":0)
2020   CONTROL @Strip;SET("X":0,"Y":0)
2030  !
2040  ! Size the stripchart to exactly fill the graphics window.
2050  !
2060   Vert_borders=26
2070   Horiz_borders=8
2080   Height=Gwindow_dims(4)-Vert_borders
2090   Width=Gwindow_dims(3)-Horiz_borders
2100   CONTROL @Strip;SET("WIDTH":Width,"HEIGHT":Height)
2110  !
2120   CONTROL @Strip;SET("CURRENT AXIS":"X")
2130   CONTROL @Strip;SET("ORIGIN":X_origin,"RANGE":X_range)
2140   CONTROL @Strip;SET("AXIS LABEL":X_axis_label$)
2150  !CONTROL @Strip;SET("DIGITS":5)
2160  !
2170   CONTROL @Strip;SET("CURRENT AXIS":"Y")
2180   CONTROL @Strip;SET("ORIGIN":Y_origin,"RANGE":Y_range)
2190   CONTROL @Strip;SET("AXIS LABEL":Y_axis_label$)
2200  !
2210   CONTROL @Strip;SET("VISIBLE":1) ! Show the stripchart.
2220  !
2230   RETURN
2240   END