Anda di halaman 1dari 9

!

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

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

SUBROUTINE ChopperDyn(Ecap, Vdc_chop_on, Vdc_chop_off, R_chopper)

!---------------------------------------
! 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 EMTDC_XHBUFF ! 'Interpolated Buffer with Hysteresis'

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

! Subroutine Arguments
REAL, INTENT(IN) :: Ecap, Vdc_chop_on
REAL, INTENT(IN) :: Vdc_chop_off
REAL, INTENT(IN) :: R_chopper

! Electrical Node Indices

! Control Signals
INTEGER IT_1, BRK_CHP

! Internal Variables
INTEGER IVD1_1, IVD1_2
REAL RVD2_1(2)

! Indexing variables
INTEGER ICALL_NO ! Module call num
INTEGER ISTOI, ISTOF, IT_0 ! Storage Indices
INTEGER IPGB ! Control/Monitoring
INTEGER ISUBS, SS(1), IBRCH(1), 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 + 2
ISTOF = NSTOF
NSTOF = NSTOF + 4
IPGB = NPGB
NPGB = NPGB + 1
INODE = NNODE + 2
NNODE = NNODE + 5
NCSCS = NCSCS + 0
NCSCR = NCSCR + 0

! Initialize Subsystem Mapping

ISUBS = NSUBS + 0
NSUBS = NSUBS + 1

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

! Initialize Branch Mapping.

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

IT_1 = STOI(ISTOI + 1)
BRK_CHP = STOI(ISTOI + 2)

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

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

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

! 50:[varrlc] Variable R, L or C
CALL E_VARRLC1_EXE(0 ,SS(1) , (IBRCH(1)+2), 0, R_chopper, 0.0)

! 60:[buffer] Hysteresis Buffer


!
CALL EMTDC_XHBUFF(0,0,Ecap,Vdc_chop_on,Vdc_chop_off,RVD2_1)
IT_1 = NINT(RVD2_1(1))
!

! 70:[inv] Interpolated Logic Inverter


IF (IT_1 .NE. 0) THEN
BRK_CHP = 0
ELSE
BRK_CHP = 1
ENDIF

! 80:[pgb] Output Channel 'BRK_CHOP'

PGB(IPGB+1) = REAL(BRK_CHP)

! 90:[breaker1] Single Phase Breaker 'BRK_CHP'


IVD1_2 = NSTORI
NSTORI = NSTORI + 1
CALL E1PBRKR1_EXE(SS(1), (IBRCH(1)+1),0.005,1000000.0,1,NINT(1.0-R&
&EAL(BRK_CHP)))
IVD1_1 = 2*E_BtoI(OPENBR( (IBRCH(1)+1),SS(1)))
IF (FIRSTSTEP .OR. (STORI(IVD1_2) .NE. IVD1_1)) THEN
CALL PSCAD_AGI2(ICALL_NO,398924969,IVD1_1,"BOpen")
ENDIF
STORI(IVD1_2) = 2*E_BtoI(OPENBR( (IBRCH(1)+1),SS(1)))

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

STOF(ISTOF + 1) = Ecap
STOF(ISTOF + 2) = Vdc_chop_on
STOF(ISTOF + 3) = Vdc_chop_off
STOF(ISTOF + 4) = R_chopper
STOI(ISTOI + 1) = IT_1
STOI(ISTOI + 2) = BRK_CHP

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

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

IF ( TIMEZERO ) CALL EMTDC_CLOSEFILE


RETURN
END

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

SUBROUTINE ChopperOut()

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

REAL VBRANCH !

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

! Electrical Node Indices

! Control Signals

! Internal Variables

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

NPGB = NPGB + 1
INODE = NNODE + 2
NNODE = NNODE + 5
NCSCS = NCSCS + 0
NCSCR = NCSCR + 0

! Initialize Subsystem Mapping

ISUBS = NSUBS + 0
NSUBS = NSUBS + 1

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

! Initialize Branch Mapping.

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

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

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

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

! 90:[breaker1] Single Phase Breaker 'BRK_CHP'


! Single phase breaker current
!

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

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

IF ( TIMEZERO ) CALL EMTDC_CLOSEFILE


RETURN
END

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

SUBROUTINE ChopperDyn_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'

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

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

! Subroutine Arguments

! Electrical Node Indices

! Control Signals
! Internal Variables

! Indexing variables
INTEGER ICALL_NO ! Module call num
INTEGER IT_0 ! Storage Indices
INTEGER ISUBS, SS(1), IBRCH(1), 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 + 5
NCSCS = NCSCS + 0
NCSCR = NCSCR + 0

! Initialize Subsystem Mapping

ISUBS = NSUBS + 0
NSUBS = NSUBS + 1

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

! Initialize Branch Mapping.

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

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

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

! 60:[buffer] Hysteresis Buffer

! 70:[inv] Interpolated Logic Inverter

! 80:[pgb] Output Channel 'BRK_CHOP'

! 90:[breaker1] Single Phase Breaker 'BRK_CHP'


CALL COMPONENT_ID(ICALL_NO,398924969)
CALL E1PBRKR1_CFG(0.005,1000000.0,0.0)

RETURN
END

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

SUBROUTINE ChopperOut_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'

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

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

! Subroutine Arguments

! Electrical Node Indices

! Control Signals

! Internal Variables

! Indexing variables
INTEGER ICALL_NO ! Module call num
INTEGER IT_0 ! Storage Indices
INTEGER ISUBS, SS(1), IBRCH(1), 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 + 5
NCSCS = NCSCS + 0
NCSCR = NCSCR + 0

! Initialize Subsystem Mapping

ISUBS = NSUBS + 0
NSUBS = NSUBS + 1

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

! Initialize Branch Mapping.

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

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

RETURN
END

Anda mungkin juga menyukai