138
1 1 Tutorial Tutorial The The OpenDSS OpenDSS Application Application Roger C. Dugan Sr. Technical Executive [email protected] Knoxville, Tennessee 37934 USA 4 th International Conference on Integration of Renewable and Distributed Energy Resources December 6-10, 2010 Albuquerque, NM, USA Conference Sponsors Associate Sponsors

OpenDSS Tutorial EPRI Dugan

Embed Size (px)

Citation preview

Page 1: OpenDSS Tutorial EPRI Dugan

114th International Conference on Integration of Renewable and Distributed Energy Resources

TutorialTutorialThe The OpenDSSOpenDSS ApplicationApplication

Roger C. DuganSr. Technical [email protected], Tennessee 37934 USA

4th International Conference on Integration of Renewable and Distributed Energy ResourcesDecember 6-10, 2010Albuquerque, NM, USA

Conference Sponsors Associate Sponsors

Page 2: OpenDSS Tutorial EPRI Dugan

4th International Conference on Integration of Renewable and Distributed Energy Resources

Introduction

Page 3: OpenDSS Tutorial EPRI Dugan

334th International Conference on Integration of Renewable and Distributed Energy Resources

What is “OpenDSS”?

•EPRI’s Distribution System Simulator (DSS) – Released as open source

– Called “OpenDSS”

•Can be found at:

– WWW.SOURCEFORGE.NET• (Search for OpenDSS)

– Or, e‐mail [email protected] and request a link to the latest OpenDSS on EPRI’s FTP site.

Page 4: OpenDSS Tutorial EPRI Dugan

444th International Conference on Integration of Renewable and Distributed Energy Resources

Why was DSS Developed?

•For special distribution analysis applications such as DG analysis.

•To provide a very flexible research platform.

•Fills gaps left by other distribution system analysis tools.

•Study new approaches to distribution system analysis.

Page 5: OpenDSS Tutorial EPRI Dugan

554th International Conference on Integration of Renewable and Distributed Energy Resources

Why Open Source?

•EPRI has made the DSS open source to:– Cooperate with various Smart Grid open source efforts• Gridlab‐D (from PNL), for example

– To encourage new advancements in distribution system analysis

– To promote grid modernization/Smart Grid efforts by providing researchers and consultants with a tool to evaluate advanced concepts

– Expand the pool of Smart Grid technology resources available to EPRI members

Page 6: OpenDSS Tutorial EPRI Dugan

664th International Conference on Integration of Renewable and Distributed Energy Resources

DSS Background

•Under development for more than 13 Years– Started at Electrotek Concepts in 1997 

– Purchased by EPRI in 2004

•Objectives in 1997– Support all distribution planning aspects of distributed generation– Implement a flexible research platform

– Incorporate object‐oriented data ideas

•Key Future work– Smart Grid research and demonstrations

– DSE for North American Systems

– Dense urban networks

– Reliability methods research

Page 7: OpenDSS Tutorial EPRI Dugan

774th International Conference on Integration of Renewable and Distributed Energy Resources

Distribution System Simulator (DSS) 

• Designed to simulate utility distribution systems – In arbitrary detail 

– For most types of analyses related to distribution planning.

• It performs its analysis types in the frequency domain, • Power flow, 

• Harmonics, and 

• Dynamics. 

– It does NOT perform electromagnetic transients (time domain) studies.

Page 8: OpenDSS Tutorial EPRI Dugan

884th International Conference on Integration of Renewable and Distributed Energy Resources

Time‐ and Location‐Dependent Benefits

• The OpenDSS was designed from the beginning to capture both – Time‐specific benefits and 

– Location‐specific benefits

• Needed for– DG analysis

– Renewable generation

– Energy efficiency analysis

– PHEV and EV impacts

– Other proposed capacity enhancements that don’t follow typical loadshapes

Page 9: OpenDSS Tutorial EPRI Dugan

994th International Conference on Integration of Renewable and Distributed Energy Resources

Time‐ and Location‐Dependent Benefits

• Most traditional distribution system analysis programs – Designed to study peak loading conditions

– Capture mostly location‐specific benefits

– Ignores time; Assumes resource is available

– This gets the wrong answer for many DG, energy efficiency, and Smart Grid analyses

• Must do time sequence analysis to get the right answer– Over distribution planning area

Page 10: OpenDSS Tutorial EPRI Dugan

10104th International Conference on Integration of Renewable and Distributed Energy Resources

Overall Model Concept

ControlCenter

Control

Power ConversionElement

("Black Box")

Inf. Bus(Voltage, Angle)

CommMsg Queue 1

CommMsg Queue 2

Power DeliverySystem

Page 11: OpenDSS Tutorial EPRI Dugan

11114th International Conference on Integration of Renewable and Distributed Energy Resources

Examples of Advanced OpenDSS Applications(other than basic multi‐phase power flow)

• Neutral‐to‐earth (stray) voltage simulations. 

• Loss evaluations due to unbalanced loading.

• Development of DG models for the IEEE Radial Test Feeders.

• High‐frequency harmonic and interharmonic interference.

• Losses, impedance, and circulating currents in unusual transformer bank configurations.

• Transformer frequency response analysis.

• Distribution automation control algorithm assessment.

• Impact of tankless water heaters on flicker and distribution transformers.

• Wind farm collector simulation.

• Wind farm impact on local transmission.

• Wind generation and other DG impact on switched capacitors and voltage regulators.

• Open‐conductor fault conditions with a variety of single‐phase and three‐phase transformer connections.

Page 12: OpenDSS Tutorial EPRI Dugan

12124th International Conference on Integration of Renewable and Distributed Energy Resources

Computing Annual Losses

Peak load losses are not necessarily indicative of annual losses

0

10

20

30

40

50

60

70

Load

, MW

15

9

13

17

21

Jan Apr Ju

l Oct

0

5000

10000

15000

20000

25000

kWh

Hour

Month

Page 13: OpenDSS Tutorial EPRI Dugan

13134th International Conference on Integration of Renewable and Distributed Energy Resources

Using DSS to Determine Incremental Capacity of DG

1

4

7

10

13

16

19

22

Jan

Feb

Mar Ap

rM

ay Jun Ju

lAu

gSe

p Oct Nov Dec

0

200

400

600

800

1000

1200

1400

1600

MWh

Hour

Month

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24S1 S2 S3 S4 S5 S6 S7 S8 S9

S10 S1

1S1

2

0

1000

2000

3000

4000

5000

6000

KW

Hour

Month

Capacity Gain for 2 MW CHP

0

1000

2000

3000

4000

5000

6000

7000

150 160 170 180 190 200 210MW Load

MW

h EE

N

0

2

4

6

8

10

12

14

Incr

. Cap

., M

W

Base_Case2MW_CHPIncr. Cap.

Broad Summer Peaking System

“Needle” Peaking System

“How much more power can be served at the same risk of unserved energy?”

Page 14: OpenDSS Tutorial EPRI Dugan

14144th International Conference on Integration of Renewable and Distributed Energy Resources

DG Dispatch

0

500

1000

1500

2000

2500

3000

3500

4000

4500

50001

270

539

808

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

Hour

Pow

er, k

W

-2500

-2000

-1500

-1000

-500

0

500

1000

1500

2000

2500

Rea

ctiv

e Po

wer

, kva

r

kvar

kW

Page 15: OpenDSS Tutorial EPRI Dugan

15154th International Conference on Integration of Renewable and Distributed Energy Resources

Solar PV Simulation – 1‐hr Data

-1

0

1

2

3

4

5

2 Weeks

MW

-1

0

1

2

3

4

5

Diff

eren

ce, M

W

Without PV With PV

Difference

Page 16: OpenDSS Tutorial EPRI Dugan

16164th International Conference on Integration of Renewable and Distributed Energy Resources

