0% found this document useful (0 votes)
95 views16 pages

DGIF Controls

This document contains the code for a subroutine called DGIF_ControlsDyn that models the controls of a DFIG wind turbine. The subroutine initializes various parameters and variables, calls other subroutines to model components like the VSC filter, generator, chopper, and crowbar protection, and transfers values to and from storage arrays.

Uploaded by

kuchow
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views16 pages

DGIF Controls

This document contains the code for a subroutine called DGIF_ControlsDyn that models the controls of a DFIG wind turbine. The subroutine initializes various parameters and variables, calls other subroutines to model components like the VSC filter, generator, chopper, and crowbar protection, and transfers values to and from storage arrays.

Uploaded by

kuchow
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 16

!

=======================================================================
! 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 : DGIF_Controls
! Description :
!-----------------------------------------------------------------------

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

SUBROUTINE DGIF_ControlsDyn(Ctrl, Filter_Calc, Vdc_crowbar_off, &


& freq_cutoff, Mmva, Vdc_crowbar_on, M_kv, Rst_pu, Lconv, &
& DC_cap, freq, Vdc_chop_on, Vdc_chop_off, R_chopper, &
& Cfilter_in, Cdamp_in, Ldamp_in, Rdamp_in, DBlk_Gr, Sbase, &
& Cfreq_S, Vdc_base, Vacbase, Edc_ord, Q_ord, KpdS, TidS, KpqS, &
& TiqS, Kp_Q_S, Ti_Q_S, Kp_Edc, Ti_Edc, Kpd_R, Tid_R, Kp_Q_R, &
& Ti_Q_R, Kp_P, Ti_P, Kpq_R, Tiq_R, DBlk_Rtr, Pref_pu, Qref_pu, &
& Cfreq_R)

!---------------------------------------
! 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'

!---------------------------------------
! Function/Subroutine Declarations
!---------------------------------------

! SUBR VSC_filterDyn !
! SUBR Gen_VSCDyn !
! SUBR ChopperDyn !
! SUBR Crowbar_prot_1Dyn !

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

! Subroutine Arguments
INTEGER, INTENT(IN) :: Filter_Calc
INTEGER, INTENT(IN) :: DBlk_Gr, DBlk_Rtr
REAL, INTENT(IN) :: Ctrl(12)
REAL, INTENT(IN) :: Vdc_crowbar_off
REAL, INTENT(IN) :: freq_cutoff, Mmva
REAL, INTENT(IN) :: Vdc_crowbar_on
REAL, INTENT(IN) :: M_kv, Rst_pu, Lconv
REAL, INTENT(IN) :: DC_cap, freq
REAL, INTENT(IN) :: Vdc_chop_on
REAL, INTENT(IN) :: Vdc_chop_off
REAL, INTENT(IN) :: R_chopper
REAL, INTENT(IN) :: Cfilter_in
REAL, INTENT(IN) :: Cdamp_in, Ldamp_in
REAL, INTENT(IN) :: Rdamp_in, Sbase
REAL, INTENT(IN) :: Cfreq_S, Vdc_base
REAL, INTENT(IN) :: Vacbase, Edc_ord
REAL, INTENT(IN) :: Q_ord, KpdS, TidS
REAL, INTENT(IN) :: KpqS, TiqS, Kp_Q_S
REAL, INTENT(IN) :: Ti_Q_S, Kp_Edc
REAL, INTENT(IN) :: Ti_Edc, Kpd_R
REAL, INTENT(IN) :: Tid_R, Kp_Q_R
REAL, INTENT(IN) :: Ti_Q_R, Kp_P, Ti_P
REAL, INTENT(IN) :: Kpq_R, Tiq_R
REAL, INTENT(IN) :: Pref_pu, Qref_pu
REAL, INTENT(IN) :: Cfreq_R

! Electrical Node Indices

