Ask Your Question
0

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

asked 2018-02-13 00:25:56 -0500

JH-Ko gravatar image

updated 2018-02-13 00:39:20 -0500

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
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2018-02-13 02:14:40 -0500

perolofl gravatar image

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).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: 2018-02-13 00:25:56 -0500

Seen: 1,810 times

Last updated: Feb 13 '18