Beruflich Dokumente
Kultur Dokumente
Workshop p
Main Instructor:
Roger C. Dugan
Sr. Technical Executive, EPRI
Co-Instructors:
Robert F. Arritt EPRI
Jeff Smith EPRI
Matt Rylander - EPRI
Hosted by UNC-Charlotte
5-7 June 2013
Agenda Day 1 and Day 2
Day 1
Introduction
I t d ti and d Installation
I t ll ti
Circuit Modeling and Scripting
Detailed Scripting and Circuit Modeling
Introduction to the COM Interface
Day 2
Custom Scripting
Various Examples
Under the Hood (OpenDSS Internals)
UNCC Tour and Student Presentations
Typical
yp 4-wire multi-grounded
g neutral system
y
Three-phase
p throughout,
g ,
including secondary (LV)
European-Style System
MV
LV
MV (ALL)
Heritage of OpenDSS
Harmonics solvers rather than power flowf
Gives OpenDSS extraordinary distribution system
modeling capability
Simpler to solve the power flow problem with a
harmonics solver than vice-versa
Supports all rms steady-state (i.e., frequency domain)
analyses commonly performed for utility distribution
system
y planning
p g
And many new types of analyses
Original purpose in 1997: DG interconnection analysis
What it is NOT
An Electromagnetic transients solver (Time
( Domain))
It can solve Electromechanical transients
Frequency Domain => Dynamics
Dynamics mode
All solutions are in phasors (complex math)
Not a Power
Power Flow
Flow program
Not a radial circuit solver
Does meshed networks with equal ease
Not a distribution data management tool
It is a simulation engine designed to work with data
extracted
t t d from
f one or more utility
tilit databases
d t b
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 10
Why Did We Write DSS the Way We Did?
Inf. Bus
(Voltage, Angle)
Power Delivery
System
Comm
Msg Queue 1
Power Conversion
Element
("Black Box")
Control
Center
C
Comm
Msg Queue 2 Control
Static
Power flows
f with large time steps
Time
Control queue employed to delay actions
Control acts when time is reached
Event
DG
Interconnection studies/screening
Value of service studies (risk based)
Solar PV voltage rise/fluctuation
Wind power variations impact
Hi-penetration solar PV impacts
Harmonic distortion
Dynamics/islanding
70
25000
60
20000
50
15000
Load, MW
W
40
kWh
10000
30
5000
20
1
5
9
0
Hour
13
10
Oct
17
Jul
21
Apr
Month
0
Jan
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 25
Using DSS to Determine Incremental Capacity
of DG
1200 7000 14
1000
6000 12
800 MWh Base_Case
5000 2MW CHP
2MW_CHP 10
600
Incr. Cap.
Incr. Cap., MW
400
MWh EEN
4000 8
200
1
3000 6
4
0
7
10
Dec
Nov
Hour 2000 4
Oct
13
Sep
Aug
16
Jul
Jun
19
May
Month 1000 2
Apr
Mar
22
Feb
M
an
Ja
0 0
6000
150 160 170 180 190 200 210
MW Load
5000
4000
KW 3000
How much more p power can be served at
2000
the same risk of unserved energy?
1000
0
1 2
3 4
5 6
7 8
9 10
S12
11 12
S11
13 14
S10
Hour
S9
15 16
S8
S7
17 18 Month
S6
S
19 20
S5
S4
21 22
S3
S2
23 24
S1
5000 2500
4500 2000
4000 1500
kvar
3500 1000
2500 0
Pow
2000 -500
kW
1500 -1000
1000 -1500
500 -2000
0 -2500
1077
1346
1615
1884
2153
2422
2691
2960
3229
3498
3767
4036
4305
4574
4843
5112
5381
5650
5919
6188
6457
6726
6995
7264
7533
7802
8071
8340
8609
270
539
808
1
Hour
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 27
Solar PV Simulation 1 h step size
5 5
Without PV With PV
Difference
4 4
3 3
Difference,, MW
MW
2 2
1 1
0 0
-1 -1
OpenDSS Workshop, Charlotte, 2013 2 Weeks
2013 Electric Power Research Institute, Inc. All rights reserved. 28
1-s Solar Data Cloud Transients
1
0.9
0.8
Perr Unit of Maximum
0.7
0.6
0.5
0.4
03
0.3
0.2
0.1
0
0 500 1000 1500 2000 2500 3000
Time,s
Regulator Operations
Voltage overshoots as
power output ramps up
Regulator taps up
to compensate for
voltage drop
p.u. Voltage
Voltage Profile w/ DG
1.10
High Voltages
Distribution
1.05 S t
Systems d
designed
i d
for voltage DROP,
not voltage
g RISE.
1.00
0.95
0.90
00
0.0 20
2.0 40
4.0 60
6.0
Distance from Substation (km)
350
300
200
No-Load Losses Peak Load Week
150
100
350
50 Total Losses
Load Losses 300
0
0 50 100 150 250
sses, kW
Hour (1 Week)
200
150
Los
50
No-Load Losses
0
5200 5250 5300 5350
Hour (1 Week)
3000
P3-(kW) (W))
2000
1000
Feeder Voltage and Regulator Tap Changes
1.03
0
1 02
1.02
-91
1.01
Q3-(kvar) (VAr)
-191
1.00
-291
0.99
-391
0.98
-491
0.97
-591
0 20000 40000 60000 (V )
80000
1.02
Time (s)
Ta p -(p u )
Electrotek Concepts TOP, The Output Processor
1.00
0 98
0.98
0.96
0 20000 40000 60000 80000
Time (s)
Electrotek Concepts TOP, The Output Processor
10000 80
9000
70
8000
60
7000
50
6000
Base kW
kW
5000 40 Net kW
kWh Stored
4000
30
3000
20
2000
10
1000
0 0
0 50 100 150 200 250 300
Hours
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 35
Dynamics Storage Simulation
(R
(Requires
i separately-licensed
t l li d DLL)
Fault Current
Magnitudes
Detailed LV Modeling
Including multiple feeders, transmission
DG Integration and Protection
Generator and Inverter Models
Meshed (Looped) Network Systems
Regulatory Time Pressures
Installation
and Basic Usage
SourceForge.Net Links for OpenDSS
Source Code
../Trunk/Source
Examples
../Trunk/Distrib/Examples/
/T k/Di ib/E l /
../Trunk/Distrib/IEEETestFeeders/
../Trunk/Distrib/EPRITestCircuits/
Latest
L t t Builds
B ild (B
(Betas)
t )
.. /Trunk/Distrib/X86/
.. /Trunk/Distrib/X64/
To Download all the files from SourceForge
g by:
y
2 - right
right-click
click on it and choose "SVN
SVN Checkout...
Checkout " from the menu
For
F eachh off X86 and
d X64 versions:
i
1. OpenDSS.EXE Standalone EXE
2 OpenDSSEngine.DLL
2. OpenDSSEngine DLL In-process
In process COM server
3. KLUSolve.DLL Sparse matrix solver
Or
http://sourceforge.net/apps/mediawiki/electricdss/index.php?title=How_
Do_I_Register_the_COM_Server_DLL_on_Windows_7%3F
1. Right
g click on the desktop
p and select new -> shortcut
2. For location of item just type cmd
3. This will create a new shortcut to a command prompt on your
desktop
4. Right click on the new shortcut and select Properties
5. On the shortcut tab select Advanced
6.
6 Ti
Tick
k th
the R
Run as Ad
Administrator
i i t t b box
7. Press Apply/OK and that command prompt will always be run
as administrator allowing the user to use regsvr32
GUID
Points to OpenDSSEngine.DLL
(In process server,
(In-process server Apartment Threading model)
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 58
32-bit Vs 64-bit
On
O Windows
Wi d 7 you can register
i t bboth
th versions
i
They are in separate places in the registry
You will probably need to register both
MATLAB is often installed as 64-bit (x64)
MS Office is most often installed as 32-bit (x86)
( )
Text
Scripts
CO
COM
Interface M i Simulation
Main Si l ti Engine
E i
User-
User
Written
Scripts, DLLs
Results
User-
User
Written
Scripts, DLLs
Results
DSS Executive
Commands Options
Circuit Solution
V [Y] I
Instances of Objects
j of this class
Class Object 1
Property Definitions Property Values
Methods
Class Property Editor
Yprim
Object n
Property Values
Methods
Yprim
States
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 65
Some of the Models Currently Implemented
GENERAL DATA
CNDATA (Concentric neutral cable data)
GROWTHSHAPE (Growth vs year)
LINECODE (Line and cable impedances, matrices or symmetrical components)
LINEGEOMETRY (Line geometry data)
LINESPACING (spacing data for LINEGEOMETRY)
LOADSHAPE (Load shape data)
PRICESHAPE (Price shape data)
SPECTRUM (Harmonic spectra)
TCC_CURVE (TCC curves)
TSDATA (Tape shield cable data)
TSHAPE (Temperature shape data)
WIREDATA (Wire parameters, GMR, etc.)
XFMRCODE (Transformer type definitions)
XYCURVE (Generic x-y curves)
METERS
ENERGYMETER (Captures
(C t energy quantities
titi and
d losses)
l )
MONITOR (Captures selected quantities at a point in the circuit)
SENSOR (Simple monitor used for state estimation)
OTHER
FAULT ((1 or more faults can be placed
p anywhere
y in the circuit))
ISOURCE (Multi-phase current source)
VSOURCE (2-terminal multiphase voltage source, thevinen equivalent)
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 67
Input Data Requirements
Nodes
0 1 2 3 4
Bus
Referring to Buses and Nodes (A Bus has 1 or more Nodes)
Bus1=BusName.1.2.3.0
((This is the default for a 3-phase
p circuit element))
Shorthand notation for taking the default
Bus1=BusName
Note: Sometimes this can bite you (e
(e.g.
g Transformers,
Transformers or
capacitors with ungrounded neutrals)
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 72
DSS Terminal Definition
2 Power Delivery
y
or Power Conversion
Conductors Element
3
Power Delivery
Element
Terminal 1 Terminal 2
Shorthand (implicit)
New Load.LOAD1 Bus1=LOADBUS
Assumes standard 3-phase connection by default
LOADBUS
5
4
3 LOAD
2
1
LOADBUS
Explicit
New Load.LOAD1 Bus1=LOADBUS.1.2.3.0
6
Explicitly defines which node
5
4 New Load.1-PHASELOAD Phases=1
3 Bus1=LOADBUS
Bus1 LOADBUS.2.0
20
2
1 LOAD
Connects 1-phase load to
0 Node 2 and ground
1-ph Load connected to
phase 2
Ungrounded-Wye Specification
Bus1=LOADBUS.1.2.3.4 (or some other unused Node
number)
LOADBUS
Neutral
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 79
Possible Gotcha: Specifying Two Ungrounded-
Wye Capacitors on Same Bus
MyBus
Bus1=MyBus Bus2=MyBus.4.4.4
MyBus
Power Delivery Power Delivery
Element Element
Terminal 1 Terminal 2 Terminal 1 Terminal 2
3
2
Iterm = [Yprim] Vterm Iterm = [Yprim] Vterm
Bus 1 Bus 2
1 1
Note: You may use XfmrCode
Wdg 2
to define a library of
transformer definitions that are Wdg 1 0
used repeatedly (like
Wdg 3
LineCode for Line elements)
0 or 2
2
3
3
4 4
(OPEN)
Simple Model
Scripting
Array
kvs = [115, 6.6, 22]
kvas=[20000 16000 16000]
Matrix
(3x3 matrix)
Xmatrix=[1.2 .3 .3 | .3 1.2 3 | .3 .3 1.2]
(3x3 matrix lower triangle)
Xmatrix=[ 1.2 | .3 1.2 | .3 .3 1.2 ]
TR1
LINE1
1 Mile, 336
Source ACSR
Loadbus
Sourcebus Sub_bus
115 kV
12.47 kV
LOAD1
1000 kW
0 95 PF
0.95
TR1
LINE1
1 Mile, 336
Source ACSR
Loadbus
Sourcebus Sub_bus
115 kV
12.47 kV
LOAD1
1000 kW
0 95 PF
0.95
TR1
LINE1
1 Mile, 336
Source ACSR
Loadbus
Sourcebus Sub_bus
115 kV
12.47 kV
LOAD1
1000 kW
0 95 PF
0.95
TR1
LINE1
1 Mile, 336
Source ACSR
Loadbus
Sourcebus Sub_bus
115 kV
12.47 kV
LOAD1
1000 kW
0 95 PF
0.95
TR1
LINE1
1 Mile, 336
Source ACSR
Loadbus
Sourcebus Sub_bus
115 kV
12.47 kV
LOAD1
1000 kW
0 95 PF
0.95
TR1
LINE1
1 Mile, 336
Source ACSR
Loadbus
Sourcebus Sub_bus
115 kV
12.47 kV
LOAD1
1000 kW
0 95 PF
0.95
TR1
LINE1
1 Mile, 336
Source ACSR
Loadbus
Sourcebus Sub_bus
115 kV
12.47 kV
LOAD1
1000 kW
0 95 PF
0.95
Vsource.Source SourceBus
Source
115 kV
One-Line Diagram
(d f lt is
(default i 3
3-phase
h wye-grdd source))
TR1
SourceBus Sub_Bus
Defining
f Using Arrays Defining Winding by Winding
Sub_Bus LoadBus
LINE1
1 Mile, 336
Loadbus
LOAD1
1000 kW
0. 95 PF
Solve
Show summary (power flow summary)
Show Voltages
Show Currents
Show Powers kVA elements
Also
Export (creates CSV files)
Plot
For small circuits, often put all the scripts in one file
Some
S IEEE test ffeeder examples are mostly in one filef
When you have large amounts of data, a more disciplined
approach is recommended using multiple files:
Redirect Command
Redirects the input to another file
Returns to home directory
Compile Command
Same as Redirect except repositions home directory
Mi
Misc. S
Scripts
i t
Plotting Scripts
Project Run window
Master.DSS
LineCodes.DSS
WireData.DSS
LineGeometry.DSS Libraries
Put a Clear in here
Spectrum DSS
Spectrum.DSS
LoadShape.DSS
Transformers.DSS
f SS
Lines.DSS Circuit
Make a separate folder for Definition
Loads.DSS
each circuit
Etc.
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 108
Organizing Run Scripts
S
Solve Snapshot
S Power Flow
Compile (C:\DSSdata\IEEETest\8500Node\Master-unbal.dss)
! Put an Energymeter at the head of the feeder
New Energymeter.m1 Line.ln5815900-1 1
S l
Solve
Clear
New Circuit.IEEE8500u
Redirect LineCodes2.dss
R di t T
Redirect Triplex_Linecodes.dss
i l Li d d
Redirect Lines.dss
Redirect Transformers.dss
Redirect LoadXfmrs.dss ! Load Transformers
Redirect Triplex
Triplex_Lines.dss
Lines dss
Redirect UnbalancedLoads.dss
Redirect Capacitors.dss
Redirect CapControls.dss
Redirect Regulators.dss
Capacitor
Three Single-Phase Capacitors
The capacitor
p is controlled to
switches ON when the reactive
Substation power flow in the line is 50% of
1200kvar
(controlled) the capacitor size and switches
OFF when the flow is 75% of
900kvar
(controlled) th capacitor
the it size
i in
i the
th reverse
900kvar
(controlled) direction.
Each controlled capacitor also
900kvar
includes voltage override where
th capacitor
the it turns
t ON att
One-line of the IEEE 8500-Node 0.9875pu and turns OFF at
OpenDSS Workshop, Charlotte, 2013
Test Feeder Circuit 1.075pu.
2013 Electric Power Research Institute, Inc. All rights reserved. 117
Capacitor-Control Timing
Regulator
CAPBank0
Capacitor
Turned-ON FIRST
Turn-OFFO LAST
S CAPBank2
1200kvar
Substation
Turned-ON LAST
(controlled)
Turn-OFF FIRST
900kvar
(controlled)
900kvar
(controlled)
CAPBank1
Turned-ON MIDDLE
900kvar
Turn OFF MIDDLE
Turn-OFF
One-line of the IEEE 8500-Node Test Feeder Circuit
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 118
Capacitor Control Multiple Control Methods
CapControl.JA-86271_Con_Temp_Summer.Enabled = no
CapControl.JA-86271_Con_Temp_Winter.Enabled = yes
Sol e
Solve
Summer Switching
g ((May
y 15 to September
p 15)) Non-Summer Switching
g ((September
p 15 to May
y 15))
Capactior Switching Capactior Switching
60 100 60 80
95
70
50 50
ON 90
60
85
40 40
Temperature (F))
Temperature (F))
50
Current (A)
Current (A)
80
OFF Capacitor Current
Capacitor Current
30 75 30 40
Temperature Temperature
70 30
20 OFF 20
65 ON
20
60 10
10
10
55
0 50 0 0
5400 5450 5500 5550 5600 5650 5700 1000 1050 1100 1150 1200 1250 1300
Hour Hour
!DSS Script:
New Transformer
Transformer.D4D2SA
D4D2SA phases=1 Windings=3
~Xhl=2.04 Xht=2.04 Xlt=1.36 %noloadloss=0.2
~wdg=1 bus=A.1 kv=7.2 kVA=15 %r=0.5
~wdg=2 bus=B.1.0 kv=0.12 %r=0.6 conn=delta
~wdg=3 bus=B.0.2
bus=B 0 2 kv=0.12
kv=0 12 %r=0.6
%r=0 6 conn=delta Note:
Xhl: reactance winding 1 to
winding 2(H-L)
Bus=A Bus=B
Xht: reactance winding 1 to
1 1
winding 3(H-T)
Xlt:
Xlt: reactance winding 2 to
winding 3(L-T)
0
Warning:
0 2 %loadloss overwrites %r
for windings 1 and 2 only.
!DSS Script:
New load.X_1 phases=1 bus1=1_sec_x.2 kV=0.24 xfkVA=50 pf=0.91 status=variable
~ model=4 CVRwatts=0.8 CVRvars=3 conn=wye yearly=LoadshapeB
CVRw factor = %P / %V
Where:
Z PQ I %P = Change in Power
%V = Change in Voltage
1.02
1.01
Voltage (PU)
0.99
Cicuit 2 - Base
0.98
Cicuit 2 - CVR
0.97
0.96
Regulators 0.95
0.94
0 2000 4000 6000 8000
Time (Hour)
Stand-alone EXE
32-bit
64-bit
Use this to develop text scripts to study problems
In-Process COM Server
32-bit
32 bit
64-bit
Use this to link OpenDSS to other programs
Automate the program
Execute complex algorithms
Text
Scripts
CO
COM
Interface M i Simulation
Main Si l ti Engine
E i
User-
User
Written
Scripts, DLLs
Results
GUID
DSS Cl
Class F
Functions
ti ((methods)
th d )
and Properties
(Class Exercise)
1.06
1.05
1.04
1.03
1.02
Series1
1 01
1.01
0 99
0.99
0.98
0.97
0 2 4 6 8
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 136
Branch Exchange Example
See
OpenDSS Wiki on SourceForge.Net
TechNote Excel VBA Example
TechNote_Excel_VBA_Example
Loss Minimization Branch Exchange
Branch Exchange
Loop Breaking
Branch & Bound
Heuristics
Optimization
Genetic Alg.
Simulated
Annealing
Ant Colony
Et cetera
Vmax = 0# track the maximum voltage difference across any open switch
ToClose = ""
ToOpen = ""
LowBus = ""
c = 14 column number for output
i = swt.First check all SwtControls
While i > 0 ' find the open switch with biggest delta-V
((Inner loop
p next slide))
Wend
ws.Cells(r, 13) = CStr(Vmax)
iter = r
' stop if too many iterations, system is non-radial, or losses go up
If iter > 10 Or ckt.Topology.NumIsolatedLoads > 0 Or ThisLoss > LastLoss Then
done = True met one of the three stopping criteria
End If
LastLoss = ThisLoss best loss total found so far
Wend
While i > 0 ' find the open switch with biggest delta-V
If swt.Action = dssActionOpen Then check only open switches
ws.Cells(r,
C ll ( c)) = swt.name
t
Set elem = ckt.CktElements(swt.SwitchedObj)
Vdiff = Abs(elem.SeqVoltages(1) - elem.SeqVoltages(4)) V1 across switch
If Vdiff > Vmax Then if highest V1 difference so far
LowBus = FindLowBus which side of open
p switch has lowest V?
topo.BusName = LowBus start from that bus in the topology
Set elem = ckt.ActiveCktElement
k=1
While (Not elem.HasSwitchControl) And (k > 0) trace back from low bus to src
k = topo.BackwardBranch
topo BackwardBranch until we find a closed switch
Wend
If elem.HasSwitchControl Then if we found a switch to close
Vmax = Vdiff keep this as the highest voltage difference found
ToClose = swt.name we will close this currently-open switch
ToOpen = Mid(elem.Controller, 12) and open the switch from back-trace
End If
End If
c=c+1
End If
i = swt.Next
Wend
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 140
Custom Simulations
Co-simulation Example
The Problem (A Hypothetical Case)
Voltage regulator
Clusters of
Storage Units
Result
Calls
C ll ffor a H
Hybrid
b id simulation
i l ti
Communications network (NS2)
Distribution network (OpenDSS)
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 144
How We Did It
OpenDSS
topology for NS2 script to
DS devices Extract
configure node
Time and
Coordinates topology
Power
NS2 Wireless
Circuit OpenDSS
Model
Model
Load Merge
Message
profiles Time and
Profile arrival times
timed to DS
event arrival
Load
L d profiles
fil
for each DS
device
DS Device
Load
Profile
Set sec=20
Solve ! Init steady state at t=20
Sample
Etc.
Comm Simulation
1.025
Base Phase a
Base Phase b
1.020 Base Phase c
e (per unit)
Phase a
Phase b
1.015 Phase c
ge Magnitude
1.010
1.005
Voltag
1.000
0 995
0.995
0 5 10 15 20 25 30
Time (seconds)
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 147
Comm and Power Co-simulation
Etc.
(time is used for recording purposes only)
These commands
allow step-by-step
step by step
control of the solution
process
End Sub
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 159
COM Interface
Interfaces as Exposed
p by
y VBA
Object Browser in MS Excel
End Sub
You can issue any of the DSS script commands from the
Text interface
Always a good idea to clear the DSS when loading a new circuit
DSSText.Command = "clear"
' Compile the script in the file listed under "fname"
fname cell on the main form
DSSText.Command = "compile " + fname
Set regulator tap change limits for IEEE 123 bus test case
With DSSText
.Command = "RegControl.creg1a.maxtapchange=1
g g p g Delay=15
y !Allow only
y one tap
p change
g pper solution.
This one moves first"
.Command = "RegControl.creg2a.maxtapchange=1 Delay=30 !Allow only one tap change per solution"
.Command = "RegControl.creg3a.maxtapchange=1 Delay=30 !Allow only one tap change per solution"
.Command = "RegControl.creg4a.maxtapchange=1 Delay=30 !Allow only one tap change per solution"
.Command
C d = "R
"RegControl.creg3c.maxtapchange=1
C t l 3 t h 1 D
Delay=30
l 30 !All
!Allow only
l one t
tap change
h per solution"
l ti "
.Command = "RegControl.creg4b.maxtapchange=1 Delay=30 !Allow only one tap change per solution"
.Command = "RegControl.creg4c.maxtapchange=1 Delay=30 !Allow only one tap change per solution"
.Command = "Set MaxControlIter=30"
End With
P bli DSSCi
Public DSSCircuit
it A
As O
OpenDSSengine.Circuit
DSS i Ci it
DSSText.Command = Compile xxxx.dss
Set DSSCircuit = DSSobj
DSSobj.ActiveCircuit
ActiveCircuit
DSSCircuit.Solution.Solve
Retrieving array quantities into variants
V = DSSCircuit
DSSCircuit.AllBusVmagPu
AllBusVmagPu
VL =DSSCircuit.AllElementLosses
Assuming
A i th
the existence
i t off a DSSCircuit
DSSCi it variable
i bl
referencing the Circuit interface
End With
V = DSSCircuit.ActiveElement.Powers
V = DSSCircuit.ActiveElement.seqCurrents
V = DSSCircuit.ActiveElement.Yprim
Name = DSSCircuit.ActiveElement.Name
Nph = DSSCircuit.ActiveElement.NumPhases
With DSSCircuit.ActiveElement
Get all the property names
VS = .AllPropertyNames
Get a property value by numeric index
V = .Properties(2).Val
Get same property value by name (VS is 0 based)
V = .Properties(VS(1)).Val
p y Value by
Set Property y Name
DSSCircuit.SetActiveElement(Line.L1)
.Properties(R1).Val = .068
End With
Option Explicit
Define some public variables that are
Public DSSobj As OpenDSSengine.DSS
OpenDSSengine DSS
Public DSSText As OpenDSSengine.Text used throughout the project
Public DSSCircuit As OpenDSSengine.Circuit
End Sub
' Always a good idea to clear the DSS when loading a new This subroutine loads the circuit
circuit from the base script files using
DSSText.Command = "clear" the Compile command through
' Compile the script in the file listed under "fname" cell on the
the Text interface.
interface fname
fname is a
main form string contains the name of the
DSSText.Command = "compile " + fname master file.
' The Compile command sets the current directory the that of
th fil
the file
There is an active circuit now,
' Thats where all the result files will end up.
so assign the DSSCircuit
' Assign a variable to the Circuit interface for easier access variable.
Set DSSCircuit = DSSobj.ActiveCircuit
j
End Sub
iRow = 2
For i = 1 To DSSCircuit.NumBuses ' Cycle through all buses Cycle through all the buses
Set DSSBus = DSSCircuit.Buses(i) ' Set ith bus active
Get the bus name
' Bus name goes into Column 1
WorkingSheet.Cells(iRow, 1).Value = DSSCircuit.ActiveBus.Name
' Load sequence voltage magnitudes of active bus into variant array
V = DSSBus.SeqVoltages Get the voltages
' Put the variant array values into Cells into the variant array
' Use Lbound and UBound because you don't know the actual range
iCol = 2
For j = LBound(V) To UBound(V) Put them on the
WorkingSheet.Cells(iRow, iCol).Value = V(j)
iCol = iCol + 1 spreadsheet
Next j
iRow = iRow + 1
Next i
End Sub
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 175
Running from MATLAB
Running OpenDSS From Matlab
f
function
ti [St
[Start,Obj,Text]
t Obj T t] = DSSSt
DSSStartup
t
% Function for starting up the DSS
%
%instantiate the DSS Object
Obj = actxserver(
actxserver('OpenDSSEngine.DSS');
OpenDSSEngine.DSS );
%
%Start the DSS. Only needs to be executed the first time w/in a
%Matlab session
Start = Obj.Start(0);
%Set the system frequency and vsource frequency for harmonic requested
DSSText.Command = ['set frequency=(' num2str(Freq) ' 60 *)'];
DSSText.Command = ['vsource.source.frequency=(' num2str(Freq) ' 60 *)'];
(etc. etc.)
Watts
Vars
Clear
! Example scripts for loading and plotting loadshapes out of the loadshape library
! directly ...
New "LoadShape
LoadShape.LoadShape1a
LoadShape1a" npts=8760 interval=1.0
interval=1 0 mult=(File=LoadShape1.csv)
mult=(File=LoadShape1 csv)
Plot Loadshape Object=Loadshape1a ! execute this to prove you got it
! or using
g Redirect
Redirect Loadshape1.DSS ! Load in Loadshape 1
Plot Loadshape Object=Loadshape1
Syntax:
mult=[File=myMultiColumnFile.CSV,
C CS C Column=n,
Header=Yes/No]
Allows use of multicolumn CSV files with a single header
row.
Example:
New Loadshape.Ramp2 npts=4000 sInterval=1
mult=(file=MultiChannelTest.csv, column=3, header=yes)
Imports the 3rd column from the file, skipping the
header row
Defaults
Stepsize
S = 1.0 h
Controlmode = static
Number = 24
Defaults
Stepsize
S = 1.0 h
Controlmode = static
Number = 8760
Defaults
Stepsize
S = 1.0 s
Controlmode = time
Number = 100
Defaults
Stepsize
S = 0.001 s
Controlmode = time
Number = 100
Defaults
Controlmode
C t l d = OFF
Loadmodel = Admittance
General Concept
Added into Injection
Current Vector
Compensation
Yprim Current
C
Compensation
i Phase 1
Yprim Current
Compensation Phase 2
3 Yprim
i C
Current
t
4
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 205
Load - 3-phase Delta connected
C
Compensation
i Phase 1
Yprim Current
1
Compensation Phase 2
Yprim
i C
Current
t
When the voltage goes out of the normal range for a load
the model reverts to a linear load model
This generally guarantees convergence
Even when a fault is applied
Script to change break points to +/- 10%:
Load.Load1.Vmaxpu=1.10
Load.Load1.Vminpu=0.90
Note: to solve some of the IEEE Radial Test feeders and match the
published results, you have to set Vminpu to less than the lowest voltage
published (usually about 0.80 per unit)
13
1.3 Const Z
1.2
1.1
105%
1 ((Defaults*))
0.9
95%
|I| = |S/V| 0.8
age
0.7
PU Volta
0.6
Const Z
0.5
0.4
0.3
0.2
* Change by setting Vminpu and
0.1 Vmaxpu Properties
0
0 0.2 0.4 0.6 0.8 1 1.2
OpenDSS Workshop, Charlotte, 2013 PU Current
2013 Electric Power Research Institute, Inc. All rights reserved. 209
Putting it All Together
ALL Elements
PC Elements
Comp. Currents
I1
I2
Iinj =
Y V
Node
Voltages
Im
Iteration Loop
ALL Elements
PC Elements
Comp. Currents
I1
I2
Iinj =
Y V
Node
Voltages
Im
Iteration Loop
Frequency Scans
Define a scan spectrum at a small frequency increment
Assign it to an ISOURCE or VSOURCE
You probably want do disable LOAD and GENERATOR harmonic
spectra,
t e.g.:
Spectrum.DefaultLoad.NumHarm=1
Otherwise, LOAD objects will inject a current at integer
harmonic frequencies
f yielding a really weird solution
Scans can be performed for (see ScanType property)
Positive sequence
Zero sequence
No sequence
Example Frequency Scan
\Distrib\Examples\FreqScan folder
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 222
Frequency Scan Example Script
// THIS SCRIPT WILL RUN A FREQUENCY SCAN ON THE IEEE 123 BUS TEST CASE
Spectrum.DefaultLoad.NumHarm=1
Spectr m Defa ltLoad N mHarm 1 ! This effectively
effecti el gets rid of LOAD harmonics
// Define a spectrum for the scan source
New spectrum.Scanspec numharm=1000 csvfile=ScanSpectrum.csv
// You can plot the Monitor, but Excel or Matlab might be better
Plot monitor object= mscan channels=(1 3 5 )
1.083333333 100 0
1.166666667 100 0 % Magnitude
H
Harmonic
i 1.25 100 0 (All 100%)
1.333333333 100 0
1.416666667 100 0
1.5 100 0
For 60 Hz base
1.583333333 100 0
frequency, this
1.666666667 100 0
gives a 5 Hz scan
1.75 100 0
Phase Angle
1.833333333 100 0
This is typically associated 1.916666667 100 0 (All 0)
with a 1-A current source, so 2 100 0
that the resulting voltages 2.083333333 100 0
represent driving-point
driving point Z
Z, 2.166666667
. 6666666 100
00 0
transfer Z, etc. 2.25 100 0
2.333333333 100 0
2.416666667 100 0
2 5
2.5 100 0
2.583333333 100 0
etc
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 224
Putting it All Together - Harmonics
PC Elements
H
Harmonici
injection Currents
I1
I2
Iinj =
Y V
Node
Voltages
((each
h
Frequency)
Im
Increment_time;
{Predictor}
IterationFlag := 0;
IntegratePCStates;
SolveSnap;
{Corrector}
IterationFlag := 1;
IntegratePCStates;
SolveSnap;
Phases Xd
A Positive
Phase Sequence
E1E
to
B Symmetrical
Component
Transformation
C
Negative
Xd
Sequence
Derivative Calculation:
dv Pshaft Pterm D v
dt M
d
v
dt
Integration
Trapezoidal integration formula for , for example:
t d d
n 1 n
2 dt n dt n 1
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 231
User-Written DLLs
Idl | Discharge
Idle Di h | Charge
Ch % Eff
Eff. Charge/Discharge
Ch /Di h
Other Key
kW,, kvar
a Properties
% Reserve
kWhRated
kWhStored
%Stored
Idling Losses kWh kWRated
STORED
etc.
Comm Link
V, I
Substation
Storage Fleet
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 235
Simple Peak Shave Example 75 kWh ea.
10000 80
9000
70
8000
60
7000
50
6000
Base kW
kW
5000 40 Net kW
kWh Stored
4000
30
3000
20
2000
10
1000
0 0
0 50 100 150 200 250 300
Hours
OpenDSS Workshop, Charlotte, 2013
2013 Electric Power Research Institute, Inc. All rights reserved. 236
Simple Peak Shave Example 25 kWh ea.
10000 30
9000
25
8000
7000
20
6000
Base kW
kW
5000 15 Net kW
kWh Stored
4000
10
3000
Ran
Ran Out of Gas
Gas
2000
5
1000
0 0
0 50 100 150 200 250 300
Hours
Parallel R (Rp)
Basic series R-X
R X model
1 N phases
1..