! Control Signals
INTEGER S1, PIRls, IT_1, S2TMODE, Blk
REAL Ecap, IG2(3), VG2(3), RT_1, RT_2
REAL PG_in, Theta, Qg_in, Vc, Vb, Va
REAL Wpu, Isc, Isb, Isa, PG2

! Internal Variables

! Indexing variables
INTEGER ICALL_NO ! Module call num
INTEGER ISTOI, ISTOF, IT_0 ! Storage Indices
INTEGER ISUBS, SS(3), IBRCH(3), INODE ! 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

ISTOI = NSTOI
NSTOI = NSTOI + 8
ISTOF = NSTOF
NSTOF = NSTOF + 73
NPGB = NPGB + 6
INODE = NNODE + 2
NNODE = NNODE + 14
NCSCS = NCSCS + 0
NCSCR = NCSCR + 0

! Initialize Subsystem Mapping

ISUBS = NSUBS + 0
NSUBS = NSUBS + 3

DO IT_0 = 1,3
SS(IT_0) = SUBS(ISUBS + IT_0)
END DO

! Initialize Branch Mapping.

IBRCH(1) = NBRCH(SS(1))
NBRCH(SS(1)) = NBRCH(SS(1)) + 3

IBRCH(2) = NBRCH(SS(2))
NBRCH(SS(2)) = NBRCH(SS(2)) + 0

IBRCH(3) = NBRCH(SS(3))
NBRCH(SS(3)) = NBRCH(SS(3)) + 2
!---------------------------------------
! Transfers from storage arrays
!---------------------------------------

S1 = STOI(ISTOI + 4)
PIRls = STOI(ISTOI + 5)
Ecap = STOF(ISTOF + 54)
RT_1 = STOF(ISTOF + 61)
IT_1 = STOI(ISTOI + 6)
RT_2 = STOF(ISTOF + 62)
S2TMODE = STOI(ISTOI + 7)
Blk = STOI(ISTOI + 8)
PG_in = STOF(ISTOF + 63)
Theta = STOF(ISTOF + 64)
Qg_in = STOF(ISTOF + 65)
Vc = STOF(ISTOF + 66)
Vb = STOF(ISTOF + 67)
Va = STOF(ISTOF + 68)
Wpu = STOF(ISTOF + 69)
Isc = STOF(ISTOF + 70)
Isb = STOF(ISTOF + 71)
Isa = STOF(ISTOF + 72)
PG2 = STOF(ISTOF + 73)

! Array (1:3) quantities...


DO IT_0 = 1,3
IG2(IT_0) = STOF(ISTOF + 54 + IT_0)
VG2(IT_0) = STOF(ISTOF + 57 + IT_0)
END DO
!---------------------------------------
! Electrical Node Lookup
!---------------------------------------

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

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

! 190:[datatap] Scalar/Array Tap


Isa = CTRL(1)

! 200:[datatap] Scalar/Array Tap


Isb = CTRL(2)

! 210:[datatap] Scalar/Array Tap


Isc = CTRL(3)

! 220:[datatap] Scalar/Array Tap


Va = CTRL(4)

! 250:[datatap] Scalar/Array Tap


Vb = CTRL(5)

! 270:[datatap] Scalar/Array Tap


Vc = CTRL(6)

! 280:[datatap] Scalar/Array Tap


Wpu = CTRL(7)

! 290:[datatap] Scalar/Array Tap


Theta = CTRL(8)

! 300:[datatap] Scalar/Array Tap


RT_2 = CTRL(9)

! 330:[datatap] Scalar/Array Tap


RT_1 = CTRL(10)

! 350:[datatap] Scalar/Array Tap


PG_in = CTRL(11)

! 360:[datatap] Scalar/Array Tap


Qg_in = CTRL(12)

! 400:[unity] Type conversion block


! real -> nearest integer
S2TMODE = NINT(RT_2)
! 430:[unity] Type conversion block
! real -> nearest integer
IT_1 = NINT(RT_1)