1‐sec Solar Data – Cloud Transients

1-Sec Solar PV Output Shape with Cloud Transients

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0 500 1000 1500 2000 2500 3000

Time,s

Per U

nit o

f Max

imum

Impact on Feeder Voltage

Page 17: OpenDSS Tutorial EPRI Dugan

17174th International Conference on Integration of Renewable and Distributed Energy Resources

Power Distribution Efficiency

0

50

100

150

200

250

300

350

0 50 100 150

Hour (1 Week)

Loss

es, k

W

Total Losses

Load Losses

No-Load Losses

0

50

100

150

200

250

300

350

5200 5250 5300 5350

Hour (1 Week)

Loss

es, k

W

Total Losses

Load Losses

No-Load LossesLight Load Week

Peak Load Week

Page 18: OpenDSS Tutorial EPRI Dugan

18184th International Conference on Integration of Renewable and Distributed Energy Resources

Wind Plant 1‐s Simulation

0.97

0.98

0.99

1.00

1.01

1.02

1.03

0.96

0.98

1.00

1.02

0 20000 40000 60000 80000

Feeder Voltage and Regulator Tap Changes

Electrotek Concepts® TOP, The Output Processor®

Ta

p-(

pu

) (

V)

Time (s)

0

1000

2000

3000

4000

-591

-491

-391

-291

-191

-91

0 20000 40000 60000 80000

Active and Reactive Power

Electrotek Concepts® TOP, The Output Processor®

P3-

(kW

) (W

)Q

3-(k

var)

(V

Ar)

Time (s)

Page 19: OpenDSS Tutorial EPRI Dugan

19194th International Conference on Integration of Renewable and Distributed Energy Resources

Broadband Driving Point Admittance

0

0.005

0.01

0.015

0.02

0.025

0.03

0.035

0 100000 200000 300000 400000 500000Frequency, Hz

Siem

ens

|Y|

Page 20: OpenDSS Tutorial EPRI Dugan

20204th International Conference on Integration of Renewable and Distributed Energy Resources

Power Flow Visualization

Page 21: OpenDSS Tutorial EPRI Dugan

4th International Conference on Integration of Renewable and Distributed Energy Resources

Getting Started

Installation and Basic Usage

Page 22: OpenDSS Tutorial EPRI Dugan

22224th International Conference on Integration of Renewable and Distributed Energy Resources

SourceForge.Net Links for OpenDSS• OpenDSS Download Files:

– http://sourceforge.net/projects/electricdss/files/

• Main Page in Wiki– http://sourceforge.net/apps/mediawiki/electricdss/index.php?title=Main_Page

• Top level of Main  Repository– http://electricdss.svn.sourceforge.net/viewvc/electricdss/

• Source Code– http://electricdss.svn.sourceforge.net/viewvc/electricdss/Source/

• Examples– http://electricdss.svn.sourceforge.net/viewvc/electricdss/Distrib/Examples/

• IEEE Test Cases– http://electricdss.svn.sourceforge.net/viewvc/electricdss/IEEETestCases/

Page 23: OpenDSS Tutorial EPRI Dugan

23234th International Conference on Integration of Renewable and Distributed Energy Resources

Release File Download Page

This is a Release Version

Page 24: OpenDSS Tutorial EPRI Dugan

24244th International Conference on Integration of Renewable and Distributed Energy Resources

Wiki Home Page

Page 25: OpenDSS Tutorial EPRI Dugan

25254th International Conference on Integration of Renewable and Distributed Energy Resources

Repository on SourceForge.Net

Page 26: OpenDSS Tutorial EPRI Dugan

26264th International Conference on Integration of Renewable and Distributed Energy Resources

Release Versions Vs. Source Code

• Release versions are posted irregularly on SourceForge

• You can keep up with  the latest changes by accessing the source code and building the latest version 

• Latest builds are also posted on an EPRI FTP site – Request a link from EPRI  (see Wiki News and Notes)

• Compilers– Delphi 2010 ‐ This is what we use for development

• Delphi 2007 and 2009 also worked last time we tried

– Free Pascal (with limitations)  ‐www.freepascal.org

Page 27: OpenDSS Tutorial EPRI Dugan

27274th International Conference on Integration of Renewable and Distributed Energy Resources

Accessing the SourceForge.Net Source Code Repository with TortoiseSVN

• Install a 32‐bit TortoiseSVN client from tortoisesvn.net/downloads.

• Recommendation: – From the TortoiseSVN General Settings dialog and click the last check 

box, to use "_svn" instead of ".svn" for local working directory name.

Then, to grab the files from SourceForge:

1 ‐ create a clean directory such as "c:\opendss"

2 ‐ right‐click on it and choose "SVN Checkout..." from the menu

3 ‐ the repository URL is • http://electricdss.svn.sourceforge.net/svnroot/electricdss

– Change the checkout directory if it points somewhere other than what you want.

Page 28: OpenDSS Tutorial EPRI Dugan

28284th International Conference on Integration of Renewable and Distributed Energy Resources

Program Files

• OpenDSS.EXE Standalone EXE

• OpenDSSEngine.DLL In‐process COM server

• KLUSolve.DLL Sparse matrix solver

• DSSgraph.DLL DSS graphics output

• Copy these files to the directory (folder) of your choice– Typically c:\OpenDSS or c:\Program Files\OpenDSS

• If you intend to drive OpenDSS from another program, you will need to register the COM server

• Some programs require this !!  

Page 29: OpenDSS Tutorial EPRI Dugan

29294th International Conference on Integration of Renewable and Distributed Energy Resources

OpenDSS Folders

Page 30: OpenDSS Tutorial EPRI Dugan

30304th International Conference on Integration of Renewable and Distributed Energy Resources

OpenDSS Standalone EXE User Interface

Multiple script windows

Any script window may be used at any

time.

Page 31: OpenDSS Tutorial EPRI Dugan

31314th International Conference on Integration of Renewable and Distributed Energy Resources

Executing Scripts in the Stand‐alone EXE

Select all or part of a line

Right-Click to get this pop-up menu

DSS executes selected line or opens selected file name

Any script window may be used at any time.

Page 32: OpenDSS Tutorial EPRI Dugan

32324th International Conference on Integration of Renewable and Distributed Energy Resources

DSS Structure

Main Simulation EngineCOM Interface

Scripts

Scripts, Results

User-Written DLLs

Page 33: OpenDSS Tutorial EPRI Dugan

33334th International Conference on Integration of Renewable and Distributed Energy Resources

DSS Object Structure

DSS Executive

Circuit

PDElement PCElement Controls Meters General

LineTransformerCapacitorReactor

LoadGeneratorVsourceIsourceStorage

RegControlCapControlRelayRecloseFuse

MonitorEnergyMeterSensor

LineCodeLineGeometryWireDataLoadShapeGrowthShapeSpectrumTCCcurveXfmrCode

Commands Options

Solution

V [Y] I

Page 34: OpenDSS Tutorial EPRI Dugan

34344th International Conference on Integration of Renewable and Distributed Energy Resources

DSS Class Structure

Instances of Objects of this class

Property Definitions

Class Property Editor

Collection Manager

Class Object 1

Property Values

Methods

Yprim

States

Object n

Property Values

Methods

Yprim

States

Page 35: OpenDSS Tutorial EPRI Dugan

4th International Conference on Integration of Renewable and Distributed Energy Resources

Scripting Basics

Syntax and organizing your scripts

Page 36: OpenDSS Tutorial EPRI Dugan

36364th International Conference on Integration of Renewable and Distributed Energy Resources

Scripting

• OpenDSS is a scriptable solution engine

• Scripts– Series of commands

– From text files

– From edit forms in OpenDSS.EXE

– From another program through COM interface• e. g., This is how you would do looping

