C***************************************************************** SUBROUTINE TYPE59(TIME,XIN,OUT,T,DTDT,PAR,INFO,ICNTRL,*) C Version from: 12/14/89 C SAMPLE INPUT AND OUTPUT FOLLOW THE NOMENCLATURE C----------------------------------------------------------------- C This subroutine represents a model of an ohmic resistance. C The value of the resistance has to be provided as a C parameter by the user. This component is designed to operate C in a photovoltaic powered energy system. It can operate on C two different modes: voltage or current mode. If the MODE C signal is set to be one, the current is significant input and C voltage will be evaluated. Otherwise voltage is significant C input and current will be evaluated corresponding to the C ohmic law. C***************************************************************** C***************************************************************** C**** Definition of the variables: C**** TRNSYS specific variables: C XIN == input array C OUT == output array C PAR == parameters C TIME == simulation time C T,DTDT == not used in this component C INFO == array to use TRNSYS internal information C**** component specific variables: C I == current [amps] C V == voltage [volts] C P == power [watts] C R == resistance [ohms] C MODE == signal determining operating mode C MODE=1: current is significant input C MODE=2: voltage is signifianct input C***************************************************************** C C SAMPLE INPUT AND OUTPUT VALUES C C INPUTS SAMPLE VALUES C XIN(1) I .5 C XIN(2) V 120.0 C XIN(3) MODE 1.0 C C PARAMETERS C PAR(1) R 1000000.0 C C OUTPUTS C OUT(1) I .50 C OUT(2) V 500000.0 C OUT(3) P 250000.0 C C***************************************************************** C C**** declaration of variables: DOUBLE PRECISION XIN,OUT INTEGER INFO REAL R,V,I,TIME,T,DTDT,PAR,MODE DIMENSION XIN(3), OUT(3), PAR(1), INFO(15) C***************************************************************** INFO(6)=3 INFO(9)=0 C----------------------------------------------------------------- C**** initial call of component IF(INFO(7).LT.0)THEN CALL TYPECK(1,INFO,3,1,0) C**** set parameters R=PAR(1) ENDIF C----------------------------------------------------------------- C**** set inputs I=XIN(1) V=XIN(2) MODE=XIN(3) IF (MODE.EQ.1.)THEN C**** current guess V=I*R+B ELSE C**** voltage guess I=(V-B)/R ENDIF P=I*V C**** set outputs OUT(1)=I OUT(2)=V OUT(3)=P RETURN 1 END