! 600:[inv] Interpolated Logic Inverter


IF (DBlk_Rtr .NE. 0) THEN
Blk = 0
ELSE
Blk = 1
ENDIF

! 610:[VSC_filter]
CALL VSC_filterDyn(DBlk_Gr, freq, Cfreq_S, Sbase, Vdc_base, Vacbas&
&e, Lconv, Edc_ord, Q_ord, Filter_Calc, Ldamp_in, Cfilter_in, Cdamp&
&_in, Rdamp_in, freq_cutoff, KpdS, TidS, KpqS, TiqS, Kp_Q_S, Ti_Q_S&
&, Kp_Edc, Ti_Edc)

! 630:[Gen_VSC]
CALL Gen_VSCDyn(CTRL, Mmva, M_kv, Rst_pu, DBlk_Rtr, freq, Vdc_base&
&, Cfreq_R, Pref_pu, Qref_pu, Kpq_R, Tiq_R, Kpd_R, Tid_R, Kp_P, Ti_&
&P, Kp_Q_R, Ti_Q_R)

! 640:[varrlc] Variable R, L or C
CALL E_VARRLC1_EXE(2 ,SS(3) , (IBRCH(3)+2), 0, DC_cap, 0.0)

! 660:[Chopper]
CALL ChopperDyn(Ecap, Vdc_chop_on, Vdc_chop_off, R_chopper)

! 690:[logic_mult] Multiple Input Logic Gate


!
! Multi input OR gate
!
IF ( (S2TMODE .NE. 0) .OR. (Blk .NE. 0) ) THEN
PIRls = 1
ELSE
PIRls = 0
ENDIF

! 700:[Crowbar_prot_1]
CALL Crowbar_prot_1Dyn(S1, PIRls, Ecap, Vdc_crowbar_on, Vdc_crowba&
&r_off)

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

STOI(ISTOI + 1) = Filter_Calc
STOF(ISTOF + 13) = Vdc_crowbar_off
STOF(ISTOF + 14) = freq_cutoff
STOF(ISTOF + 15) = Mmva
STOF(ISTOF + 16) = Vdc_crowbar_on
STOF(ISTOF + 17) = M_kv
STOF(ISTOF + 18) = Rst_pu
STOF(ISTOF + 19) = Lconv
STOF(ISTOF + 20) = DC_cap
STOF(ISTOF + 21) = freq
STOF(ISTOF + 22) = Vdc_chop_on
STOF(ISTOF + 23) = Vdc_chop_off
STOF(ISTOF + 24) = R_chopper
STOF(ISTOF + 25) = Cfilter_in
STOF(ISTOF + 26) = Cdamp_in
STOF(ISTOF + 27) = Ldamp_in
STOF(ISTOF + 28) = Rdamp_in
STOI(ISTOI + 2) = DBlk_Gr
STOF(ISTOF + 29) = Sbase
STOF(ISTOF + 30) = Cfreq_S
STOF(ISTOF + 31) = Vdc_base
STOF(ISTOF + 32) = Vacbase
STOF(ISTOF + 33) = Edc_ord
STOF(ISTOF + 34) = Q_ord
STOF(ISTOF + 35) = KpdS
STOF(ISTOF + 36) = TidS
STOF(ISTOF + 37) = KpqS
STOF(ISTOF + 38) = TiqS
STOF(ISTOF + 39) = Kp_Q_S
STOF(ISTOF + 40) = Ti_Q_S
STOF(ISTOF + 41) = Kp_Edc
STOF(ISTOF + 42) = Ti_Edc
STOF(ISTOF + 43) = Kpd_R
STOF(ISTOF + 44) = Tid_R
STOF(ISTOF + 45) = Kp_Q_R
STOF(ISTOF + 46) = Ti_Q_R
STOF(ISTOF + 47) = Kp_P
STOF(ISTOF + 48) = Ti_P
STOF(ISTOF + 49) = Kpq_R
STOF(ISTOF + 50) = Tiq_R
STOI(ISTOI + 3) = DBlk_Rtr
STOF(ISTOF + 51) = Pref_pu
STOF(ISTOF + 52) = Qref_pu
STOF(ISTOF + 53) = Cfreq_R
STOI(ISTOI + 4) = S1
STOI(ISTOI + 5) = PIRls
STOF(ISTOF + 54) = Ecap
STOF(ISTOF + 61) = RT_1
STOI(ISTOI + 6) = IT_1
STOF(ISTOF + 62) = RT_2
STOI(ISTOI + 7) = S2TMODE
STOI(ISTOI + 8) = Blk
STOF(ISTOF + 63) = PG_in
STOF(ISTOF + 64) = Theta
STOF(ISTOF + 65) = Qg_in
STOF(ISTOF + 66) = Vc
STOF(ISTOF + 67) = Vb
STOF(ISTOF + 68) = Va
STOF(ISTOF + 69) = Wpu
STOF(ISTOF + 70) = Isc
STOF(ISTOF + 71) = Isb
STOF(ISTOF + 72) = Isa
STOF(ISTOF + 73) = PG2