• Scripts define circuits

• Scripts control solution of circuits

• Scripts specify output, etc.

Page 37: OpenDSS Tutorial EPRI Dugan

37374th International Conference on Integration of Renewable and Distributed Energy Resources

Command Syntax

• Command   parm1,  parm2   parm3   parm 4 ….

• Parameters may be positional or named (tagged). 

• If named, an "=" sign is expected.  – Name=value (this is the named form)

– Value (value alone in positional form)

• For example, the following two commands are equivalent:

• New Object="Line.First Line" Bus1=b1240 Bus2=32 LineCode=336ACSR, …

– New “Line.First Line”, b1240 32 336ACSR, …

Comma or white space

Page 38: OpenDSS Tutorial EPRI Dugan

38384th International Conference on Integration of Renewable and Distributed Energy Resources

Delimiters

• Array or string delimiter pairs: [ ] , { },( ),“ “,‘ ‘

• Matrix row delimiter: |

• Value delimiters: , (comma)any white space (tab or space)

• Class, Object, Bus, or Node delimiter: . (period)

• Keyword / value separator: =

• Continuation of previous line: ~ (More)

• Comment line: //

• In‐line comment: !

• Query a property: ?

Page 39: OpenDSS Tutorial EPRI Dugan

39394th International Conference on Integration of Renewable and Distributed Energy Resources

Array and Matrix Parameters

• 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 ]

Page 40: OpenDSS Tutorial EPRI Dugan

40404th International Conference on Integration of Renewable and Distributed Energy Resources

Arrays from Files

•Mult=[1, 2, 3, 4, 5, ..etc…]

•Mult=[file=myfile.txt] 

•Mult=[dblfile=myfile.dbl] 

•Mult=[sngfile=mufile.sng] 

•See URL:http://sourceforge.net/apps/mediawiki/electricdss/index.php?title=TechNote_New_ways_to_import_loadshapes

Page 41: OpenDSS Tutorial EPRI Dugan

41414th International Conference on Integration of Renewable and Distributed Energy Resources

A Basic Script (Class Exercise)

Sourcebus Sub_busLoadbus

LINE1

TR1

LOAD1

Source

115 kV12.47 kV

1000 kW0.95 PF

1 Mile, 336 ACSR

New Circuit.Simple ! Creates voltage source (Vsource.Source)

Edit Vsource.Source BasekV=115 pu=1.05 ISC3=3000 ISC1=2500 !Define source V and Z

New Transformer.TR1 Buses=[SourceBus, Sub_Bus] Conns=[Delta Wye] kVs= [115 12.47]

~ kVAs=[20000 20000] XHL=10

New Linecode.336ACSR R1=0.058 X1=.1206 R0=.1784 X0=.4047 C1=3.4 C0=1.6 Units=kft

New Line.LINE1 Bus1=Sub_Bus Bus2=LoadBus Linecode=336ACSR Length=1 Units=Mi

New Load.LOAD1 Bus1=LoadBus kV=12.47 kW=1000 PF=.95

Solve

Show Voltages

Show Currents

Show Powers kVA elements

Page 42: OpenDSS Tutorial EPRI Dugan

42424th International Conference on Integration of Renewable and Distributed Energy Resources

Circuit

• New Circuit.Simple !  (Vsource.Source is active circuit element)

• Edit Vsource.Source BasekV=115 pu=1.05  ISC3=3000  ISC1=2500

Source

115 kV

SourceBusVsource.Source

115 kV, 1.05 puShort Circuit Impedance (a matrix) that yields 3000A 3-ph fault current and 2500A

1-ph fault current.

One-Line Diagram(default is 3-phase wye-grd source)

Page 43: OpenDSS Tutorial EPRI Dugan

43434th International Conference on Integration of Renewable and Distributed Energy Resources

Vsource Element Note

• Vsource is actually a Two‐terminal Device– 2nd terminal defaults to 

connected to ground (0V)– But you can connect it 

between any two buses• Comes in handy sometimes

• Conceptually a Thevinenequivalent – Short circuit equivalent– Converted to a Norton 

equivalent internally

Page 44: OpenDSS Tutorial EPRI Dugan

44444th International Conference on Integration of Renewable and Distributed Energy Resources

TR1

New Transformer.TR1 Phases=3 Windings=2

~ Buses=[SourceBus, Sub_Bus]

~ Conns=[Delta Wye]

~ kVs= [115 12.47]

~ kVAs=[20000 20000]

~ XHL=10

New Transformer.TR1 Phases=3 Windings=2 XHL=10

~ wdg=1 bus=SourceBus Conn=Delta kV=115 kVA=20000

~ wdg=2 bus= Sub_Bus Conn=wye kV=12.47 kVA=20000

Defining Using Arrays Defining Winding by Winding

20 MVA Substation Transformer

Sub_BusSourceBus

2 Ways to Define2 Ways to Define

Page 45: OpenDSS Tutorial EPRI Dugan

45454th International Conference on Integration of Renewable and Distributed Energy Resources

The Line

LINE1

1 Mile, 336

New Linecode.336ACSR R1=0.058 X1=.1206 R0=.1784 X0=.4047 C1=3.4 C0=1.6 Units=kft

New Line.LINE1 Bus1=Sub_Bus Bus2=LoadBus Linecode=336ACSR Length=1 Units=Mi

Sub_Bus LoadBus

Line objects may also be defined by Geometries and using matrices

Page 46: OpenDSS Tutorial EPRI Dugan

46464th International Conference on Integration of Renewable and Distributed Energy Resources

The Load

Loadbus

LOAD 1

1000 kW0. 95 PF

New Load.LOAD1 Bus1=LoadBus kV=12.47 kW=1000 PF=.95

For 3-phase loads, use L-L kV and total kW

For 1-phase loads, typically use L-N kV and total kW unless Delta-connected; Then use L-L kV.

Page 47: OpenDSS Tutorial EPRI Dugan

4th International Conference on Integration of Renewable and Distributed Energy Resources

Modeling Basics

Circuit Elements, Buses, etc

Page 48: OpenDSS Tutorial EPRI Dugan

48484th International Conference on Integration of Renewable and Distributed Energy Resources

DSS Bus Model

0 1 2 3 4

Referring to Buses and Nodes

Bus1=BusName.1.2.3.0

(This is the default for a 3-phase circuit element)

Shorthand notation for taking the default

Bus1=BusName

Note: Sometimes this can bite you (e.g. – Transformers, or capacitors with ungrounded neutrals)

Page 49: OpenDSS Tutorial EPRI Dugan

49494th International Conference on Integration of Renewable and Distributed Energy Resources

DSS Terminal Definition

Power Delivery or Power Conversion

Element

1

2

3

N

Page 50: OpenDSS Tutorial EPRI Dugan

50504th International Conference on Integration of Renewable and Distributed Energy Resources

Power Delivery Elements(PD Elements)

Power Delivery Element

Iterm = [Yprim] Vterm

Terminal 2Terminal 1

Page 51: OpenDSS Tutorial EPRI Dugan

51514th International Conference on Integration of Renewable and Distributed Energy Resources

Power Conversion Elements(PC Elements)

Power ConversionElement

ITerm(t) = F(VTerm, [State], t)

VF∂∂

Page 52: OpenDSS Tutorial EPRI Dugan

52524th International Conference on Integration of Renewable and Distributed Energy Resources

Specifying Bus Connections

• Shorthand (implicit)– New Load.LOAD1 Bus1=LOADBUS

• Assumes standard 3‐phase connection by default

0

1

2

3

45

6

LOADBUS

LOAD

Page 53: OpenDSS Tutorial EPRI Dugan

53534th International Conference on Integration of Renewable and Distributed Energy Resources

Specifying Bus Connections

