C*************************************************************** SUBROUTINE TYPE65(TIME,XIN,OUT,T,DTDT,PAR,INFO,ICNTRL,*) C version from: 01/12/89 C SAMPLE INPUT AND OUTPUT FOLLOWS THE VARIABLE EXPLANATIONS C*************************************************************** C**** Subroutine represents a maximum power tracking device C**** for a PV power system. C**** The maximum power tracker developed in this component is C**** basically a DC - DC converter. The goal is to find the C**** optimal conversion ratio to match the converted max. power C**** voltage to the load voltage. A convergence promoter assures C**** convergence and accelerates the iterative process for C**** direct coupled systems: Mode = 1. Convergence promotion is C**** done on the output variable Iload. C**** Basically, the convergence promoter is a bisection method. C*************************************************************** C**** variables: C ICELL -- current from PV array [amps] C ILOAD -- current to load [amps] C VLOAD -- load voltage [V] C RATIO -- ratio of cell voltage to motor voltage C or ratio of cell current to motor current C X -- variable to store current value for C convergence promoter method C XNEW -- new value >> convergence promoter C XPOS -- limit >> convergence promoter C XNEG -- limit >> convergence promoter C DUMMY -- variable used as a control function to obtain C values from the two previous timesteps C EFF -- efficiency of maximum power tracker C MODE -- determines operating mode either direct coupled C or not C G -- variable used in the con. promoter C GUARD -- control variable C C*************************************************************** C SAMPLE INPUT AND OUTPUT USING TRNSYS DEBUG C C INPUTS SAMPLE VALUES C XIN(1) ICELL 45.0 C XIN(2) VCELL 435.0 C XIN(3) VLOAD 120.0 C XIN(4) MODE 1.0 C C PARAMETERS SAMPLE VALUES C PAR(1) EFF .98 C C OUTPUTS SAMPLE VALUES C OUT(1) ILOAD 55.13 C OUT(2) RATIO 1.25 C OUT(3) DUMMY 1.0 C OUT(4) X 55.13 C OUT(5) XPOS 0.0 C OUT(6) XNEG 0.0 C OUT(7) GUARD 1.0 C C************************************************************** IMPLICIT NONE DOUBLE PRECISION XIN,OUT INTEGER INFO REAL TIME,T,DTDT,ICNTRL,PAR REAL ICELL,ILOAD,VCELL,VLOAD,X,XNEW,XPOS,XNEG,RATIO REAL G,EFF,MODE,DUMMY,GUARD DIMENSION XIN(4), OUT(7),INFO(15),PAR(1) C************************************************************* INFO(6)=7 INFO(9)=0 CALL TYPECK(1,INFO,4,1,0) C**** Set inputs ICELL=XIN(1) VCELL=XIN(2) VLOAD=XIN(3) MODE=XIN(4) C---------------------------------------------------------- C**** Initial call of component IF(INFO(7).LT.0)THEN C**** SET PARAMETERS EFF=PAR(1) C**** Initialization of some variables X=0. XPOS=0. XNEG=0. RATIO=0. DUMMY=0. GUARD=0. C---------------------------------------------------------- C**** first and following calls in time step ELSE GUARD=OUT(7) DUMMY=OUT(3) IF(VCELL.EQ.0.)THEN C**** scip all calculations RATIO=0. ILOAD=0. ELSE C**** First call in time step IF(INFO(7).EQ.0)THEN GUARD=MODE C**** dummy addresses the convergence promoting algorithm DUMMY=0. ENDIF C**** guard observes the mode input C**** if mode changes from 0 to 1, indicating C**** a switch from battery system mode to direct coupled C**** system mode, then convergence promoter starts over IF(GUARD.NE.MODE)THEN DUMMY=0. GUARD=MODE ENDIF IF(MODE.EQ.0.)THEN IF(VLOAD.GT.0.)THEN RATIO=VCELL/VLOAD ILOAD=ICELL*RATIO*EFF ELSE RATIO=0. ILOAD=0. ENDIF ELSE C**** get values from previous iteration X=OUT(4) XPOS=OUT(5) XNEG=OUT(6) IF(VLOAD.EQ.0.)THEN C**** prevents devision by zero, see below VLOAD=VCELL ENDIF RATIO=VCELL/VLOAD ILOAD=ICELL*RATIO*EFF IF(DUMMY.EQ.0.)THEN XNEW=ILOAD DUMMY=1. ELSEIF(DUMMY.EQ.1.)THEN XNEW=ILOAD G=XNEW-X IF(G.GT.0.)THEN XPOS=XNEW XNEG=X ELSE XPOS=X XNEG=XNEW ENDIF XNEW=(XPOS+XNEG)/2. DUMMY=2. ELSE XNEW=ILOAD G=XNEW-X IF(G.GT.0.)THEN XNEG=X ELSE XPOS=X ENDIF XNEW=(XPOS+XNEG)/2. ENDIF ILOAD=XNEW X=XNEW ENDIF ENDIF ENDIF C---------------------------------------------------------- C**** SET OUTPUTS OUT(1)=ILOAD OUT(2)=RATIO C**** following outputs serve as storage OUT(3)=DUMMY OUT(4)=X OUT(5)=XPOS OUT(6)=XNEG OUT(7)=GUARD RETURN 1 END