! Array (1:3) quantities...


DO IT_0 = 1,3
STOF(ISTOF + 54 + IT_0) = IG2(IT_0)
STOF(ISTOF + 57 + IT_0) = VG2(IT_0)
END DO

! Array (1:12) quantities...


DO IT_0 = 1,12
STOF(ISTOF + 0 + IT_0) = Ctrl(IT_0)
END DO

!---------------------------------------
! Transfer to Exports
!---------------------------------------

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

IF ( TIMEZERO ) CALL EMTDC_CLOSEFILE


RETURN
END

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

SUBROUTINE DGIF_ControlsOut()

!---------------------------------------
! 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'

!---------------------------------------
! Function/Subroutine Declarations
!---------------------------------------

! SUBR VSC_filterOut !
REAL EMTDC_VVDC !
! SUBR Gen_VSCOut !
REAL P3PH3 !
! SUBR ChopperOut !
! SUBR Crowbar_prot_1Out !
! SUBR PQVI1PH ! P,Q,V,I measurement in a 1p branch

!---------------------------------------
! Variable Declarations
!---------------------------------------
! Electrical Node Indices
INTEGER NT_2, NT_3, NT_4(3)

! Control Signals
REAL Ecap, IG2(3), VG2(3), PG2

! Internal Variables
INTEGER IVD1_1
REAL RVD1_1

! Indexing variables
INTEGER ICALL_NO ! Module call num
INTEGER ISTOL, ISTOI, ISTOF, ISTOC, IT_0 ! Storage Indices
INTEGER IPGB ! Control/Monitoring
INTEGER ISUBS, SS(3), IBRCH(3), INODE ! 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

IPGB = NPGB
NPGB = NPGB + 6
INODE = NNODE + 2
NNODE = NNODE + 14
NCSCS = NCSCS + 0
NCSCR = NCSCR + 0

! Initialize Subsystem Mapping

ISUBS = NSUBS + 0
NSUBS = NSUBS + 3

DO IT_0 = 1,3
SS(IT_0) = SUBS(ISUBS + IT_0)
END DO

! Initialize Branch Mapping.

IBRCH(1) = NBRCH(SS(1))
NBRCH(SS(1)) = NBRCH(SS(1)) + 3
IBRCH(2) = NBRCH(SS(2))
NBRCH(SS(2)) = NBRCH(SS(2)) + 0

IBRCH(3) = NBRCH(SS(3))
NBRCH(SS(3)) = NBRCH(SS(3)) + 2
!---------------------------------------
! Transfers from storage arrays
!---------------------------------------

Ecap = STOF(ISTOF + 54)


PG2 = STOF(ISTOF + 73)

! Array (1:3) quantities...


