You are on page 1of 11

!

=======================================================================
! Generated by : PSCAD v4.6.2.0
!
! Warning: The content of this file is automatically generated.
! Do not modify, as any changes made here will be lost!
!-----------------------------------------------------------------------
! Component : Windfarm
! Description :
!-----------------------------------------------------------------------

!=======================================================================

SUBROUTINE WindfarmDyn(x_Tm, Cp, Vw, Wm)

!---------------------------------------
! Standard includes
!---------------------------------------

INCLUDE 'nd.h'
INCLUDE 'emtconst.h'
INCLUDE 'emtstor.h'
INCLUDE 's0.h'
INCLUDE 's1.h'
INCLUDE 's2.h'
INCLUDE 's4.h'
INCLUDE 'branches.h'
INCLUDE 'pscadv3.h'
INCLUDE 'fnames.h'
INCLUDE 'radiolinks.h'
INCLUDE 'matlab.h'
INCLUDE 'rtconfig.h'

!---------------------------------------
! Variable Declarations
!---------------------------------------

! Subroutine Arguments
REAL, INTENT(IN) :: Cp, Vw, Wm
REAL, INTENT(OUT) :: x_Tm

! Electrical Node Indices

! Control Signals
REAL RT_1, RT_2, RT_3, RT_4, RT_5, RT_6
REAL RT_7, RT_8, RT_9, Pw, RT_10, RT_11
REAL RT_12, RT_13, RT_14, RT_15, RT_16
REAL Tm

! Internal Variables

! Indexing variables
INTEGER ICALL_NO ! Module call num
INTEGER ISTOF ! Storage Indices
INTEGER IPGB ! Control/Monitoring
INTEGER ISUBS ! SS/Node/Branch/Xfmr
!---------------------------------------
! Local Indices
!---------------------------------------

! Dsdyn <-> Dsout transfer index storage

NTXFR = NTXFR + 1

TXFR(NTXFR,1) = NSTOL
TXFR(NTXFR,2) = NSTOI
TXFR(NTXFR,3) = NSTOF
TXFR(NTXFR,4) = NSTOC

! Increment and assign runtime configuration call indices

ICALL_NO = NCALL_NO
NCALL_NO = NCALL_NO + 1

! Increment global storage indices

ISTOF = NSTOF
NSTOF = NSTOF + 22
IPGB = NPGB
NPGB = NPGB + 4
NNODE = NNODE + 2
NCSCS = NCSCS + 0
NCSCR = NCSCR + 0

!---------------------------------------
! Transfers from storage arrays
!---------------------------------------

RT_1 = STOF(ISTOF + 5)
RT_2 = STOF(ISTOF + 6)
RT_3 = STOF(ISTOF + 7)
RT_4 = STOF(ISTOF + 8)
RT_5 = STOF(ISTOF + 9)
RT_6 = STOF(ISTOF + 10)
RT_7 = STOF(ISTOF + 11)
RT_8 = STOF(ISTOF + 12)
RT_9 = STOF(ISTOF + 13)
Pw = STOF(ISTOF + 14)
RT_10 = STOF(ISTOF + 15)
RT_11 = STOF(ISTOF + 16)
RT_12 = STOF(ISTOF + 17)
RT_13 = STOF(ISTOF + 18)
RT_14 = STOF(ISTOF + 19)
RT_15 = STOF(ISTOF + 20)
RT_16 = STOF(ISTOF + 21)
Tm = STOF(ISTOF + 22)

!---------------------------------------
! Electrical Node Lookup
!---------------------------------------

!---------------------------------------
! Configuration of Models
!---------------------------------------

IF ( TIMEZERO ) THEN
FILENAME = 'Windfarm.dta'
CALL EMTDC_OPENFILE
SECTION = 'DATADSD:'
CALL EMTDC_GOTOSECTION
ENDIF
!---------------------------------------
! Generated code from module definition
!---------------------------------------

