Restricted Earth Fault Protection - 1
Restricted Earth Fault Protection - 1
Prepared by
Mostafa Malekpour
Acknowledgements
Thanks to Parisa Saeidi and Alireza Ashrafi for their kind supports and comments on
Fortran programming language and model development.
The Application Example
An optimal Point-on-Wave (PoW) switching can potentially eliminate transformers’ transients
if residual core and core flux transients are considered in the closing algorithm. The schematic
below shows a very simple project developed in PSCAD environment to implement PoW
transformer switching. The transformer is a typical 100MVA 33kV/132kV transformer and its
data are provided at the end of this document.
Initially, the circuit-breaker is open and the transformer’s winding 1 is open-circuited by
connecting a very large resistance to it. Further, the DC current sources are used to set the
residual core fluxes to +80%, -80% and 0% of the peak nominal flux, for phases A, B and C,
respectively (0.23A for the phases A and B). To minimise the transformer inrush currents, the
poles of the breaker should be closed when prospective flux equals to the residual flux. The
prospective flux is related to the winding 2 voltage V2 as follows:
𝑑𝜑𝑝𝑟𝑜𝑠
𝑉2 (𝑡) = 𝑁 .
𝑑𝑡
With N as the winding’s turns. Therefore, the prospective flux could be obtained by solving
the equation below in time-domain:
1 𝑡
𝜑𝑝𝑟𝑜𝑠 (𝑡) = 𝜑𝑝𝑟𝑜𝑠 (𝑡 − Δ𝑡) + ∫ 𝑉 (𝑡) 𝑑𝑡
𝑁 𝑡−Δ𝑡 2
Based on the equation above, the prospective flux calculation could be implemented in PSCAD
by two methods as illustrated in Figure 2. In the first method, three integrators (with time
constant of 1s) are used to take integration of the phase-to-ground voltages measured (in kV)
at the voltage source terminal. Then, the prospective fluxes are obtained (in kWb-N) by
multiplying the voltage integral by a gain denoted by kv2f. Thus, the gain kv2f would be equal
to the peak nominal flux divided by the peak nominal value of the phase-to-ground voltages:
𝜑𝑝𝑒𝑎𝑘
𝑘𝑣2𝑓 =
𝑉2𝑝𝑒𝑎𝑘
2
Figure 2. Prospective flux calculation methods developed in PSCAD environment
In PSCAD, the peak value of transformers’ flux is equal to the peak value of the voltage across
their winding 1. In the application example, the winding 1 of the transformer is in delta
connection, then gain kv2f can be obtained as follows:
𝜑𝑝𝑒𝑎𝑘 33√2
𝑘𝑣2𝑓 = = = 0.433
𝑉2𝑝𝑒𝑎𝑘 132√2
√3
In the second shown in Figure 2, the first approach explained above could be implemented
by a user-defined component. The creation of this component is elaborated below.
3
The appeared Component Wizard pane, enter a name for the new component definition. This
name must conform to Fortran standards (i.e., it cannot begin with a number or contain any
spaces or other illegal characters). The title is optional, and it will be added to the component
graphic. Next, click Add Ports button after adding a left-hand side port and a right-hand side
port for the component graphic.
4
Enter Symbol names for the port connections conforming to Fortran standards. Set their
dimensions to 3. Note that entering 0 indicates that this port is to assume the dimension of
whatever it is connected to. For the voltage and flux signals select the port types of Input and
Output, respectively. Further, their data type needs to be Real. Finally, press the Finish button
and paste the created instance into any blank area in Schematic segment.
Graphic
This Graphic window is used for editing the graphics of the component definition. To open
the Graphic window, right click on the created component and select Edit Definition.
The original graphic view of the created component would be as shown below.
5
In the figure above, the back texts are optional text labels, and the user might delete them.
However, the connection ports shown in green shouldn’t be deleted. After some formatting
changes, the graphical representation of the defined component could be as below. The user
could change the line/fill colour of the graphic object.
Parameters
The Parameters window below is used for editing the parameters of the created component
definition.
The types shown below are available for defining parameters (integer, real, text etc). As the
first parameter, define a real parameter.
6
Then, the window below will appear in which specifications of the new parameter can be
defined/chosen by the user.
This parameter is defined for the line-to-line voltage of the transformer’s winding 1, with the
specifications below. It will be used to calculate the peak nominal flux of the transformer.
To determine the peak nominal flux, the connection type of the winding 1 needs to be defined
as a parameter for the created component. As the winding type could be star or delta, its
parameter should be a Choice List.
7
First, fill its specifications as shown below.
Next, press on the three dots at the Edit Droplist row to pop up the window below.
8
Add a new member for showing windings with delta connection. Its value could be set to 1.
As the last parameter, define a real parameter to specify the line-to-line voltage which will
energise the transformer. Its specifications could be set as shown below.
Now, the user can enter the appropriate values for the parameters by double clicking on the
component instance.
9
Script
This Script window is used for editing non-module component definition code. Contained
within this section is the heart of the definition. The Script section is used primarily for lower-
level code entry, and it consists of a variety of Segments, each performing a specific function.
Not all segments need to exist in every component, but the most used segments are Fortran,
Computations and Branch, and these are included by default in every newly created
definition. However, we only need to use Fortran segment for V2Flux component.
The Fortran segment is where any Fortran code, defining what the component is to model, is
placed. Code entered in this segment should either exist in the form of standard Fortran 90
and or Definition Script. It is also possible to define a function or call an external subroutine
from this segment.
When using actual Fortran code in this segment, it is important to note that all lines should
be preceded by the allotted six spaces (press tab key).
As the first step, define the local parameters as listed below. Note that these local parameters
will be reset at each time step of the simulation.
Next, the base flux (i.e., the peak nominal flux) could be determined using and if-else
statement as follows. Not that the symbol $ needs to be added before the external variables
(the connection ports and the parameters).
The constants sqrt_2 and sqrt_3 are EMTDC internal variables defined in standard include file
of emtconst.h. All EMTDC Internal Variables may be utilized, without the need to declare
them or add include files, when coding in the Fortran segment. These variables are provided
in EMTDC user manual (section Include Files).
10
Then, the gain kv2f is determined by the code after if-else statement.
Now, a loop needs to be used to calculate the prospective flux for all three phases of the
transformer. It could be a do-loop as it is shown below. The first number is a statement label.
Typically, there will be many loops and other statements in a single program that require a
unique label. The loop starts with the first number after the equality sign, and it ends with the
second number. The third number specifies the steps from the start point to the end point. If
the step is not defined by the user, the do-statement is incremented by 1 by default.
Inside the do-loop, an if-else statement needs to be added to do calculations for the first time
step (signal initialisation) and the next steps, separately. The variable timezero is a logical
variable (defined in include file s1.h), it is true when time t=0.
We are going to take voltage integration through time with trapezoidal method. Therefore,
we need to know the value of voltage at (𝑡 − ∆𝑡) in addition to its value at t. In the code
snippet below, the variable Vin_lastval is used to store the current value of the voltage as its
last value for the next step.
11
Note that the variable Vin_lastval needs to be defined as an output connection port (by the
connection port icon in Shape tools, or by duplicating a connection port which is already
defined for the component). It’s port could be located anywhere inside the graphic window.
Now, the voltage integration could be formulated as shown the code snippet below. The
variable delt, that is a real variable in include file s1.h, returns the simulation time step in
seconds.
12
Note that a new output port needs to be added to the component for the voltage integral
value, because integration is a cumulative action through time.
Finally, the flux can be calculated from the voltage integral as it is formulated in the code
snippet below. Its initial value could be set to zero for the first time step.
As it is shown in the simulation results, the fluxes calculated by the component V2Flux are
identical to those obtained by the first method (i.e., using the three integrators and a gain
block).
13
The Simulation Results
14
15
The Transformer Data
The transformer’s data are typical parameters.
16
The Fortran Code
if ($YD1==1) then
flux_base = (sqrt_2*$V1b) ! base flux with Tx Winding 1 Type of delta
else
flux_base = (sqrt_2*$V1b/sqrt_3) ! base flux with Tx Winding 1 Type of star
end if
$Vin_lastval(i) = $V_in(i) ! store voltage as its last value for next time step
end If
10 end do
17