Explicit– New Load.LOAD1 Bus1=LOADBUS.1.2.3.0

– Explicitly defines which node

– New Load.1‐PHASELOAD Phases=1 Bus1=LOADBUS.2.0– Connects 1‐phase load to phase 2 and ground

0

1

2

3

45

6

LOADBUS

LOAD

1-ph Load connected to phase 2

Page 54: OpenDSS Tutorial EPRI Dugan

54544th International Conference on Integration of Renewable and Distributed Energy Resources

Specifying Bus Connections

• Default Bus templates • Node connections assumed if not explicitly declared

– Element declared Phases=1• … LOADBUS.1.0.0.0.0.0.0.0.0.0. …

– Element declared Phases=2• … LOADBUS.1.2.0.0.0.0.0.0.0.0. …

– Element declared Phases=3• … LOADBUS.1.2.3.0.0.0.0.0.0.0. …

Page 55: OpenDSS Tutorial EPRI Dugan

55554th International Conference on Integration of Renewable and Distributed Energy Resources

Specifying Bus Connections

Ungrounded‐Wye Specification– Bus1=LOADBUS.1.2.3.4  (or some other unused Node number)

0

1

2

3

45

6

LOADBUS

LOAD

Neutral

Page 56: OpenDSS Tutorial EPRI Dugan

56564th International Conference on Integration of Renewable and Distributed Energy Resources

Specifying Two Ungrounded‐WyeCapacitors on Same Bus

0

1

2

3

45

6

… Bus1=MyBus Bus2=MyBus.4.4.4

… Bus1=MyBus.1.2.3 Bus2=MyBus.5.5.5

MyBus

Neutrals are not connected to each other!

Page 57: OpenDSS Tutorial EPRI Dugan

57574th International Conference on Integration of Renewable and Distributed Energy Resources

Circuit Elements are Connected together at the Nodes of Buses

Power Delivery Element

Iterm = [Yprim] Vterm

Terminal 2Terminal 1

Power Delivery Element

Iterm = [Yprim] Vterm

Terminal 2Terminal 1

MyBus

DSS Convention: A Terminal can be connected to only one Bus. You can have any number of Nodes at a bus.

1

2

3

0

. . . Bus1 = MyBus . . .(take the default)

. . . Bus2 = MyBus.2.1.3.0 . . .

(Explicitly define connections)

Page 58: OpenDSS Tutorial EPRI Dugan

58584th International Conference on Integration of Renewable and Distributed Energy Resources

Example: Connections for 1‐Phase Residential Transformer

1

0

2

1

0 or 2

Bus 1 Bus 2

Wdg 1

Wdg 2

Wdg 3

Center-Tapped 1-Phase Transformer Model

! Line-to-Neutral Connected 1-phase Center-tapped transformerNew Transformer.Example_1-ph phases=1 Windings=3! Typical impedances for small transformer with interlaced secondaries~ Xhl=2.04 Xht=2.04 Xlt=1.36 %noloadloss=.2! Winding Definitions~ wdg=1 Bus=Bus1.1.0 kV=7.2 kVA=25 %R=0.6 Conn=wye~ wdg=2 Bus=Bus2.1.0 kV=0.12 kVA=25 %R=1.2 Conn=wye~ Wdg=3 Bus=Bus2.0.2 kV=0.12 kVA=25 %R=1.2 Conn=wye

Note: You may use XfmrCodeto define a library of transformer definitions that are used repeatedly (like LineCode for Line elements)

Page 59: OpenDSS Tutorial EPRI Dugan

59594th International Conference on Integration of Renewable and Distributed Energy Resources

All Terminals of a Circuit Element Have Same Number of Conductors

(OPEN)

1 1

2

2

3

3

4 4

DELTA-WYE TRANSFORMER

3 PHASES2 WINDINGS

4 COND’S/TERMINAL*

* MUST HAVE THE SAME NUMBER OF CONDUCTORS FOR EACH TERMINAL

3-Phase Transformer

Page 60: OpenDSS Tutorial EPRI Dugan

4th International Conference on Integration of Renewable and Distributed Energy Resources

Questions I Get ….

Page 61: OpenDSS Tutorial EPRI Dugan

61614th International Conference on Integration of Renewable and Distributed Energy Resources

How Do You Get Currents and Power If You Only Solve for Node Voltages?

• How are the branch currents (and powers) determined when only the Node voltages and Compensation currents are known?– Currents and powers are determined by post processing the solution 

– If the Y matrix is properly formed, the currents will obey Kirchoff’s current law at the nodes

– If convergence is achieved, the powers will be correct

Page 62: OpenDSS Tutorial EPRI Dugan

62624th International Conference on Integration of Renewable and Distributed Energy Resources

Computing Currents in Branch Terminals (Given the voltages)

I1

I2

I3

I4

I5

I6

I1

I2

I3

I4

I5

I6

Yprim(6 x 6)

V1

V2

V3

V4

V6

V5

=

Page 63: OpenDSS Tutorial EPRI Dugan

63634th International Conference on Integration of Renewable and Distributed Energy Resources

Possible Source of Error!

• If the branch is extremely short (impedance is very low), currents may be incorrectly computed– Convergence tolerance is generally 0.0001 pu

– Voltage solution will be good enough

• 64‐bit math is used throughout giving you flexibility– However, if voltages at both ends of branch are nearly the same, you will be taking the difference between two nearly equal numbers and the multiplying it by a large number (very high conductance)

• This will magnify any error

• Do not use impractically short branches

Page 64: OpenDSS Tutorial EPRI Dugan

64644th International Conference on Integration of Renewable and Distributed Energy Resources

Where Does OpenDSS include Mutual Coupling?

• It ALWAYS Includes it!

– All circuit element models provide the DSS executive with an Admittance MATRIX

– That is, every model implicitly has coupled phases

– Units on admittance matrix are actual siemens• Per units and percent are used for some input and some reports, but not for internal model

• Fewer limitations on the problem that can be represented

Page 65: OpenDSS Tutorial EPRI Dugan

65654th International Conference on Integration of Renewable and Distributed Energy Resources

Primitive Y Matrix – A Simple Example

⎥⎦

⎤⎢⎣

⎡⎥⎦

⎤⎢⎣

⎡−

−=⎥

⎤⎢⎣

2

1

2

1

VV

GGGG

II

RV1 V2

I1 I2

1−= RG

Order of Yprim is Num Terminals * Num Conductors per Terminal

Page 66: OpenDSS Tutorial EPRI Dugan

66664th International Conference on Integration of Renewable and Distributed Energy Resources

A little more complicated

Z22

V1

V2

I1 I3

Z11

I2 I4

V4

V3

Z M12

Z = Z11 M12

M12 Z22

⎥⎥⎥⎥

⎢⎢⎢⎢

⎥⎦

⎤⎢⎣

⎡−

−=

⎥⎥⎥⎥

⎢⎢⎢⎢

−−

−−

4

3

2

1

11

11

4

3

2

1

VVVV

ZZZZ

IIII

Page 67: OpenDSS Tutorial EPRI Dugan

67674th International Conference on Integration of Renewable and Distributed Energy Resources

Yprim

• You can obtain the Primitive Y matrix for each element a number of ways (after a Solve)

• Dump command– Dump DSSclass.name debug

• Or, Dump DSSclass.* debug

• Script– Show Yprim ! Of active element

– Export Yprims ! All Yprims

• COM Interface– MyVariant = DSSCircuit.ActiveElement.Yprim

Page 68: OpenDSS Tutorial EPRI Dugan

68684th International Conference on Integration of Renewable and Distributed Energy Resources

What Kind of Power Flow is the DSS?

• The DSS is not a traditional power flow as power engineers tend to think of power flows– A program with a solution method for fundamental frequency power flow