! 10:[const] Real Constant 'Rotor Radius'

RT_16 = 40.0

! 20:[square] Square
RT_14 = RT_16 * RT_16

! 30:[const] Real Constant 'PI'

RT_15 = 3.14159

! 40:[mult] Multiplier
RT_5 = RT_14 * RT_15

! 60:[const] Real Constant 'Air Density'

RT_3 = 1.225

! 70:[const] Real Constant 'Constant'

RT_2 = 0.5

! 80:[mult] Multiplier
RT_1 = RT_2 * RT_3

! 90:[mult] Multiplier
RT_4 = RT_1 * RT_5

! 110:[pgb] Output Channel 'Vw'

PGB(IPGB+1) = Vw

! 120:[log] Logarithm Functions


! Logarithm
IF (Vw .LT. 1.0E-20) THEN
RT_7 = -20.0
ELSE
RT_7 = LOG10(Vw)
ENDIF
!

! 130:[const] Real Constant

RT_10 = 2000000.0

! 150:[const] Real Constant


RT_8 = 3.0

! 160:[mult] Multiplier
RT_6 = RT_7 * RT_8

! 170:[exp] Exponential Functions


!
RT_13 = RTCF(NRTCF) * 10.0**(RTCF(NRTCF+1) * RT_6)
NRTCF = NRTCF + 2
!

! 180:[mult] Multiplier
RT_12 = RT_4 * RT_13

! 190:[mult] Multiplier
Pw = RT_12 * Cp

! 200:[div] Divider
!
IF (ABS(RT_10) .LT. 1.0E-10) THEN
IF (RT_10 .LT. 0.0) THEN
RT_9 = -1.0E10 * Pw
ELSE
RT_9 = 1.0E10 * Pw
ENDIF
ELSE
RT_9 = Pw / RT_10
ENDIF
!

! 210:[div] Divider
!
IF (ABS(Wm) .LT. 1.0E-10) THEN
IF (Wm .LT. 0.0) THEN
RT_11 = -1.0E10 * RT_9
ELSE
RT_11 = 1.0E10 * RT_9
ENDIF
ELSE
RT_11 = RT_9 / Wm
ENDIF
!

! 220:[gain] Gain Block


! Gain
Tm = -1.0 * RT_11

! 230:[pgb] Output Channel 'Wm'

PGB(IPGB+2) = Wm

! 250:[pgb] Output Channel 'Tm'

PGB(IPGB+3) = RT_11

! 260:[pgb] Output Channel 'Pw'

PGB(IPGB+4) = Pw
!---------------------------------------
! Feedbacks and transfers to storage
!---------------------------------------

STOF(ISTOF + 2) = Cp
STOF(ISTOF + 3) = Vw
STOF(ISTOF + 4) = Wm
STOF(ISTOF + 5) = RT_1
STOF(ISTOF + 6) = RT_2
STOF(ISTOF + 7) = RT_3
STOF(ISTOF + 8) = RT_4
STOF(ISTOF + 9) = RT_5
STOF(ISTOF + 10) = RT_6
STOF(ISTOF + 11) = RT_7
STOF(ISTOF + 12) = RT_8
STOF(ISTOF + 13) = RT_9
STOF(ISTOF + 14) = Pw
STOF(ISTOF + 15) = RT_10
STOF(ISTOF + 16) = RT_11
STOF(ISTOF + 17) = RT_12
STOF(ISTOF + 18) = RT_13
STOF(ISTOF + 19) = RT_14
STOF(ISTOF + 20) = RT_15
STOF(ISTOF + 21) = RT_16
STOF(ISTOF + 22) = Tm

!---------------------------------------
! Transfer to Exports
!---------------------------------------
x_Tm = Tm

!---------------------------------------
! Close Model Data read
!---------------------------------------

IF ( TIMEZERO ) CALL EMTDC_CLOSEFILE


RETURN
END

!=======================================================================

SUBROUTINE WindfarmOut()

