Voltage Controlled Current Source
Voltage Controlled Current Source
This is a power conversion element that interfaces a nonlinear time domain model, in the Hammerstein-
Wiener (HW) framework, to the OpenDSS dynamics mode. The model senses terminal voltage and
updates the injected current at each OpenDSS time step. Figure 1 shows the relationship between HW
and OpenDSS domains, and it defines the key signal locations to reference when reading the Delphi
code. In a snapshot mode, the model injected current will be constant, as determined by its ratings and
initial power output level. The initial application is for photovoltaic (PV) inverter modeling, and the
parameters are defined in those terms. The PV inverter models are based on a project sponsored by
EPRI at the University of Pittsburgh [1], and they are intended to fill a gap between very detailed [2] and
very simple [3] models.
N
u(t) −i
w(t) ∑b z
i =0
i z(t) y(t)
H (z) = N
1 + ∑ ai z − i
i =1
+ M
2
I inj = I base ∑y i
Vt
Iinj i =1
1
u (t ) = Vt cos(377t + ∠Vt ) - M = f sample 60
Vbase
∠I inj = ∠Vt
OpenDSS in Phasor-Dynamic Domain
Figure 1: Interface between HW and OpenDSS solution variables
Input parameters are listed below. The HW components in Figure 1 work on per-unit variables, so the
user will generally adjust only the three bold-italics parameters for specific applications.
HWTest.DSS
This file illustrates two inverter models in a snapshot solution. The inverters are connected to a 360-volt
source, which matches the lab tests done at 208 volts. The short circuit current supplied by the source is
7354 amps. When phases=3, the VCCS component works in snapshot mode, but not yet in dynamics
mode. BP1, BP2, Filter and Fsample have no effect in snapshot mode. The initial currents will be
3000 100 3000 50
I SMA1 = = 14.42 and I SMA3 = = 2.41
208 100 360 3 100
Clear
new circuit.HWTest
~ basekv=0.360 pu=1.0 angle=0 phases=3 bus1=SourceBus r1=0.02 r0=0.02 x1=0.02
x0=0.02
redirect HW_Inverters.txt
Set Voltagebases=[0.360]
set maxiterations=100
calcv
Solve
HWDynTest.dss
The file that runs a dynamics test has been set up to run either the single-phase inverter or the
microinverter, feeding a bolted fault with source impedance adjusted to match that of Pitt’s electric
power lab. The fault’s ontime value will determine when the HW model departs from its initial
condition. In this case, Fsample is 10 kHz, so the OpenDSS time step must be at least 0.1 ms, but it can
be longer. The HW model can run at a faster time step within each OpenDSS time step.
Clear
// EPSL impedance is 10% on 75 kVA positive sequence, 5% zero sequence,
assume X/R = 2
new circuit.HWDynamic
~ basekv=0.360 pu=1.0 angle=0 phases=3 bus1=SourceBus r1=0.029 x1=0.058
r0=0.014 x0=0.029
redirect HW_Inverters.txt
New vccs.pv Phases=1 Bus1=SourceBus.1 Prated=3000 Vrated=208 Ppct=100
~ bp1='bp1_1phase' bp2='bp2_1phase' filter='z_1phase' fsample=10000
//New vccs.pv Phases=1 Bus1=SourceBus.1 Prated=190 Vrated=208 Ppct=89.5
//~ bp1='bp1_micro' bp2='bp2_micro' filter='z_micro' fsample=10000
Set Voltagebases=[0.360]
set maxiterations=100
calcv
set mode=snap
solve
set mode=dynamic
set stepsize=0.01 // 0.0001 matches fsample
set number=25 // 2500 matches fsample
Solve
HW_Inverters.txt
This included file defines BP1, BP2, and a 14th-order filter for the microinverter, listed below. The single-
phase inverter data is formatted the same way, but it has a 51-order filter, which means its transient
response will last longer.
// library model for microinverter
Ybp1 Ybp2
600 20
500 10
400
0
300 -30 -20 -10 0 10 20 30 40 50 60
200 -10
100 -20
0
-30
-300 -200 -100 0 100 200 300
-100
-40
-200
-300 -50
In Figure 3, the OpenDSS time step matches the HW model time step. When OpenDSS runs at a slower
time step, the HW model still runs internally at Fsample=10 kHz. However, the output is only sampled at
the slower time step, and the current injections are only updated at the slower time step. Figure 4
shows this effect. Especially at 10 ms time step, the waveform is “choppy” but the RMS vs. time is not
affected very much.
Figure 3: Current waveform, RMS and peak state variables [per-unit] for single-phase inverter. h=0.1 ms (left) and injected
current into the feeder [Amps] (right)
Figure 4: Current waveform, RMS and peak state variables [pu] for single-phase inverter. h=1 ms (left) and 10 ms (right)
Figure 5: Microinverter current state variables [per-unit] (left) and injected current into the feeder [Amps] (right) at h=0.1 ms.
Figure 6: Microinverter voltage state variables (left) and current state variables (right) at h=2 ms.
Code Listings
The most significant parts of the VCCS code define, initialize and integrate the state variables. Listings
follow.
Evaluating H(z) in Figure 1 requires history storage for both input and output. A second copy of both
history terms is required for the predictor and corrector steps. Otherwise, when the OpenDSS and HW
steps are unequal, the last step’s history could be corrupted by a partial update before the corrector
step initiates. The history terms are z, whist, zlast and wlast, allocated to a size determined from the
base and sampling frequencies. A ring buffer indexing scheme is used to manage this storage, with
helper functions MapIdx and OffsetIdx.
The overloaded InitStateVars procedure extracts terminal voltage and current from the most recent
snapshot solution. Then it steps back in time at the sampling frequency to initialize the history terms.
The history of z is determined from the history of current, i, passed in reverse through BP2. The HW
model current uses generator convention while the OpenDSS current uses passive convention, leading
to a negative sign on the initial values of z.
The overloaded IntegrateStates procedure is called twice in each OpenDSS time step, first as predictor
(Forward Euler) and then as corrector (Backward Trapezoidal). Each time, it extracts terminal voltage
and ensures that whist and z begin afresh from the previous OpenDSS time step. Then, it runs through
the BP1, z, and BP2 evaluations defined in Figure 1 for the number of sampling steps contained in an
OpenDSS time step. RMS current is calculated “brute force” at the end of the OpenDSS time step, for
both predictor and corrector. This value, sIrms, is later injected into the grid via the overloaded
procedure GetInjCurrent (not listed below). Note that the current angle updates are not yet
implemented. The peak current state variable is checked every HW step, in order to catch “fast” peaks
that might not appear in monitor output. The other state variables, and the wlast / zlast history terms,
are only updated at each OpenDSS corrector time step.
private
Fbp1: TXYcurveObj;
Fbp1_name: String;
Fbp2: TXYcurveObj;
Fbp2_name: String;
Ffilter: TXYcurveObj;
Ffilter_name: String;
BaseCurr: double; // line current at Ppct
FsampleFreq: double; // discretization frequency for Z filter
Fwinlen: integer;
Ffiltlen: integer;
Irated: double; // line current at full output
Fkv: double; // scale voltage to HW pu input
Fki: double; // scale HW pu output to current
sFilterout := 0;
vlast := cdivreal (Vterminal^[1], Vrated);
// initialize the ring buffer indices; these increment by 1 before actual use
sIdxU := 0;
sIdxY := 0;
end;
// this is called twice per dynamic time step; predictor then corrector
procedure TVCCSObj.IntegrateStates;
var
t, h, d, f, w, wt: double;
vre, vim, vin, scale, y: double;
nstep, i, k, corrector: integer;
vnow: complex;
iu, iy: integer; // local copies of sIdxU and sIdxY for predictor
begin
ComputeIterminal;
t := ActiveSolutionObj.DynaVars.t;
h := ActiveSolutionObj.DynaVars.h;
f := ActiveSolutionObj.Frequency;
corrector := ActiveSolutionObj.DynaVars.IterationFlag;
d := 1 / FSampleFreq;
nstep := trunc (1e-6 + h/d);
w := 2 * Pi * f;
DG_Prot_Fdr.dss
Our last example illustrates use of the VCCS model in an IEEE test feeder for DG protection analysis. See
Figure 7, with feeder data defined in [4]. The DG was originally assumed to contribute fault current as a
rotating machine, but here the source is a PV inverter, represented with a VCCS. Note that the VCCS
does not emulate solar panel efficiency, power fluctuations, or smart inverter control; for those
features, please use other components of OpenDSS (e.g. PVSystem, InvControl, ExpControl). In Figure 7,
we will apply single-line-to-ground faults (SLGF) at the feeder mid-point location, bus Bm or fault
location 3.
Lat1 1 Lat2
2
Bx B0
F1 F2
3
A B
B1 Bm B2 Bt C Bg
VCCS
4
D
Bp
Figure 7: IEEE test feeder for DG protection analysis [4]
Here is a partial listing of the test file DG_Prot_Fdr.dss, showing the 1.7 MVA wind turbine generator
commented out, and an equivalent 1.7 MW PV generator comprised of single-phase inverters. In either
case, a 1700-kVA wye/wye interconnection transformer interfaces the DG to the primary feeder.
// DG interconnection transformer and a conventional machine
new Transformer.Tg phases=3 windings=2 buses=(Bt Bg) conns=(Wye Wye)
~ kvs='12.47 0.36' kvas='1700 1700' taps='1 1' XHL=5
//new Vsource.WindGen1 bus1=Bg basekv=0.36 pu=1.0 angle=-60.0
//~ X1=0.0127 R1=0.0 X0=100.0 R0=0.0
redirect HW_Inverters.txt
New vccs.pv1 Phases=1 Bus1=Bg.1 Prated=567e3 Vrated=208 Ppct=100
~ bp1='bp1_1phase' bp2='bp2_1phase' filter='z_1phase' fsample=10000
New vccs.pv2 Phases=1 Bus1=Bg.2 like=pv1
New vccs.pv3 Phases=1 Bus1=Bg.3 like=pv1
Figure 8 shows the current and voltage through recloser B, on the high side of the interconnection
transformer, with a 1700-kW PV inverter source backfeeding the fault at Bm. The fault occurs at 0.2
seconds, just after steady-state DG output currents have stabilized. The faulted phase voltage (Figure 8
right) collapses almost immediately. Figure 9 shows the same fault response for a Thevenin equivalent
source in place of the PV. The Thevenin impedance is sized to produce 6 pu short-circuit current at the
source terminals based on 1700 kVA. As a result, the fault contribution is higher and the feeder primary
voltage on the faulted phase, at recloser B, is maintained at a low level indefinitely.
In conclusion, the HW model response and initialization has improved since the last version of this Tech
Note. Per-unit scaling has also been implemented. Work continues to improve stability and quality of
the HW model fitting process.
Figure 8: Currents (left) and voltages (right) at recloser B with 1.7 MW PV and single-phase inverter model
Figure 9: Currents (left) and voltages (right) at recloser B with 1.7 MW rotating machine (Thevenin equivalent)
References
[1] L. M. Wieserman, T. E. McDermott, and R. C. Dugan, "Open and Short Circuit Testing of
Photovoltaic Inverters," IEEE Transactions on Power Delivery, submitted.
[2] M. E. Ropp and S. Gonzalez, "Development of a MATLAB/Simulink Model of a Single-Phase Grid-
Connected Photovoltaic System," IEEE Transactions on Energy Conversion, vol. 24, pp. 195-202,
2009.
[3] L. Wieserman and T. E. McDermott, "Fault current and overvoltage calculations for inverter-
based generation using symmetrical components," in 2014 IEEE Energy Conversion Congress and
Exposition (ECCE), 2014, pp. 2619-2624.
[4] T. E. McDermott, "A test feeder for DG protection analysis," in Power Systems Conference and
Exposition (PSCE), 2011 IEEE/PES, 2011, pp. 1-7.