• Its heritage is harmonics analysis and dynamics analysis– It is a power flow in the sense that you can model loads connected to buses and get a solution that matches traditional power flow programs at 50/60 Hz

Page 69: OpenDSS Tutorial EPRI Dugan

69694th International Conference on Integration of Renewable and Distributed Energy Resources

What Kind of Power Flow is the DSS?

• The “Normal” solution mode is a fixed point iterative solution that works fine for >90% of distribution systems– Is simple and relatively fast, especially for annual solutions

• There is a “Newton” solution method for circuits that are difficult to converge with the Normal method.– Not to be confused with the traditional Newton‐Raphsonmethod in power flow programs

– The Jacobian is the Y matrix, which is not and exact Jacobian, but points in the right direction

• So it is likely to get there eventually

Page 70: OpenDSS Tutorial EPRI Dugan

70704th International Conference on Integration of Renewable and Distributed Energy Resources

Load and Buses

• There is a subtle difference in the way the DSS treats loads that is confusing to traditionally‐trained power engineers:

• Instead of– “A Bus has Load”

• The DSS has– “A Load has a Bus”

• The latter allows connection of a multitude of different loads and load types to the same bus

Page 71: OpenDSS Tutorial EPRI Dugan

71714th International Conference on Integration of Renewable and Distributed Energy Resources

Can it solve network systems as well as radial?

• The use of the word “Distribution” in the name of the program conjures up ideas of radial circuit solvers in North America (but not necessarily in Europe)

• The DSS circuit solver is completely general and has no idea whether the circuit is radial or not.– This is a requirement for harmonics analysis of distribution systems

• The EnergyMeter class is presently the only class that cares about radiality.

Page 72: OpenDSS Tutorial EPRI Dugan

72724th International Conference on Integration of Renewable and Distributed Energy Resources

Where is the P‐V bus type?

• Buses do not have special types in the DSS– Buses are simply connection points for circuit elements

• A Generator can control (or attempt to) power and voltage– (This model can be cantankerous)

• This question usually arises with regard to modeling DG on distribution systems– Fortunately, one seldom needs this model unless the DG is quite large with respect to system capacity

– Most other DG is controlled by Power and Power Factor while interconnected

• Simpler to model

Page 73: OpenDSS Tutorial EPRI Dugan

4th International Conference on Integration of Renewable and Distributed Energy Resources

Examples

Page 74: OpenDSS Tutorial EPRI Dugan

4th International Conference on Integration of Renewable and Distributed Energy Resources

Storage Example

Page 75: OpenDSS Tutorial EPRI Dugan

75754th International Conference on Integration of Renewable and Distributed Energy Resources

Script for 75 kWh Simulation• Compile  C:\DSSdata\Wes\Colfax\Master.DSS• Redirect AllocateLoadsandMeters.DSS

• BusCoords colfax21_EXP_BUSCOORDS.CSV• BusCoords buscoordsCES.DSS !  COORDINATES OF CES LOCATIONS• Set maxcontroliter=20

• ! ****** ADD STORAGE ***************************

• redirect CES.DSS• Redirect Set_For_75kWh.DSS

• ! DEFINE STORAGE CONTROLLER•• New StorageController.CESmain element=line.568_4921721 terminal=1  • ~ kWTarget=7500  PFTarget=0.98 • ~ %ratecharge=30• ~ eventlog=y• ~ modedischarge=follow

• ! SPECIAL MONITORS• New monitor.Store Storage.jo0211000173 1 mode=1 ppolar=no• New monitor.StoreVars Storage.jo0211000173 1 mode=3 

• solve• Set Casename=StorageOn75

• redirect annualscript.dss

• ! *************************************************************************

• show mon store• show mon storevars• fileedit C:\DSSdata\Wes\Colfax\StorageOn75\DI_yr_1\feeder.csv

Controller Definition

Page 76: OpenDSS Tutorial EPRI Dugan

76764th International Conference on Integration of Renewable and Distributed Energy Resources

Load Shapes With and Without Storage8000 kW Trigger, 75 kWh Storage, 20% charge @ 2AM

0

1000

2000

3000

4000

5000

6000

7000

8000

9000

10000

180 200 220 240 260 280 300

Hours

kW

"kWh Normal" "kWh"

Simple PeakShave Mode

Page 77: OpenDSS Tutorial EPRI Dugan

77774th International Conference on Integration of Renewable and Distributed Energy Resources

Load Shapes With and Without StorageVariable Trigger, 75 kWh Storage, 30% charge @ 2AM

0

1000

2000

3000

4000

5000

6000

7000

8000

9000

10000

0 100 200 300 400 500

Hours

kW

"kWh Normal" "kWh"

Variable Triggering SimulationAssumes a Controller that can

accurately predict daily load and know when to trigger.

Page 78: OpenDSS Tutorial EPRI Dugan

78784th International Conference on Integration of Renewable and Distributed Energy Resources

OpenDSS Script for Variable Triggering Example on Previous Slide

! DO PART OF A YEAR IN YEARLY MODEset mode=yearly  stepsize=0.25h

Set overloadreport=true  ! TURN OVERLOAD REPORT ONset voltexceptionreport = trueset demand=trueset DIVerbose=true

Set Year=1solve number=760

StorageController.CESmain.kWtarget=8000solve number=120

StorageController.CESmain.kWtarget=7500solve number=96

StorageController.CESmain.kWtarget=7000solve number=472

StorageController.CESmain.kWtarget=7500solve number=200

StorageController.CESmain.kWtarget=7000solve number=(2784 200 ‐ 472 ‐ 96 ‐ 120 ‐ 760 ‐)  ! Balance of 2784

closeDI

Page 79: OpenDSS Tutorial EPRI Dugan

4th International Conference on Integration of Renewable and Distributed Energy Resources

Example:

IEEE 8500‐Node Test Feeder

Page 80: OpenDSS Tutorial EPRI Dugan

80804th International Conference on Integration of Renewable and Distributed Energy Resources

Location

Page 81: OpenDSS Tutorial EPRI Dugan

81814th International Conference on Integration of Renewable and Distributed Energy Resources

Main Part of Run File

Compile (C:\DSSdata\IEEETest\8500Node\Master-unbal.dss) ! unbalanced load master

New Energymeter.m1 Line.ln5815900-1 1 ! Put an Energymeter at the head of the feeder

Set Maxiterations=20 ! Sometimes the solution takes more than the default 15 iterations

Solve

Page 82: OpenDSS Tutorial EPRI Dugan

82824th International Conference on Integration of Renewable and Distributed Energy Resources

The Master FileClear

New Circuit.IEEE8500u  

! Make the source stiff with small impedance~ pu=1.05  r1=0  x1=0.001  r0=0  x0=0.001  

Redirect  LineCodes2.dssRedirect  Triplex_Linecodes.dss

Redirect  Lines.dssRedirect  Transformers.dssRedirect  LoadXfmrs.dss ! Load TransformersRedirect  Triplex_Lines.dssRedirect  UnbalancedLoads.dssRedirect  Capacitors.dssRedirect  CapControls.dssRedirect  Regulators.dss

! Let DSS estimate the voltage basesSet voltagebases=[115, 12.47,  0.48, 0.208]Calcvoltagebases ! This also establishes the bus list

! Load in bus coordinates now that bus list is establishedBuscoords Buscoords.dss

Page 83: OpenDSS Tutorial EPRI Dugan

83834th International Conference on Integration of Renewable and Distributed Energy Resources

Solution SummaryStatus = SOLVEDSolution Mode = SnapNumber = 100Load Mult = 1.000Devices = 7281Buses = 4876Nodes = 8561Control Mode =STATICTotal Iterations = 62Control Iterations = 5Max Sol Iter = 16

‐ Circuit Summary ‐