DO IT_0 = 1,3
IG2(IT_0) = STOF(ISTOF + 54 + IT_0)
VG2(IT_0) = STOF(ISTOF + 57 + IT_0)
END DO

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

NT_2 = NODE(INODE + 8)
NT_3 = NODE(INODE + 9)

! Array (1:3) quantities...


DO IT_0 = 1,3
NT_4(IT_0) = NODE(INODE + 9 + IT_0)
END DO

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

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

! 610:[VSC_filter]
CALL VSC_filterOut()

! 620:[voltmeter] Voltmeter (Line - Line) 'Ecap'


Ecap = EMTDC_VVDC(SS(3), NT_3, NT_2)

! 630:[Gen_VSC]
CALL Gen_VSCOut()

! 650:[multimeter] Multimeter
IVD1_1 = NRTCF
NRTCF = NRTCF + 5
IG2(1) = ( CBR((IBRCH(1)+1), SS(1)))
IG2(2) = ( CBR((IBRCH(1)+2), SS(1)))
IG2(3) = ( CBR((IBRCH(1)+3), SS(1)))
VG2(1) = EMTDC_VVDC(SS(1), NT_4(1), 0)
VG2(2) = EMTDC_VVDC(SS(1), NT_4(2), 0)
VG2(3) = EMTDC_VVDC(SS(1), NT_4(3), 0)
RVD1_1 = RTCF(IVD1_1) * P3PH3(SS(1), (IBRCH(1)+1), (IBRCH(1)+2), (&
&IBRCH(1)+3),RTCF(IVD1_1+2),0)
IF (UPDATE_AG) CALL PSCAD_AGRG2(ICALL_NO,904789960,RVD1_1,"Pd")
PG2 = RVD1_1
IF (FIRSTSTEP) THEN
CALL PSCAD_AGI2(ICALL_NO,904789960,1,"hide1")
CALL PSCAD_AGI2(ICALL_NO,904789960,1,"hide2")
ENDIF

! 660:[Chopper]
CALL ChopperOut()

! 670:[pgb] Output Channel 'VG2'

DO IVD1_1 = 1, 3
PGB(IPGB+1+IVD1_1-1) = VG2(IVD1_1)
ENDDO

! 680:[pgb] Output Channel 'IG2'

DO IVD1_1 = 1, 3
PGB(IPGB+4+IVD1_1-1) = IG2(IVD1_1)
ENDDO

! 700:[Crowbar_prot_1]
CALL Crowbar_prot_1Out()

! 1:[multimeter] Multimeter
IVD1_1 = NRTCF
NRTCF = NRTCF + 5
CALL PQVI1PH(SS(3),NT_3, (IBRCH(3)+1),RTCF(IVD1_1+2))
RVD1_1 = RTCF(IVD1_1) * STORF(NSTORF-2)
IF (UPDATE_AG) CALL PSCAD_AGRG2(ICALL_NO,1346421650,RVD1_1,"Pd")
IF (FIRSTSTEP) THEN
CALL PSCAD_AGI2(ICALL_NO,1346421650,1,"hide1")
CALL PSCAD_AGI2(ICALL_NO,1346421650,1,"hide2")
ENDIF

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

STOF(ISTOF + 54) = Ecap


STOF(ISTOF + 73) = PG2

! Array (1:3) quantities...


DO IT_0 = 1,3
STOF(ISTOF + 54 + IT_0) = IG2(IT_0)
STOF(ISTOF + 57 + IT_0) = VG2(IT_0)
END DO
!---------------------------------------
! Close Model Data read
!---------------------------------------

IF ( TIMEZERO ) CALL EMTDC_CLOSEFILE


RETURN
END

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

SUBROUTINE DGIF_ControlsDyn_Begin(Filter_Calc, freq_cutoff, Mmva, &


& M_kv, Rst_pu, Lconv, DC_cap, freq, Cfilter_in, Cdamp_in, &
& Ldamp_in, Rdamp_in, Sbase, Cfreq_S, Vdc_base, Vacbase, &
& Cfreq_R)

