The Harmonic Impedance Solution component is used to find the multi-port impedance of any electrical component, or an entire network over a defined frequency range. If the impedance of a custom component is defined directly (i.e. as R, L and/or C passive elements in the branch segment, or through an EMTDC subroutine like E_BRANCH_CFG), then its impedance will be properly defined over a specified frequency range. However in many situations, the impedance of the component cannot be defined directly, but is done so as a general function of frequency (ex. in the case of electrical machines). In these situations, a special interface must be included in the custom component. This interface is described in this topic.
EXAMPLE:
In this example, the E_VARRLC1x subroutines are called from the Fortran segment of a user defined component definition, with its various arguments pre-defined as needed. The Fortran segment of the user component is shown below:
#SUBROUTINE E_VARRLC1_CFG ‘Variable RLC Begin Subroutine’ #SUBROUTINE E_VARRLC1_EXE ‘Variable RLC Dynamic Subroutine’ #BEGIN CALL E_VARRLC1_CFG(1,$SS,$BRN,$BRN) #ENDBEGIN #STORAGE REAL:2 ! CALL E_VARRLC1_EXE(1,$SS,$BRN,$BRN,$L,$E) !
|
Listing 5-17 – Calling the E_VARRLC1x Subroutines within the Component Definition
Here, both the E_VARRLC1_CFG and E_VARRLC1_EXE subroutines are configured to model a non-linear inductor (i.e. input argument 1), where the inductance is controlled by the input argument L. E controls the internal voltage source EBR. BRN and SS are the branch number and subsystem number respectively.
The branch number is defined in the Branch segment of the component definition as follows, where NA and GND are electrical nodes:
BRN = $NA $GND BREAKER 1.0
|
Listing 5-18 – Branch Segment Script to Coincide with E_VARRLC1x Subroutine Calls
User interface subroutine Called from custom component
- Pass information to Harmonic Component global variables
- Assign procedure pointer to the subroutine which defines the relationship between frequency and the impedance of the component
User Module
The impedance subroutine is defined
E.g.
User interface subroutine
SUBROUTINE my_subroutine (……..)
!
! Use EMTDC Custom harmonic module
USE HARM_CUS_COM
! User defined module
USE my_module
! Component number is updated for each component.
COMP_INDX = COMP_INDX + 1
! Pass component branches and node numbers to global arrays
CBRANCHES(COMP_INDX,:) = branch number
CNODES(COMP_INDX, :) = node number
!
CALL CUS_HARM_INT(SS,NO_NODES,NO_BR,REM_BR)
! Assign procedure pointer to the user defined impedance subroutine
CTYPE(COMP_INDX)%CSUB_PTR => my_fun
User Module
MODULE my_module
! Use EMTDC Custom harmonic module
USE HARM_CUS_COM1
CONTAINS
!
SUBROUTINE my_fun(F,Y)
! F = Frequency (input)
! Y = admittance (output)
! Define Y matrix as a function of frequency
!
Y(i,j) = f(F)
!
END MODULE my_module
variable Description Input/output dimension type
Y Admittance (Ohms) output MAX_NODES* MAX_NODES complex
F Frequency (Hz) input 1 real
The following global variables arrays are defined in EMTDC modules HARM_CUS_COM and HARM_CUS_COM1
COMP_INDX Custom component number. For each custom component, the component index number should be increased by one
CNODES(MAX_COMP,MAX_NODES) Node number array of the custom component
CBRANCHES(MAX_COMP,MAX_BRA) Branch number array of the custom component
CTYPE(COMP_INDX)%CSUB_PTR Procedure pointer array. This is a pointer to the user defined impedance subroutine. The Harmonic impedance component uses this pointer to call the subroutine
Parameters
description type value
MAX_NODES Maximum number of nodes in custom component integer 20
MAX_BRA Maximum number of branches in custom component integer 50
MAX_COMP Maximum number custom components in the pscad case integer 100
Limitation
This interface requires Intel Fortran compiler
Subroutine CUS_HARM_INT(SS,NO_NODES,NO_BR,REM_BR)
type description
SS integer Subsystem number
NO_NODES integer Number of nodes in the customer component
NO_BR integer Number of branches in the customer component
REM_BR logical .TRUE. , if the existing R,L,C branches (defied in branches segment or using E_BRANCH_CFG ) are neglected in impedance calculation. Then only the impedance defined in user subroutine is considered