Year = 0 Hour = 0 Max pu. voltage = 1.05 Min pu. voltage = 0.91084 Total Active Power:   12.0452 MWTotal Reactive Power: 1.44513 MvarTotal Active Losses:   1.27202 MW, (10.56 %)Total Reactive Losses: 2.8252 MvarFrequency = 60 HzMode = SnapControl Mode = STATICLoad Model = PowerFlow

Page 84: OpenDSS Tutorial EPRI Dugan

84844th International Conference on Integration of Renewable and Distributed Energy Resources

Power Flow Solution PlotPlot Circuit Power Max=2000 dots=n labels=n subs=y C1=$00FF0000Plot Circuit Power Max=2000 dots=n labels=n subs=y C1=$00FF0000 1ph=31ph=3

Page 85: OpenDSS Tutorial EPRI Dugan

85854th International Conference on Integration of Renewable and Distributed Energy Resources

Selecting a Branch from the Plot (Zoomed)

Page 86: OpenDSS Tutorial EPRI Dugan

86864th International Conference on Integration of Renewable and Distributed Energy Resources

Right‐click and select Properties …

Page 87: OpenDSS Tutorial EPRI Dugan

4th International Conference on Integration of Renewable and Distributed Energy Resources

Exercise the 8500‐Node Test Feeder …

(Class Demo)

Page 88: OpenDSS Tutorial EPRI Dugan

4th International Conference on Integration of Renewable and Distributed Energy Resources

Distributed Wind Application Example

Page 89: OpenDSS Tutorial EPRI Dugan

89894th International Conference on Integration of Renewable and Distributed Energy Resources

Distributed Wind Application

• OpenDSS application– Time‐series load/generation representation

– Induction machine modeling

– Wind turbine generator var control• Mechanically‐switched capacitors

• Constant power factor

• Voltage control

– Regulator interaction

Page 90: OpenDSS Tutorial EPRI Dugan

90904th International Conference on Integration of Renewable and Distributed Energy Resources

Oneline Diagram

115kV/12.47kV

1.8 Mvar1.2 Mvar 74 kW 56 kW

3.5 MW

66 kW

600 kvar

1.9 MW

12.47kV/480V

2x1.8MWwind

turbines

Page 91: OpenDSS Tutorial EPRI Dugan

91914th International Conference on Integration of Renewable and Distributed Energy Resources

Circuit Definition

Page 92: OpenDSS Tutorial EPRI Dugan

92924th International Conference on Integration of Renewable and Distributed Energy Resources

Wind Time Series

WTG Output

-1000

-500

0

500

1000

1500

2000

2500

3000

3500

4000

0 6 12 18 24

Hour

kW,k

var

P (kW) Q (kvar)

Page 93: OpenDSS Tutorial EPRI Dugan

93934th International Conference on Integration of Renewable and Distributed Energy Resources

Wind Plant Implementation

Page 94: OpenDSS Tutorial EPRI Dugan

94944th International Conference on Integration of Renewable and Distributed Energy Resources

WTG Type 1,2: Capacitor Bank Var Control

Gearbox

Shaft Speed ω Blades

ConverterSwitchedCapacitor

Banks

Wound Rotor Induction Machine

Utility Grid

Page 95: OpenDSS Tutorial EPRI Dugan

95954th International Conference on Integration of Renewable and Distributed Energy Resources

Capacitor Control Results

WTG Capacitors

-2000

-1800

-1600

-1400

-1200

-1000

-800

-600

-400

-200

0

0 5 10 15 20Hour

kvar

Cap (kvar) 0.94

0.96

0.98

1

1.02

1.04

0 6 12 18 24

Hour

Vpu,

tap

WTG Voltage Regulator Tap

WTG Output

-1000

-500

0

500

1000

1500

2000

2500

3000

3500

4000

0 6 12 18 24

Hour

kW,k

var

P (kW) Q (kvar)

Page 96: OpenDSS Tutorial EPRI Dugan

96964th International Conference on Integration of Renewable and Distributed Energy Resources

WTG Type 3,4: “Active” Power Factor Control

PowerConverter(line side)

PowerConverter

(machine side)

P gen

,Qge

n

P, Q (stator)

P (rotor/converter)

SwitchControl

TorqueComputation

Rotor CurrentComputation

Gearbox

750 kW wound-rotor induction

generator

i*abc(rotor)

iabc(rotor)

Lookup Table(T vs. ω)

Shaft Speed ω Blades

T*

ω

0

0.2

0.4

0.6

0.8

1

1.2

-0.6 -0.4 -0.2 0 0.2 0.4 0.6

Reactive Power (per-unit)

Activ

e Po

wer

(per

-uni

t)

WTG1

WTG2

WTG3

Reactive Power Range

Page 97: OpenDSS Tutorial EPRI Dugan

97974th International Conference on Integration of Renewable and Distributed Energy Resources

Power Factor Control

WTG Output

-2000

-1000

0

1000

2000

3000

4000

0 6 12 18 24

Hour

kW,k

var

P1 (kW) Q1 (kvar)

WTG Voltage and Regulator Tap

0.96

0.97

0.98

0.99

1

1.01

1.02

1.03

1.04

1.05

0 6 12 18 24Hour

Vpu

,tap

WTG VoltageRegulator Tap

Page 98: OpenDSS Tutorial EPRI Dugan

98984th International Conference on Integration of Renewable and Distributed Energy Resources

WTG Type 3,4: Voltage Control

WTG Voltage

0.95

0.97

0.99

1.01

1.03

1.05

0 6 12 18 24

• Regulator has no tap operations!!!

Page 99: OpenDSS Tutorial EPRI Dugan

4th International Conference on Integration of Renewable and Distributed Energy Resources

Advanced Topics

Page 100: OpenDSS Tutorial EPRI Dugan

1001004th International Conference on Integration of Renewable and Distributed Energy Resources

Registering the COM Server

• In DOS window, change to the folder where you installed it and type:– Regsvr32 OpenDSSEngine.DLL

• The Server shows up as “OpenDSSEngine.DSS” in the Windows Registry

GUID

Page 101: OpenDSS Tutorial EPRI Dugan

1011014th International Conference on Integration of Renewable and Distributed Energy Resources

Registering the COM Server, cont’d

If you look up the GUID

Points to OpenDSSEngine.DLL(In-process server, Apartment Threading

model)

Page 102: OpenDSS Tutorial EPRI Dugan

1021024th International Conference on Integration of Renewable and Distributed Energy Resources

Accessing the COM Server

• 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")

Page 103: OpenDSS Tutorial EPRI Dugan

4th International Conference on Integration of Renewable and Distributed Energy Resources

DGScreener Applet

Using the OpenDSS Via the COM Server

Page 104: OpenDSS Tutorial EPRI Dugan

1041044th International Conference on Integration of Renewable and Distributed Energy Resources

DG Screener (Demo)

• Developed for EPRI Program 174– Available to funders

– Funders can download the installation package

• Next version planned for 2011– Expecting users to try it out and suggest changes

– Especially Canadian users• Concerns are different than US users

Page 105: OpenDSS Tutorial EPRI Dugan

1051054th International Conference on Integration of Renewable and Distributed Energy Resources

DSS

Text

Circuit

Solution

Plot

DSSProgress

DSSGraph.DLL

IndMach012a.DLL

OpenDSSEngine

DR

Scr

eeni

ng A

pple

tApplet Architecture

Scripts, Results

Main Interfaces Used

Page 106: OpenDSS Tutorial EPRI Dugan

4th International Conference on Integration of Renewable and Distributed Energy Resources

Driving the OpenDSS via the COM Server from another Application

Page 107: OpenDSS Tutorial EPRI Dugan

1071074th International Conference on Integration of Renewable and Distributed Energy Resources