!---------------------------------------
! 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'

!---------------------------------------
! Function/Subroutine Declarations
!---------------------------------------

! SUBR VSC_filterDyn_Begin !
! SUBR Gen_VSCDyn_Begin !
! SUBR ChopperDyn_Begin !
! SUBR Crowbar_prot_1Dyn_Begin !

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

! Subroutine Arguments
INTEGER, INTENT(IN) :: Filter_Calc
REAL, INTENT(IN) :: freq_cutoff, Mmva
REAL, INTENT(IN) :: M_kv, Rst_pu, Lconv
REAL, INTENT(IN) :: DC_cap, freq
REAL, INTENT(IN) :: Cfilter_in
REAL, INTENT(IN) :: Cdamp_in, Ldamp_in
REAL, INTENT(IN) :: Rdamp_in, Sbase
REAL, INTENT(IN) :: Cfreq_S, Vdc_base
REAL, INTENT(IN) :: Vacbase, Cfreq_R

! Electrical Node Indices

! Control Signals
! Internal Variables

! Indexing variables
INTEGER ICALL_NO ! Module call num
INTEGER IT_0 ! Storage Indices
INTEGER ISUBS, SS(3), IBRCH(3), INODE ! 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

INODE = NNODE + 2
NNODE = NNODE + 14
NCSCS = NCSCS + 0
NCSCR = NCSCR + 0

! Initialize Subsystem Mapping

ISUBS = NSUBS + 0
NSUBS = NSUBS + 3

DO IT_0 = 1,3
SS(IT_0) = SUBS(ISUBS + IT_0)
END DO

! Initialize Branch Mapping.

IBRCH(1) = NBRCH(SS(1))
NBRCH(SS(1)) = NBRCH(SS(1)) + 3

IBRCH(2) = NBRCH(SS(2))
NBRCH(SS(2)) = NBRCH(SS(2)) + 0

IBRCH(3) = NBRCH(SS(3))
NBRCH(SS(3)) = NBRCH(SS(3)) + 2
!---------------------------------------
! Electrical Node Lookup
!---------------------------------------

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

! 190:[datatap] Scalar/Array Tap

! 200:[datatap] Scalar/Array Tap


! 210:[datatap] Scalar/Array Tap

! 220:[datatap] Scalar/Array Tap

! 250:[datatap] Scalar/Array Tap

! 270:[datatap] Scalar/Array Tap

! 280:[datatap] Scalar/Array Tap

! 290:[datatap] Scalar/Array Tap

! 300:[datatap] Scalar/Array Tap

! 330:[datatap] Scalar/Array Tap

! 350:[datatap] Scalar/Array Tap

! 360:[datatap] Scalar/Array Tap

! 400:[unity] Type conversion block

! 430:[unity] Type conversion block

! 600:[inv] Interpolated Logic Inverter

! 610:[VSC_filter]
CALL VSC_filterDyn_Begin(freq, Sbase, Vdc_base, Vacbase, Lconv, Ld&
&amp_in, Cfilter_in, Cdamp_in, Rdamp_in)

! 630:[Gen_VSC]
CALL Gen_VSCDyn_Begin(Mmva, M_kv, Rst_pu, freq)

! 640:[varrlc] Variable R, L or C
CALL E_VARRLC1_CFG(2 ,SS(3) , (IBRCH(3)+2), 0)

! 660:[Chopper]
CALL ChopperDyn_Begin()

! 700:[Crowbar_prot_1]
CALL Crowbar_prot_1Dyn_Begin()

RETURN
END

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

SUBROUTINE DGIF_ControlsOut_Begin(Filter_Calc, freq_cutoff, Mmva, &


& M_kv, Rst_pu, Lconv, DC_cap, freq, Cfilter_in, Cdamp_in, &
& Ldamp_in, Rdamp_in, Sbase, Cfreq_S, Vdc_base, Vacbase, &
& Cfreq_R)

