Level 2
Level 2
1600
OpenDSS
Level 2 Training
1400
1200
1000
800
MWh
600
400
200
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
22
19
16
Hour
13
10
Month
27 April 2009
Roger Dugan
[email protected]
Getting Started:
Installation & Basic Usage
Program Files
OpenDSS.EXE
OpenDSSEngine.DLL
KLUSolve.DLL
DSSgraph.DLL
Standalone EXE
In-process COM server
Sparse matrix solver
DSS graphics output
10
GUID
11
Points to OpenDSSEngine.DLL
(In-process server, Apartment Threading
model)
12
In MATLAB:
DSSobj = actxserver(OpenDSSEngine.DSS);
In VBA:
Public DSSobj As OpenDSSEngine.DSS
Set DSSobj = New OpenDSSEngine.DSS
In PYTHON:
self.engine = win32com.client.Dispatch("OpenDSSEngine.DSS")
13
Multiple script
windows
14
15
DSS Structure
DSS Structure
Scripts
COM
Interface
Scripts,
Results
17
UserWritten
DLLs
Options
Circuit
Solution
PDElement
Line
Transformer
Capacitor
Reactor
PCElement
Load
Generator
Vsource
Isource
Controls
RegControl
CapControl
Relay
Reclose
Fuse
18
[Y]
Meters
General
Monitor
EnergyMeter
Sensor
LineCode
LineGeometry
WireData
LoadShape
GrowthShape
Spectrum
TCCcurve
Object 1
Property Definitions
Property Values
Methods
Yprim
States
Collection Manager
Object n
Property Values
Methods
Yprim
States
2009 Electric Power Research Institute, Inc. All rights reserved.
19
Metering Elements
Monitor
EnergyMeter
Sensor
General
LineCode
LineGeometry
Loadshape
Growthshape
Wiredata
Spectrum
TCC Curves
20
22
After Redefining
23
Plotting Scripts
Project Run window
24
25
26
0 1
2 3
28
1
Power Delivery
or Power Conversion
Element
29
Terminal 1
Power Delivery
Element
30
Terminal 2
F
V
Power Conversion
Element
31
BusX
Terminal 1
Power Delivery
Element
Terminal 2
Terminal 1
Power Delivery
Element
2
Iterm = [Yprim] Vterm
0
. . . Bus1 = BusX . . .
. . . Bus2 = BusX.2.1.3.0 . . .
DSS Convention: A Terminal can be connected to only one Bus. You can have any
number of Nodes at a bus.
2009 Electric Power Research Institute, Inc. All rights reserved.
32
Terminal 2
Transformer.Example1-ph
~ Xhl=2.04
Xht=2.04
~ Buses=[bus1.1
~ kVs=[7.2 .12
phases=1
Xlt=1.36
bus2.1.0
.12]
Windings=3
%noloadloss=.2
bus2.0.2]
! ratings of windings
~ kVAs=[25 25 25]
~ %Rs = [0.6
1.2
1.2]
Bus 1
! default
1
Bus 2
1
Wdg 2
Wdg 1
0
Wdg 3
0 or
2
33
3-Phase
Transformer
3 PHASES
2 WINDINGS
4 CONDS/TERMINAL*
2
2
3
3
(OPEN)
* MUST HAVE THE SAME NUMBER OF
CONDUCTORS FOR EACH TERMINAL
2009 Electric Power Research Institute, Inc. All rights reserved.
34
Load (a PC Element)
Compensation
Current
Yprim
(One-Line Diagram)
35
Phase 1
Yprim
Compensation
Current
Yprim
Compensation
Current
Phase 2
4 Conductors/Terminal
Yprim
Compensation
Current
Phase 3
4
2009 Electric Power Research Institute, Inc. All rights reserved.
36
Phase 1
Yprim
Compensation
Current
Yprim
Compensation
Current
Phase 2
Yprim
Compensation
Current
Phase 3
3 Conductors/Terminal
37
Yprim 2
Yprim 3
Yprim n
PC Elements
Comp. Currents
I1
I2
Iinj
Im
Iteration Loop
38
Node
Voltages
Solution Speed
Distribution systems generally converge quite rapidly with
this method.
The OpenDSS program seems to be on par with the
faster commercial programs or faster
It is set up to run annual simulations easily
Our recommendation:
Err on the side of running more power flow
simulations
That is, dont worry about the solution time until it
proves to be a problem
That reveals more information about the problem.
2009 Electric Power Research Institute, Inc. All rights reserved.
39
40
I1
I4
I2
I5
I3
I6
I1
I2
I3
I4
I5
I6
Yprim
(6 x 6)
41
V1
V2
V3
V4
V5
V6
Yprim
You can obtain the Primitive Y matrix for each element a
number of ways (after a Solve)
Dump command
Dump class.name debug
Or, Dump Class.* debug
Script
Show Yprim ! Of active element
Export Yprims ! All Yprims
COM Interface
V = DSSCircuit.ActiveElement.NumPhases
42
43
Advanced Topics
Plotting
Ways to Plot
Use the built-in plotting capabilities
Plot in an external program, such as Excel or MATLAB
Maximum of value for each hour over the month.
3000
2500
From Excel
(See Example)
2000
Zone Losses kWh 1500
1000
500
Nov
Sep
21
23
17
Mar
19
Hour
13
15
11
Jul
May
46
Jan
Month
From Matlab
Volts(pu)
1.01
1
0.99
0.98
0.97
phase A
phase B
phase C
0.96
0.95
4
6
8
Distance from Substation
47
10
12
From Excel
Voltage Profile Plot
1.06
1.05
1.04
1.03
1.02
V1
1.01
V2
V3
1
0.99
0.98
0.97
0
48
10
49
50
51
52
53
Set Genkw=100
set mode=autoadd
solve
Set nodewidth=7
plot Auto 3 dots=y labels=n subs=n C1=16711680 C2=8421376 C3=255 R3=0.95 R2=0.9
Possibly best
areas for adding
DG
54
Need 500
kW here
55
56
LoadShape Plot
(Special plot in EXE version only)
57
EnergyMeter Object
EnergyMeter
Perhaps the most complex object presently in the DSS
Emulates an actual energy meter
Except it can measure things elsewhere in the meter
zone.
Has multiple registers
Registers cleared on
reset meters (or reset)
set mode = .
Set year=
Two types: accumulators and drag hand
59
60
Meter Zone
Collection of circuit elements downline from meter.
Only element in DSS that knows about radial circuits
Zone is established first time solution is executed
May be more time-consuming than actual solving for
very large circuits.
Rebuilt whenever bus list is rebuilt
EnergyMeter and Monitor objects are installed in a branch
terminal
New Energymeter.example Element=Line.Line1 Terminal=1
61
METER ZONE
62
Zone dump
energymeter.metername.action=zonedump
Or
Edit energymeter.metername
action=zonedump
63
64
Monitor or Meter?
Monitor measures quantities only where it is located
Takes a sample of quantity
Voltage and current (several options)
Powers
Transformer taps
State vars
65
67
DSS Interface
68
End Sub
69
COM Interface
70
End Sub
71
Delay=15
.Command = "RegControl.creg2a.maxtapchange=1
Delay=30
.Command = "RegControl.creg3a.maxtapchange=1
Delay=30
.Command = "RegControl.creg4a.maxtapchange=1
Delay=30
.Command = "RegControl.creg3c.maxtapchange=1
Delay=30
.Command = "RegControl.creg4b.maxtapchange=1
Delay=30
.Command = "RegControl.creg4c.maxtapchange=1
Delay=30
72
Result Property
The Result property is a Read Only property that contains
any result messages the most recent command may have
issued.
Error messages
Requested values
Example: Query line length
DSSText.Command = ? Line.L1.Length
S = DSSText.Result
MsgBox S
73
Circuit Interface
74
Circuit Interface
V = DSSCircuit.AllBusVmagPu
VL =DSSCircuit.AllElementLosses
75
Solution Interface
76
Solution Interface
.LoadModel=dssAdmittance
.dblHour = 750.75
.solve
End With
77
CktElement Interface
Nph = DSSCircuit.ActiveElement.NumPhases
78
Properties Interface
79
Properties Interface
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
Set Property Value by Name
DSSCircuit.SetActiveElement(Line.L1)
.Properties(R1).Val = .068
End With
80
Lines Interface
81
iL = DSSLines.First
sets active
Do While iL>0
DSSLines.LineCode = MyNewLineCode
iL = DSSLines.Next
Loop
82
VBA Example
Option Explicit
83
VBA Example
Public Sub LoadCircuit(fname As String)
' 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" cell on the
main form
DSSText.Command = "compile " + fname
' The Compile command sets the current directory the that of
the file
' Thats where all the result files will end up.
' Assign a variable to the Circuit interface for easier access
Set DSSCircuit = DSSobj.ActiveCircuit
End Sub
84
VBA Example
This Sub puts the sequence voltage onto a
spreadsheet
End Sub
2009 Electric Power Research Institute, Inc. All rights reserved.
85
Obj = actxserver('OpenDSSEngine.DSS');
%
%Start the DSS.
%Matlab session
Start = Obj.Start(0);
86
87
ParamNum = 6;
(etc. etc.)
88
x='
'
User-Written Controls
Initialize Loop
Solve Circuit
Next Time Step
Check Controls
NO
YES
Control Actions Done?
90
91
92
USER CODE
POP
CONTROL
Action List
DISPATCHER
PUSH
POP
CONTROL OBJECT
ACTION 1
ALL PUSHES
ARE SORTED
BY TIME
DoPendingAction
ACTION 2
ACTION 3
...
CONTROL OBJECT
ACTION N
DoPendingAction
Time
Action Code
Proxy Handle
Control Addr
93
95
96
Wye-connected Generator
Sometimes the normal power flow will not converge well
for direct-connect Y-connected DG.
Workaround:
Set
Xdmodel = Xd - X0
Xdmodel= Xd - X0
Set XHL = X0 of DG
97
3000
2500
2000
Zone Losses kWh 1500
1000
500
Nov
Sep
98
23
21
Mar
19
17
May
15
Hour
13
11
Jul
Jan
Month
99
overloadreport=true
voltexcept=true
DemandInterval=true
DIVerbose=true
Set Year=1
solve
Set Year=2
solve
Closedi
100
set mode=yearly
overloadreport=true
voltexcept=true
DemandInterval=true
DIVerbose=true
Set Year=1
Set hour=5000
solve Number=168
Closedi
101
DI_yr_N
2009 Electric Power Research Institute, Inc. All rights reserved.
102
103
"kWh"
"kvarh"
"Max kW" "Max kVA" "Zone kWh" "Zone kvarh" "Zone Max kW""Zone Max kVA"
"Overload kWh
"Overload
Normal"
kWh
"Load
Emerg"
EEN""Load
20430.7 775.005 20430.7 20445.4
39147.9
1908.31
39147.9 39194.4
0
0 2576.61
244
21438 744.841
21438 21450.9
41086.8
1875.58
41086.8 41129.5
0
0 2629.76 2490
22450.5 810.443 22450.5 22465.2
43024.8
2013.08
43024.8 43071.9
0
0 2669.37 2527
23559.8 928.416 23559.8 23578.1
45143
2243.88
45143 45198.7
0
0 2812.75 2663
24688.2 1012.56 24688.2 24708.9
47300.2
2413.44
47300.2 47361.7
8.9537
0 1968.41 3339
26375.6 1079.88 26375.6 26397.7
50532.5
2563.64
50532.5 50597.5 26.9063 8.05913 2401.86
224
28516.4 1149.75 28516.4 28539.6
54634.9
2726.26
54634.9 54702.8 41.4067 22.5873 2757.64 2579
30231 1242.84
30231 30256.5
57915
2919.27
57915 57988.6
47.904 29.1057
2943.3 2729
31459.5 1263.09 31459.5 31484.8
60271.7
2977.84
60271.7 60345.3 49.6115 30.8222 3000.93 2769
32448.5 1232.52 32448.5 32471.9
62175.8
2945.17
62175.8 62245.5 50.9358
32.15 3025.13 2798
33111.5 1189.47 33111.5350
33132.9
63455.3
2884.76
63455.3 63520.8 52.2198 33.4349 3041.49
282
33959.2 1222.36 33959.2 33981.2
65078.8
2957.43
65078.8
65146 52.1848 33.4068 3059.37 2827
34387.3
1225.1 34387.3300
34409.1
65901.7
2970.85
65901.7 65968.7 48.9837 30.2053 2983.32 2753
34678.5 1175.29 34678.5 34698.4
66468.7
2892.75
66468.7 66531.6 34.5677 15.7739 2607.68 2423
Loss Plot
kW
250
200
150
100
50
0
5200
5250
5300
Hour
104
5350
5400
Enable/Disable
Once a circuit element is defined in a script, it can be
Enabled (default)
Disabled
Redefined (Edit)
Use Enable/Disable to temporarily add or delete elements
from the circuit
Enable/Disable Commands
Disable Line.Line1
Line.Line1.Enabled = No
Edit Line.Line1 . Enabled=No
105
Open/Close
You can open any terminal of any device that is active in
the circuit:
Open Line.Line1 2 (opens Terminal 2)
Open Line.Line1 2 3 (opens phase 3 of terminal 2)
Caveat: Voltage at open terminal is inaccessible (does not
exist)
Alternative:
Line.Line1.Bus2=Term2_Open
Redefine Bus2 to another bus with nothing else
Term2_open voltage is accessible
106
107
108
Const Z
1.3
1.2
105%
1.1
(Defaults*)
1
0.9
|I| = |S/V|
95%
PU Voltage
0.8
0.7
0.6
Const Z
0.5
0.4
0.3
0.2
0.1
0
0
0.2
0.4
0.6
0.8
PU Current
2009 Electric Power Research Institute, Inc. All rights reserved.
109
1.2
110
BASIC DEFINITION
DELTA
CONNECTION
Bus1 = B1
Bus2 = B2
(Series
Connection)
Bus1=B1
(Bus2 is
ignored)
Bus1=B1
(BUS2=B1.0.0.0) (default)
111
MAKING A N
UNGROUNDED
WY E
Bus1 = B1
Bus2 = B1.4.4.4
Common Errors
A Buss Life
In contrast to other power system analysis programs, Bus
objects do not exist until required
These commands will force building of the bus list
Solve
CalcVoltageBases
MakeBusList
The Bus list is built from the currently enabled devices
Editing circuit element properties often requires rebuilding
the bus list
If no changes, the bus list is not re-built
2009 Electric Power Research Institute, Inc. All rights reserved.
113
2
2
~ Buses=[DeltaBus WyeBus]
~ Conns=[Delta Wye]
3
3
~ kVAs=[10000 10000]
~ kVs=[115 12.47]
4
(OPEN)
114
2
2
~ Buses=[DeltaBus WyeBus]
~ Conns=[Delta Wye]
3
3
~ kVAs=[10000 10000]
~ kVs=[115 12.47]
Expands to
4
(OPEN)
WyeBus.1.2.3.0
116
SOURCE
Diagnosing: This may cause a floating point error in normal snapshot power flow.
1) Look at voltage after CalcVoltageBases
2) Do Solve Mode=Direct; then look at voltages (Show Voltage LN Nodes)
117
3 Single-phase Loads
New Load.Load1a Phases=1 Bus1=B1.1 kV=7.2 kW=33.33 PF=.95
New Load.Load1b Phases=1 Bus1=B1.2 kV=7.2 kW=33.33 PF=.95
New Load.Load1c Phases=1 Bus1=B1.3 kV=7.2 kW=33.33 PF=.95
118
Nothing has happened since the definition of the EnergyMeter object to force it to compute its
zone.
Resolution:
Issue Solve or MakeBusList to force meterzone. Then issue Reconductor
119
Questions?