!---------------------------------------
! Standard includes
!---------------------------------------

INCLUDE 'nd.h'
INCLUDE 'emtconst.h'
INCLUDE 'emtstor.h'
INCLUDE 's0.h'
INCLUDE 's1.h'
INCLUDE 's2.h'
INCLUDE 's4.h'
INCLUDE 'branches.h'
INCLUDE 'pscadv3.h'
INCLUDE 'fnames.h'
INCLUDE 'radiolinks.h'
INCLUDE 'matlab.h'
INCLUDE 'rtconfig.h'

!---------------------------------------
! Variable Declarations
!---------------------------------------

! Electrical Node Indices

! Control Signals
REAL RT_2, RT_3, RT_8, RT_10, RT_15
REAL RT_16

! Internal Variables

! Indexing variables
INTEGER ICALL_NO ! Module call num
INTEGER ISTOL, ISTOI, ISTOF, ISTOC ! Storage Indices
INTEGER ISUBS ! SS/Node/Branch/Xfmr

!---------------------------------------
! Local Indices
!---------------------------------------

! Dsdyn <-> Dsout transfer index storage

NTXFR = NTXFR + 1

ISTOL = TXFR(NTXFR,1)
ISTOI = TXFR(NTXFR,2)
ISTOF = TXFR(NTXFR,3)
ISTOC = TXFR(NTXFR,4)

! Increment and assign runtime configuration call indices

ICALL_NO = NCALL_NO
NCALL_NO = NCALL_NO + 1

! Increment global storage indices

NPGB = NPGB + 4
NNODE = NNODE + 2
NCSCS = NCSCS + 0
NCSCR = NCSCR + 0

!---------------------------------------
! Transfers from storage arrays
!---------------------------------------

RT_2 = STOF(ISTOF + 6)
RT_3 = STOF(ISTOF + 7)
RT_8 = STOF(ISTOF + 12)
RT_10 = STOF(ISTOF + 15)
RT_15 = STOF(ISTOF + 20)
RT_16 = STOF(ISTOF + 21)
!---------------------------------------
! Electrical Node Lookup
!---------------------------------------

!---------------------------------------
! Configuration of Models
!---------------------------------------

IF ( TIMEZERO ) THEN
FILENAME = 'Windfarm.dta'
CALL EMTDC_OPENFILE
SECTION = 'DATADSO:'
CALL EMTDC_GOTOSECTION
ENDIF
!---------------------------------------
! Generated code from module definition
!---------------------------------------

! 10:[const] Real Constant 'Rotor Radius'

RT_16 = 40.0

! 30:[const] Real Constant 'PI'

RT_15 = 3.14159

! 60:[const] Real Constant 'Air Density'

RT_3 = 1.225

! 70:[const] Real Constant 'Constant'

RT_2 = 0.5

! 130:[const] Real Constant

RT_10 = 2000000.0

! 150:[const] Real Constant

RT_8 = 3.0

!---------------------------------------
! Feedbacks and transfers to storage
!---------------------------------------

STOF(ISTOF + 6) = RT_2
STOF(ISTOF + 7) = RT_3
STOF(ISTOF + 12) = RT_8
STOF(ISTOF + 15) = RT_10
STOF(ISTOF + 20) = RT_15
STOF(ISTOF + 21) = RT_16

!---------------------------------------
! Close Model Data read
!---------------------------------------

IF ( TIMEZERO ) CALL EMTDC_CLOSEFILE


RETURN
END

!=======================================================================

SUBROUTINE WindfarmDyn_Begin()

!---------------------------------------
! Standard includes
!---------------------------------------

INCLUDE 'nd.h'
INCLUDE 'emtconst.h'
INCLUDE 's0.h'
INCLUDE 's1.h'
INCLUDE 's4.h'
INCLUDE 'branches.h'
INCLUDE 'pscadv3.h'
INCLUDE 'radiolinks.h'
INCLUDE 'rtconfig.h'

