0

I want to create FORTRAN User-Defined Model, but I couldn't understand FORTRAN examples

I am a PSS / E 34.2.0 user.

The FORTRAN example below is called BESS with droop control applied.

  1. I want to create a user-defined model of the secondary controller of CBEST (BESS).
  2. I want to put Low Voltage Ride Through function in CBEST auxiliary controller.

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 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
JH-Ko's avatar
1
JH-Ko
asked 2018-02-13 00:25:56 -0500, updated 2018-02-13 00:39:20 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

The user written model you got is not a good example on how to write a model.

I recommend you to study Chapter 23 "Model Writing" in Program Operation Manual as well as Chapter 13 in Program Application Guide, Volume II.

Subroutine GENCHK returns the machine index for a given generator (bus number,machine id).

perolofl's avatar
3.8k
perolofl
answered 2018-02-13 02:14:40 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Login/Signup to Answer