!---------------------------------------
! 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'

!---------------------------------------
! Function/Subroutine Declarations
!---------------------------------------

! SUBR VSC_filterOut_Begin !
! SUBR Gen_VSCOut_Begin !
! SUBR ChopperOut_Begin !
! SUBR Crowbar_prot_1Out_Begin !

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

! Subroutine Arguments
INTEGER, INTENT(IN) :: Filter_Calc
REAL, INTENT(IN) :: freq_cutoff, Mmva
REAL, INTENT(IN) :: M_kv, Rst_pu, Lconv
REAL, INTENT(IN) :: DC_cap, freq
REAL, INTENT(IN) :: Cfilter_in
REAL, INTENT(IN) :: Cdamp_in, Ldamp_in
REAL, INTENT(IN) :: Rdamp_in, Sbase
REAL, INTENT(IN) :: Cfreq_S, Vdc_base
REAL, INTENT(IN) :: Vacbase, Cfreq_R

! Electrical Node Indices


INTEGER NT_2, NT_3, NT_4(3)

! Control Signals

! Internal Variables
INTEGER IVD1_1

! Indexing variables
INTEGER ICALL_NO ! Module call num
INTEGER IT_0 ! Storage Indices
INTEGER ISUBS, SS(3), IBRCH(3), INODE ! 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

INODE = NNODE + 2
NNODE = NNODE + 14
NCSCS = NCSCS + 0
NCSCR = NCSCR + 0

! Initialize Subsystem Mapping

ISUBS = NSUBS + 0
NSUBS = NSUBS + 3

DO IT_0 = 1,3
SS(IT_0) = SUBS(ISUBS + IT_0)
END DO

! Initialize Branch Mapping.

IBRCH(1) = NBRCH(SS(1))
NBRCH(SS(1)) = NBRCH(SS(1)) + 3

IBRCH(2) = NBRCH(SS(2))
NBRCH(SS(2)) = NBRCH(SS(2)) + 0

IBRCH(3) = NBRCH(SS(3))
NBRCH(SS(3)) = NBRCH(SS(3)) + 2
!---------------------------------------
! Electrical Node Lookup
!---------------------------------------

NT_2 = NODE(INODE + 8)
NT_3 = NODE(INODE + 9)

! Array (1:3) quantities...


DO IT_0 = 1,3
NT_4(IT_0) = NODE(INODE + 9 + IT_0)
END DO

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

! 610:[VSC_filter]
CALL VSC_filterOut_Begin(freq, Sbase, Vdc_base, Vacbase, Lconv, Ld&
&amp_in, Cfilter_in, Cdamp_in, Rdamp_in)

! 630:[Gen_VSC]
CALL Gen_VSCOut_Begin(Mmva, M_kv, Rst_pu, freq)

! 650:[multimeter] Multimeter
IVD1_1 = NRTCF
NRTCF = NRTCF + 5
IF (ABS(1.0) .GT. 1.0E-20) THEN
RTCF(IVD1_1) = 1.0/ABS(1.0)
ELSE
RTCF(IVD1_1) = 1.0
ENDIF
RTCF(IVD1_1+2) = 0.02

! 660:[Chopper]
CALL ChopperOut_Begin()

! 670:[pgb] Output Channel 'VG2'

! 680:[pgb] Output Channel 'IG2'

! 700:[Crowbar_prot_1]
CALL Crowbar_prot_1Out_Begin()

! 1:[multimeter] Multimeter
IVD1_1 = NRTCF
NRTCF = NRTCF + 5
IF (ABS(1.0) .GT. 1.0E-20) THEN
RTCF(IVD1_1) = 1.0/ABS(1.0)
ELSE
RTCF(IVD1_1) = 1.0
ENDIF
RTCF(IVD1_1+2) = 0.02

RETURN
END

You might also like