Active objects concept

• There is one registered In‐Process COMinterface:– OpenDSSEngine.DSS

• That is, the DSS interface is the one you instantiate• The DSS interface creates all the others.

• The interfaces generally employ the idea of an ACTIVE object– Active circuit, – Active circuit element, – Active bus, etc.– The interfaces generally point to the active object

• To work with another object, change the active object.

Page 108: OpenDSS Tutorial EPRI Dugan

1081084th International Conference on Integration of Renewable and Distributed Energy Resources

DSS Interface

This interface is instantiated upon loading OpenDSSEngine.DSS and then instantiates all other interfaces

Call the Start(0) method to initialize the DSS

DSS Class Functions (methods) and Properties

Page 109: OpenDSS Tutorial EPRI Dugan

1091094th International Conference on Integration of Renewable and Distributed Energy Resources

Instantiate the DSS  Interface and Attempt a Start

Public Sub StartDSS()

' Create a new instance of the DSS

Set DSSobj = New OpenDSSengine.DSS

' Start the DSS

If Not DSSobj.Start(0) Then

MsgBox "DSS Failed to Start"

Else

MsgBox "DSS Started successfully“

' Assign a variable to the Text interface for easier access

Set DSSText = DSSobj.Text

End If

End Sub

Page 110: OpenDSS Tutorial EPRI Dugan

1101104th International Conference on Integration of Renewable and Distributed Energy Resources

COM Interface

Text interface is simplest

Interfaces as Exposed by VBA Object Browser in MS Excel

Text has two Properties

Page 111: OpenDSS Tutorial EPRI Dugan

1111114th International Conference on Integration of Renewable and Distributed Energy Resources

Assign a Variable to the Text Interface

Public Sub StartDSS()

' Create a new instance of the DSS

Set DSSobj = New OpenDSSengine.DSS

' Start the DSS

If Not DSSobj.Start(0) Then

MsgBox "DSS Failed to Start"

Else

MsgBox "DSS Started successfully“

' Assign a variable to the Text interface for easier access

Set DSSText = DSSobj.Text

End If

End Sub

Page 112: OpenDSS Tutorial EPRI Dugan

1121124th International Conference on Integration of Renewable and Distributed Energy Resources

Now Use the Text Interface …

• 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" 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 Delay=15 !Allow only one tap change per 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 = "RegControl.creg3c.maxtapchange=1 Delay=30 !Allow only one tap change per solution"

.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

Page 113: OpenDSS Tutorial EPRI Dugan

1131134th International Conference on Integration of Renewable and Distributed Energy Resources

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 ‘ Get the answer

MsgBox S ‘ Display the answer

Page 114: OpenDSS Tutorial EPRI Dugan

1141144th International Conference on Integration of Renewable and Distributed Energy Resources

Circuit Interface

This interface is used to

1) Get many of the results for the most recent solution of the circuit

2) Select individual circuit elements in a variety of ways

3) Select the active bus

4) Enable/Disable circuit elements

Page 115: OpenDSS Tutorial EPRI Dugan

1151154th International Conference on Integration of Renewable and Distributed Energy Resources

Circuit Interface

Since the Circuit interface is used often, it is recommended that a special variable be assigned to it:

Public DSSCircuit As OpenDSSengine.Circuit

DSSText.Command = “Compile xxxx.dss”

Set DSSCircuit = DSSobj.ActiveCircuit

DSSCircuit.Solution.Solve

… ‘ Retrieving array quantities into variants

V = DSSCircuit.AllBusVmagPu

VL =DSSCircuit.AllElementLosses

Page 116: OpenDSS Tutorial EPRI Dugan

1161164th International Conference on Integration of Renewable and Distributed Energy Resources

Solution Interface

The Solution Interface is used to

1) Execute a solution

2) Set the solution mode

3) Set solution parameters (iterations, control iterations, etc.)

4) Set the time and time step size

Page 117: OpenDSS Tutorial EPRI Dugan

1171174th International Conference on Integration of Renewable and Distributed Energy Resources

Solution Interface

Assuming the existence of a DSSCircuit variable referencing the Circuit interface

Set DSSSolution = DSSCircuit.Solution

With DSSSolution

.LoadModel=dssAdmittance

.dblHour = 750.75

.solve

End With

Use the With statement in VBA to simplify coding

Page 118: OpenDSS Tutorial EPRI Dugan

1181184th International Conference on Integration of Renewable and Distributed Energy Resources

CktElement Interface

V = DSSCircuit.ActiveElement.Powers

V = DSSCircuit.ActiveElement.seqCurrents

V = DSSCircuit.ActiveElement.Yprim

This interface provides specific values of the Active Circuit Element

Some values are returned as variant arrays

Other values are scalars

Name = DSSCircuit.ActiveElement.Name

Nph = DSSCircuit.ActiveElement.NumPhases

Page 119: OpenDSS Tutorial EPRI Dugan

1191194th International Conference on Integration of Renewable and Distributed Energy Resources

Properties Interface

This interface gives access to a String value of each public property of the active element

“Val” is a read/write property

Page 120: OpenDSS Tutorial EPRI Dugan

1201204th International Conference on Integration of Renewable and Distributed Energy Resources

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

The last two statements are equivalent to:

DSSText.Command = “Line.L1.R1=.068”

Page 121: OpenDSS Tutorial EPRI Dugan

1211214th International Conference on Integration of Renewable and Distributed Energy Resources

Lines Interface

This interface is provided to iterate through all the lines in the circuit and change the most common properties of Lines.

Page 122: OpenDSS Tutorial EPRI Dugan

1221224th International Conference on Integration of Renewable and Distributed Energy Resources

Example: Setting all LineCodes to a Value

Set DSSLines = DSSCircuit.Lines

. . .

iL = DSSLines.First ‘sets active

Do While iL>0

DSSLines.LineCode = MyNewLineCode

iL = DSSLines.Next ‘ get next line

Loop

Page 123: OpenDSS Tutorial EPRI Dugan

1231234th International Conference on Integration of Renewable and Distributed Energy Resources

VBA ExampleOption Explicit

Public DSSobj As OpenDSSengine.DSSPublic DSSText As OpenDSSengine.TextPublic DSSCircuit As OpenDSSengine.Circuit

Public Sub StartDSS()

' Create a new instance of the DSSSet DSSobj = New OpenDSSengine.DSS

' Assign a variable to the Text interface for easier access

Set DSSText = DSSobj.Text

' Start the DSSIf Not DSSobj.Start(0) Then MsgBox "DSS Failed to Start"

End Sub

This routine instantiates the DSS and starts it. It is also a good idea at this time to assign the text interface variable.

Define some public variables that are used throughout the project

Page 124: OpenDSS Tutorial EPRI Dugan

1241244th International Conference on Integration of Renewable and Distributed Energy Resources

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 accessSet DSSCircuit = DSSobj.ActiveCircuit

End Sub

This subroutine loads the circuit from the base script files using the Compile command through the Text interface. “fname” is a string contains the name of the master file.

There is an active circuit now, so assign the DSSCircuitvariable.

Page 125: OpenDSS Tutorial EPRI Dugan

1251254th International Conference on Integration of Renewable and Distributed Energy Resources

VBA Example

Public Sub LoadSeqVoltages()

' This Sub loads the sequence voltages onto Sheet1 starting in Row 2

Dim DSSBus As OpenDSSengine.BusDim iRow As Long, iCol As Long, i As Long, j As LongDim V As VariantDim WorkingSheet As Worksheet

Set WorkingSheet = Sheet1   'set to Sheet1 (target sheet)

iRow = 2For i = 1 To DSSCircuit.NumBuses ' Cycle through all buses

Set DSSBus = DSSCircuit.Buses(i)  ' Set ith bus active

