A brief introduction to the basic commands for the script interface of OpenDSS is presented. Then an example of an unbalanced 13-node distribution network with time varying load and a PV distributed generator is exposed in this section.
The stand-alone installation of OpenDSS permits to enter the functions and commands in text format, in any order. The compiler organizes the scripts of each circuit element and creates the components and the complete system .
To create a new circuit, it is necessary to determine the base frequency. the command: « Set defaultbasefrequency=60 » should be used to do this action.
It is important to set the voltage source for the circuit, which should be considered the reference bus, necessary to initiate the power flow. It can be defined through a line or a transformer. The command that defines the voltage source should have this format: New circuit.ExampleName basekv=115 pu=1.00 angle=0 Bus1=SourceBus R1 = Value X1 = Value R0=Value X0=Value phases=3 .
Where « Bus » is the bus connected to the source. « basekv= » is the line to line voltage in KV. With « pu= » the voltage level at the source can be set in p.u. units. « Angle= » determines the phase base angle in degrees. Also, it is possible to set the positive and zero sequence of the resistance and reactance of the source with « R1=,R0=,X1=,X0= » respectively.
The substation transformer can be defined using: « New Transformer.ExampleTrans phases=3 windings=2 wdg=1 bus=SourceBus wdg2 = 2 bus = Bus.Name conns (delta,wye) kvs=(115,4.6) kvas=(5000,5000) xhl=(8 1000 /) %loadloss=0 » The user specifies the number of phases, and the number of the windings. With « kvs= » and « kvas= », the base rated voltage and KVA of each winding is set. « xhl= » allows to set the high winding to low winding reactance. And the percent of losses in the transformer is represented with « %loadloss= ». A regulator transformer could be included following this format: « new regcontrol.RegExample transformer=ExampleTrans winding=2 vreg=122 band=2 ptratio=20 ctprim=700 R=3 X=9 ». « Ptratio= » specifies the ratio of the Potential Transformer that converts the controlled winding voltage to the regulator voltage, the default value is 60. « band= » is the bandwith of the controlled bus in volts. « CTprim= » defines the rating of the primary CT for the line current to control current, in Amperes. « R= » and « X= » set the value of the line drop compensator in Volts.
To define the lines of a distribution system, we should first set the « linecode », which specifies the line admittance matrix. Various lines can use the same « linecode ». Nevertheless the admittance values can be written directly in the « line » command script.
« New linecode.codeExample nphases=3 R1=1.3292 X1=1.3475 units=km ». « New Line.lineExample Phases=3 Bus1=Bus1.name Bus2=Bus2.name LineCode = codeExample Length= 0.25 units= km »
To define the line, it is necessary to establish the two connection buses, the « length » of the line, the longitude unit and the number of phases. The linecode with a larger admittance matrix could be written as follows: « New linecode.lineExample nphases=3 rmatrix = (0.3465 | 0.1560 0.3375 | 0.1580 0.1535 0.3414 ) xmatrix = (1.0179 | 0.5017 1.0478 | 0.4236 0.3849 1.0348 ) units=km » .
The load element is defined through its nominal active and reactive value « kW » and « kvar » respectively. Additionally, the load script accepts various properties as follows: « new load.loadExamplebus1=B phases=3 Conn=Wye kV=33 kW=5000 kvar=1640 model=1 model=1 » When the reactive value of the load is not defined, the power factor should be set with « pf= ». There are different load models available in the program:
• Model 1: constant P and Q.
• Model 2: Constant impedance load.
• Model 3: Constant P and quadratic Q.
• Model 4: Linear P and Quadratic Q.
• Model 5: Constant P and constant current.
• Model 6: Constant P; and Q fixed nominal value.
• Model 7: Constant P; and Q is fixed impedance at nominal value.
• Model 8: ZIP model.
Load variability can also be included in the command: « Daily= », « yearly= » or « Growth= » are used to call the load shapes that will determine the load behavior on daily, yearly or duty simulation modes.
The default control mode in OpenDSS is « Static ». The sentence « set controlmode=OFF », turns off all control actions. In mode static, time is not considered, and the control actions are executed for each power flow solution. This mode is the standard for snapshot, daily and yearly mode. Modes Time and Event realize control actions driven by a time or a event, respectively.
With the command « Mode= » the type of solution for the active circuit can be set. There are various solution modes. To solve the circuit for a specific configuration without time variation modes Snapshot and Direct could be used. The mode Snapshot is preferred when loads need to be modified. Modes Daily, Yearly and Dutycycle, perform a series of solutions following a time load profile or an specific increment as in the case of Dutycycle.
Monitors and Meters
The Monitor object is a power monitor that is connected to any terminal of the circuit. Records the variables of voltage, current and power of all phases. The monitor exports the data in a CSV file. The code has the following format: « new monitor.MonExample element=transformer.Example terminal=1 mode=0 »
With « Element= » as the circuit element where the monitor is connected. « Terminal= » is the terminal of the circuit element, could be defined as 1 or 2. Monitor can observe various variables depending of the configured « Mode= ». « 0 » is the standard mode that records, Voltage, Current, and complex values. « 1 » records the power of each phase. « 2 » the Tap changes of a regulator. « 3 » records the state variables.
The EnergyMeter object is an energy meter which can be connected to any circuit element. Registers the exports and imports of energy, consequently, losses and overload values. Not only at its point of connection, but at a defined region in the circuit. The command can be written as: « new energymeter.ExampNetwrk element=transformer.TranExample terminal=1 » The Monitor and EnergyMeter can export data after the solution command « solve ». The commands « monitor.MonExample.action=take » and « energymeter.ExampNetwrk.action=take » should be written in order to record all the values. After, the commands « export monitor MonExample » and « export meters » are used to export the data to the CSV files.