OpenDSS Cheatsheet PDF
OpenDSS Cheatsheet PDF
Command Description
New Circuit.MyCircuit Makes a new circuit with a 115 kV Vsource connected to
SourceBus
New Circuit.MyCircuit BasekV=69 pu=1.05 Makes a new circuit and changes the voltage to 69 kV, 1.05 pu
New Circuit.MyCircuit Makes a new circuit with a 345 kV source, 1.05 pu,2000 MVA 3-
~ BasekV=345 pu=1.05 phase fault (default Base MVA for puZ1 property is 100 MVA)
~ puZ1=.05 pu Z0=.08
Solve Solves the present circuit with the present solution mode
Solve Mode=Yearly Sets the mode to Yearly and executes the default 8760-hour
yearly solution model algorithm
New Line.MyLine Bus1=FromBus.1.2.3 Typical Line object definition. A good idea to define units on both the
Bus2=ToBus.1.2.3 LineCode and Line objects. Units don’t have to match. OpenDSS will take
~ LineCode= 336ACSR Length=2.5 Units=Mi care of conversions
New Load.MyLoad Bus1=LoadBus.1.2.3 kW=250 Typical Load definition (3-phase is default). Don’t forget kV property.
PF=.95 For phases > 1, specify L-L kV.
~ kV=12.47
New Load.My1phLoad Phases=1 Bus1=SecBus.1 25 kW 240-V single-phase load
kW=25
~ kV=0.24 PF=0.99
New Load.MyLLLoad Phases=1 kV=12.47 1-phase L-L connected load at 12.47kV level
~ Bus1=MyLoadBus.1.2
~ kW=25 kvar=5
New Monitor.M1 Element=Line.MyLine Terminal=1 Equivalent syntax for defining a default Monitor object connected to
New Monitor.M1 Line.MyLine 1 terminal 1 of the Line object named MyLine. The default mode (0)
New Monitor.M1 Line.MyLine captures Voltages and Currents in Magnitude/Angle at the terminal.
New Monitor.M1 Line.MyLine 1 VIPolar=No Voltages and Currents are saved as complex numbers instead of the polar
form of magnitude/angle
New Monitor.M1 Line.MyLine 1 Mode=1 PPolar=No Monitor saves power at the terminal in (kW, kvar) instead of polar form of
( kVA, angle).
Monitor Modes 0: Voltages and Currents
1: Powers
2: Transformer taps (Transformer elements only)
3: State Variables (PCElements only)
4: Flicker (Pst) of Voltages only (10 min simulation req’d)
Scripting Variables (var command) Scripting variable names must begin with “@”.
Introduced at version 7.6.3.32
When encountered as a token in the script, the variable name is replaced
var (shows all scripting variables) with the present value of the variable.
(see example ) @lastfile (generally set to the name of the last output file written)
@lastExportfile (set to the name of the last file written by the Export command)
@lastShowfile (set to the name of the last file written by the Show command)
@lastPlotfile (set to the name of the last file written by the Plot command)
-or-
Language Command
C# (Project>Add Reference … (Select OpenDSSEngine)
…
using OpenDSSEngine;
…
public DSS DSSObj;
…
DSSObj = new DSS();
if ( !( DSSObj.Start( 0 ) ) ) …
Public DSSText as Text This variable will allow you easy access to the text interface
Set DSSText = DSSObj.Text Command and Result properties, for example:
Set DSSCircuit = DSSObj.ActiveCircuit The ActiveCircuit interface is one of the most important for
getting to various quantities via the COM interface.
Set DSSCktElement = DSSCircuit.ActiveCktElement When any action in the program sets a circuit element active, this
variable will give you access to the properties of this element.
DSSSolution.Solve
iLine = DSSLines.First
While iLine>0 Do
…. Do something ….
iLine = DSSLines.Next
Loop
Set DSSLoads = DSSCircuit.Loads This variable allows access to the Loads collection in the active
circuit.
Set DSSGenerators = DSSCircuit.Generators This variable allows access to the Generators collection in the
active circuit.
While many users choose to drive OpenDSS with Matlab programs, the Object Browser in Microsoft tools, including Office, are
generally better for exploring the contents of the OpenDSS type library and learning how to use the COM interface. The code
completion feature in VBA and Visual Studio is particularly useful in showing what options are available after typing the name of the
variable. Some users draft their code in VBA or C# and then translate to Matlab. There are also 3rd party Type Library or IDL