' Bus name goes into Column 1WorkingSheet.Cells(iRow, 1).Value = DSSCircuit.ActiveBus.Name

' Load sequence voltage magnitudes of active bus into variant arrayV = DSSBus.SeqVoltages

' Put the variant array values into Cells' Use Lbound and UBound because you don't know the actual rangeiCol = 2For j = LBound(V) To UBound(V)WorkingSheet.Cells(iRow, iCol).Value = V(j)iCol = iCol + 1

Next jiRow = iRow + 1

Next i

End Sub

This Sub puts the sequence voltage onto a spreadsheet

Define a variant to pick up the arrays

Cycle through all the buses

Get the bus name

Get the voltages into the variant array

Put them on the spreadsheet

Define a variable for the Bus interface

Page 126: OpenDSS Tutorial EPRI Dugan

1261264th International Conference on Integration of Renewable and Distributed Energy Resources

Running OpenDSS From Matlab

• Starting the DSS

function [Start,Obj,Text] = DSSStartup

% Function for starting up the DSS

%

%instantiate the DSS Object

Obj = actxserver('OpenDSSEngine.DSS');

%

%Start the DSS. Only needs to be executed the first time w/in a

%Matlab session

Start = Obj.Start(0);

% Define the text interface to return

Text = Obj.Text;

%Start up the DSS

[DSSStartOK, DSSObj, DSSText] = DSSStartup;

Page 127: OpenDSS Tutorial EPRI Dugan

1271274th International Conference on Integration of Renewable and Distributed Energy Resources

Using the DSS through the  DSSText Interface from Matlab (harmonics example)

%Compile the DSS circuit scriptDSSText.Command = 'compile master.dss';

% get an interface to the active circuit called "DSSCircuit"DSSCircuit = DSSObj.ActiveCircuit;

%Determine which connection type for the source and call%appropriate DSS fileswitch XFMRTypecase 1DSSText.Command = 'redirect directconnectsource.DSS';

case 2DSSText.Command = 'redirect deltadelta.DSS';

case 3DSSText.Command = 'redirect deltawye.DSS';

otherwisedisp('Unknown source Connection Type')

end

%Set the system frequency and vsource frequency for harmonic requestedDSSText.Command = ['set frequency=(' num2str(Freq) ' 60 *)'];DSSText.Command = ['vsource.source.frequency=(' num2str(Freq) ' 60 *)'];

Page 128: OpenDSS Tutorial EPRI Dugan

1281284th International Conference on Integration of Renewable and Distributed Energy Resources

Using the DSS through the  DSSText Interface from Matlab (harmonics example) (cont’d)

% Vary the parameters according to a random distribution

% If more parameters need to be varied, just add them to the below

% list. Set ParamNum to total number of parameters varied

ParamNum = 6; %ParamNum used for sorting/plotting

for Case_Count = 1:Max_Cases

%Create index in the OutputData matrix to keep the cases in order

OutputData(Case_Count,1) = Case_Count;

% Generate random new coordinates for each conductor

[x1 y1 x2 y2 x3 y3 geomean] = RandomGeometry(8,0.75,30);

(... etc. etc. )

%define a new line geometry with random spacing

DSSText.Command = ['New LineGeometry.OHMOD nconds=3 nphases=3 cond=1 wire=acsr336 x=' num2str(x1) ' ' num2str(y1) ' units=ft cond=2 wire=acsr336 x=' num2str(x2) ' ' num2str(y2) ' units=ft cond=3 wire=acsr336 x=' num2str(x3) ' ' num2str(y3) ' units=ft'];

%Solve the circuit

DSSText.Command = 'solve';

(etc. etc.)

Page 129: OpenDSS Tutorial EPRI Dugan

4th International Conference on Integration of Renewable and Distributed Energy Resources

Power Flow Solution Basics

Page 130: OpenDSS Tutorial EPRI Dugan

1301304th International Conference on Integration of Renewable and Distributed Energy Resources

Solving the Power Flow

• Once the circuit model is connected properly the next step is tosolve the base power flow

• Power Conversion elements (PC elements) are often nonlinear

• Load are converted to a Norton equivalent based on nominal 100% rated voltage.– Current source is “compensation current”

• A fixed point solution algorithm is employed for most solutions

• This method allows for flexible load models and is fairly robustfor most distribution systems

Page 131: OpenDSS Tutorial EPRI Dugan

1311314th International Conference on Integration of Renewable and Distributed Energy Resources

Solving the Power Flow, cont’d

• This solution method requires that the first guess at the voltages be close to the final solution– Not a problem for daily or yearly simulations

– First solution is often most difficult

• The solution initialization routine in OpenDSS accomplishes thisin most cases

• Method works well for arbitrary unbalances

• For conditions that are sensitive, a Newton method is provided that is more robust, but slower.

Page 132: OpenDSS Tutorial EPRI Dugan

1321324th International Conference on Integration of Renewable and Distributed Energy Resources

Load (a PC Element)

YprimCompensation CurrentYprimCompensation Current

(One-Line Diagram)Goes into System Y Matrix

General ConceptAdded into Injection

Current Vector

Most Power Conversion (PC) Elements are Modeled Like This

Page 133: OpenDSS Tutorial EPRI Dugan

1331334th International Conference on Integration of Renewable and Distributed Energy Resources

Load  ‐ 3‐phase Y connected

YprimCompensation CurrentYprimCompensation Current

YprimCompensation CurrentYprimCompensation Current

YprimCompensation CurrentYprimCompensation Current

Phase 1

Phase 2

Phase 3

3

2

1

4

4 Conductors/Terminal

Page 134: OpenDSS Tutorial EPRI Dugan

1341344th International Conference on Integration of Renewable and Distributed Energy Resources

Load  ‐ 3‐phase Delta connected

YprimCompensation CurrentYprimCompensation Current

YprimCompensation CurrentYprimCompensation Current

YprimCompensation CurrentYprimCompensation Current

Phase 1

Phase 2

Phase 3

3

2

1

3 Conductors/Terminal

Page 135: OpenDSS Tutorial EPRI Dugan

1351354th International Conference on Integration of Renewable and Distributed Energy Resources

Putting it All Together

Yprim 1 Yprim 2 Yprim 3 Yprim n

Y=IinjI2

Im

I1

ALL Elements

PC ElementsComp. Currents

V Node

Voltages

Iteration Loop

Page 136: OpenDSS Tutorial EPRI Dugan

1361364th International Conference on Integration of Renewable and Distributed Energy Resources

Putting it All Together

Yprim 1 Yprim 2 Yprim 3 Yprim n

Y=IinjI2

Im

I1

ALL Elements

PC ElementsComp. Currents

V Node

Voltages

Iteration Loop

Page 137: OpenDSS Tutorial EPRI Dugan

1371374th International Conference on Integration of Renewable and Distributed Energy Resources

Solution Speed

• Distribution systems generally converge very well – Many transmission systems, also

• The OpenDSS program seems to be on par with the faster commercial programs

• Solution method is designed to run annual simulations

• Our philosophy: • Err on the side of running more power flow simulations

– Don’t worry about the solution time until it proves to be a problem

– This reveals more information about the problem

Page 138: OpenDSS Tutorial EPRI Dugan

1381384th International Conference on Integration of Renewable and Distributed Energy Resources

ReferencesReferences• OpenDSS Tech Notes: 

http://sourceforge.net/apps/mediawiki/electricdss/index.php?title=List_of_DSS_tech_notes

• OpenDSS Forum:http://sourceforge.net/projects/electricdss/forums/forum/861976

• Frequently‐Asked Questions:http://www.rogerdugan.com/OpenDSS/sourceforgelinks.html

• Main Documentation Area:http://electricdss.svn.sourceforge.net/viewvc/electricdss/Doc/

138138