First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
I am a PSS / E 34.2.0 user.
The FORTRAN example below is called BESS with droop control applied.
So I am learning Fortran 77.
However, the subroutine fortran example (which I have) is hard to understand.
First, I do not know how CBEST and User-Defined Subroutine models and variables are connected.
Second, where is the main program Fortran file in the top of Subroutine?
Third, what are the MODE1, MODE2, MODE3, MODE4 that most examples have?
Fourth, I could not found meaning of GENCHK at CALL GENCHK( ). What's the GENCHK?
Is there an easy user-defined modeling example?
================================================
SUBROUTINE WACS(M, J, K, L)
INCLUDE 'COMON4.INS'
INTEGER IVAL, IERR
INTEGER M302
INTEGER COUNT_DROOP, I_ITER
REAL P302
REAL FREQ, FREQ_LAG, BEFORE_P, P_BATMAX
REAL P_INPUT, FREQ_DROOP, C_DROOP
REAL DBMAX, DBMIN
CALL GENCHK (302, '1', M302, 'IN CONEC')
P302=PELEC(M302)
BEFORE_P = 100*P302
FREQ = BSFREQ(M302)
DBMAX = 0.017/60
DBMIN = -0.017/60
COUNT_DROOP = 0
P_BATMAX = 30
C_DROOP = P_BATMAX/(0.005-DBMIN)
IF (MODE.GT.4) RETURN
IVAL = K+1
IF (MODE.EQ.4) THEN
IF (IVAL.GT.NINTEG) NINTEG=IVAL
RETURN
ENDIF
IF (MODE.EQ.1) THEN
P_INPUT = 0.0
COUNT_DROOP = VAR(L+7)
FREQ_LAG = NWLAG_MODE1(1.0, 0.1, 0.0042, -0.0042, FREQ, K, IERR)
FREQ_DROOP = 0.0
IF (TIME.GT.20) THEN
IF (FREQ.GT.DBMAX) THEN
COUNT_DROOP = -1*C_DROOP*(FREQ-DBMAX)
ENDIF
ELSE IF (FREQ.LT.DBMIN) THEN
COUNT_DROOP = COUNT_DROOP + 1
IF (COUNT_DROOP.GT.6) THEN
FREQ_DROOP = -1*C_DROOP*(FREQ-DBMIN)
ENDIF
ELSE
COUNT_DROOP = 0
FREQ_DROOP = 0.0
ENDIF
VAR(L+7) = COUNT_DROOP
ENDIF
VAR(1) = FREQ_DROOP
VAR(2) = 0.0
VAR(L+8) = 60+(60*FREQ)
ENTRY TACS(M, J, K, L)
RETURN
END
2 | No.2 Revision |
I am a PSS / E 34.2.0 user.
The FORTRAN example below is called BESS with droop control applied.
So I am learning Fortran 77.
However, the subroutine fortran example (which I have) is hard to understand.
First, I do not know how the variables of the CBEST model and the User-Defined Subroutine models and variables model are connected.
Second, where is the main program Fortran file in the top of Subroutine?
Third, what are the MODE1, MODE2, MODE3, MODE4 that most examples have?
Fourth, I could not found meaning of GENCHK at CALL GENCHK( ). What's the GENCHK?
Is there an easy user-defined modeling example?
================================================
SUBROUTINE WACS(M, J, K, L)
INCLUDE 'COMON4.INS'
INTEGER IVAL, IERR
INTEGER M302
INTEGER COUNT_DROOP, I_ITER
REAL P302
REAL FREQ, FREQ_LAG, BEFORE_P, P_BATMAX
REAL P_INPUT, FREQ_DROOP, C_DROOP
REAL DBMAX, DBMIN
CALL GENCHK (302, '1', M302, 'IN CONEC')
P302=PELEC(M302)
BEFORE_P = 100*P302
FREQ = BSFREQ(M302)
DBMAX = 0.017/60
DBMIN = -0.017/60
COUNT_DROOP = 0
P_BATMAX = 30
C_DROOP = P_BATMAX/(0.005-DBMIN)
IF (MODE.GT.4) RETURN
IVAL = K+1
IF (MODE.EQ.4) THEN
IF (IVAL.GT.NINTEG) NINTEG=IVAL
RETURN
ENDIF
IF (MODE.EQ.1) THEN
P_INPUT = 0.0
COUNT_DROOP = VAR(L+7)
FREQ_LAG = NWLAG_MODE1(1.0, 0.1, 0.0042, -0.0042, FREQ, K, IERR)
FREQ_DROOP = 0.0
IF (TIME.GT.20) THEN
IF (FREQ.GT.DBMAX) THEN
COUNT_DROOP = -1*C_DROOP*(FREQ-DBMAX)
ENDIF
ELSE IF (FREQ.LT.DBMIN) THEN
COUNT_DROOP = COUNT_DROOP + 1
IF (COUNT_DROOP.GT.6) THEN
FREQ_DROOP = -1*C_DROOP*(FREQ-DBMIN)
ENDIF
ELSE
COUNT_DROOP = 0
FREQ_DROOP = 0.0
ENDIF
VAR(L+7) = COUNT_DROOP
ENDIF
VAR(1) = FREQ_DROOP
VAR(2) = 0.0
VAR(L+8) = 60+(60*FREQ)
ENTRY TACS(M, J, K, L)
RETURN
END