!---------------------------------------
! Variable Declarations
!---------------------------------------

! Subroutine Arguments

! Electrical Node Indices

! Control Signals
REAL RT_2, RT_3, RT_8, RT_10, RT_15
REAL RT_16

! Internal Variables

! Indexing variables
INTEGER ICALL_NO ! Module call num
INTEGER ISUBS ! SS/Node/Branch/Xfmr

!---------------------------------------
! Local Indices
!---------------------------------------

! Increment and assign runtime configuration call indices

ICALL_NO = NCALL_NO
NCALL_NO = NCALL_NO + 1

! Increment global storage indices

NNODE = NNODE + 2
NCSCS = NCSCS + 0
NCSCR = NCSCR + 0
!---------------------------------------
! Electrical Node Lookup
!---------------------------------------

!---------------------------------------
! Generated code from module definition
!---------------------------------------

! 10:[const] Real Constant 'Rotor Radius'


RT_16 = 40.0

! 20:[square] Square

! 30:[const] Real Constant 'PI'


RT_15 = 3.14159

! 40:[mult] Multiplier

! 60:[const] Real Constant 'Air Density'


RT_3 = 1.225

! 70:[const] Real Constant 'Constant'


RT_2 = 0.5

! 80:[mult] Multiplier

! 90:[mult] Multiplier

! 110:[pgb] Output Channel 'Vw'

! 120:[log] Logarithm Functions

! 130:[const] Real Constant


RT_10 = 2000000.0

! 150:[const] Real Constant


RT_8 = 3.0

! 160:[mult] Multiplier

! 170:[exp] Exponential Functions


RTCF(NRTCF) = 1.0
RTCF(NRTCF+1) = 1.0
NRTCF = NRTCF + 2

! 180:[mult] Multiplier

! 190:[mult] Multiplier

! 200:[div] Divider

! 210:[div] Divider

! 220:[gain] Gain Block

! 230:[pgb] Output Channel 'Wm'


! 250:[pgb] Output Channel 'Tm'

! 260:[pgb] Output Channel 'Pw'

RETURN
END

!=======================================================================

SUBROUTINE WindfarmOut_Begin()

!---------------------------------------
! Standard includes
!---------------------------------------

INCLUDE 'nd.h'
INCLUDE 'emtconst.h'
INCLUDE 's0.h'
INCLUDE 's1.h'
INCLUDE 's4.h'
INCLUDE 'branches.h'
INCLUDE 'pscadv3.h'
INCLUDE 'radiolinks.h'
INCLUDE 'rtconfig.h'

!---------------------------------------
! Variable Declarations
!---------------------------------------

! Subroutine Arguments

! Electrical Node Indices

! Control Signals
REAL RT_2, RT_3, RT_8, RT_10, RT_15
REAL RT_16

! Internal Variables

! Indexing variables
INTEGER ICALL_NO ! Module call num
INTEGER ISUBS ! SS/Node/Branch/Xfmr

!---------------------------------------
! Local Indices
!---------------------------------------

! Increment and assign runtime configuration call indices

ICALL_NO = NCALL_NO
NCALL_NO = NCALL_NO + 1

! Increment global storage indices

NNODE = NNODE + 2
NCSCS = NCSCS + 0
NCSCR = NCSCR + 0

!---------------------------------------
! Electrical Node Lookup
!---------------------------------------

!---------------------------------------
! Generated code from module definition
!---------------------------------------

! 10:[const] Real Constant 'Rotor Radius'


RT_16 = 40.0

! 30:[const] Real Constant 'PI'


RT_15 = 3.14159

! 60:[const] Real Constant 'Air Density'


RT_3 = 1.225

! 70:[const] Real Constant 'Constant'


RT_2 = 0.5

! 130:[const] Real Constant


RT_10 = 2000000.0

! 150:[const] Real Constant


RT_8 = 3.0

RETURN
END

You might also like