D I g S I L E N T T e c h n i c a l
D o c u m e n t a t i o n
DPL Cookbook
DIgSILENT GmbH
Heinrich-Hertz-Strasse 9
D-72810 Gomaringen
Tel.: +49 7072 9168 - 0
Fax: +49 7072 9168- 88
http://www.digsilent.de
e-mail: mail@digsilent.de
DPL Cookbook
Published by
DIgSILENT GmbH, Germany
Copyright 2012. All rights
reserved. Unauthorised copying
or publishing of this or any part
of this document is prohibited.
10 Juli 2012
Rev. Nr.
Author
Date
Reviewed by
Date
Remarks
01
02
03
Julius Susanto
14.03.2012
Julius Susanto
14.05.2012
Julius Susanto
Preliminary revision
Added anatomy of a DPL object
Added plotting and subscripts
D P L C o o k b o o k
2
Table of Contents
T a b l e o f C o n t e n t s
1 Getting Started in DPL – A Quick Tutorial ........................................................................................... 5
1.1 Create a small sample project ................................................................................................................. 5
1.2 Create a DPL command object ................................................................................................................ 6
1.3 Create a filter and put it inside the DPL command object ........................................................................... 8
1.4 Write the DPL Script ............................................................................................................................. 11
2 Anatomy of a DPL Object ................................................................................................................... 14
3 Basic DPL Scripting ............................................................................................................................ 18
3.1 Accessing Network Objects ................................................................................................................... 18
3.1.1 By the General Selection .................................................................................................................. 18
3.1.2 By Sets ........................................................................................................................................... 20
3.1.3 By Filters ........................................................................................................................................ 21
3.1.4 By Code.......................................................................................................................................... 22
3.2 Identifying, Accessing and Modifying Object Parameters .......................................................................... 24
3.2.1 Identifying Variable Names for a Parameter ....................................................................................... 24
3.2.2 Accessing Parameters ...................................................................................................................... 25
3.2.3 Modifying Parameters ...................................................................................................................... 25
3.3 Creating New Objects ........................................................................................................................... 25
3.3.1 Copy from an Internal Template ....................................................................................................... 25
3.3.2 Copy from an External Template ....................................................................................................... 27
3.3.3 Create a New Object by Code ........................................................................................................... 28
3.4 Checking if a Project is Active ................................................................................................................ 29
3.5 Navigating Folders and Object Contents ................................................................................................. 29
3.5.1 Project Folders ................................................................................................................................ 29
3.5.2 Object Contents .............................................................................................................................. 30
3.5.3 Objects in a Study Case ................................................................................................................... 31
3.6 Accessing Study Cases .......................................................................................................................... 31
3.7 Executing Calculations .......................................................................................................................... 33
3.8 Accessing Results ................................................................................................................................. 34
3.8.1 Static Calculations (Load Flow, Short Circuit, etc) ............................................................................... 34
3.8.2 Dynamic Simulations ....................................................................................................................... 34
3.9 Plotting Results .................................................................................................................................... 35
3.9.1 Creating a New Virtual instrument Page ............................................................................................ 35
3.9.2 Creating a Virtual Instrument ........................................................................................................... 35
3.9.3 Adding Objects and Variables to Plots ............................................................................................... 36
3.9.4 Plotting Example ............................................................................................................................. 37
D P L C o o k b o o k
3
T a b l e o f C o n t e n t s
4 Advanced DPL Scripting ..................................................................................................................... 38
4.1 DPL Sub-Scripts (or Subroutines) ........................................................................................................... 38
4.1.1 Executing Sub-Scripts ...................................................................................................................... 39
4.1.2 Passing Arguments to Sub-Scripts ..................................................................................................... 39
4.1.3 Accessing Sub-Script Results ............................................................................................................ 40
4.2 Vectors, Maps and Matrices ................................................................................................................... 41
4.3 Reading from and Writing to External Files ............................................................................................. 41
4.4 Topological Searches ............................................................................................................................ 41
5 Working with Results Files ................................................................................................................ 42
5.1 Adding Results Files to the DPL Script .................................................................................................... 42
5.2 Structure of Results Files ...................................................................................................................... 42
5.3 Loading a Results File into Memory ........................................................................................................ 43
5.4 Getting the Relevant Column Number .................................................................................................... 44
5.5 Getting Data from the Results File ......................................................................................................... 44
5.6 Getting the Time Interval Data .............................................................................................................. 44
5.7 Finding the Number of Time Intervals .................................................................................................... 45
5.8 A Simple Example ................................................................................................................................ 45
6 Working with Virtual Instrument Panels .......................................................................................... 47
6.1 Introduction......................................................................................................................................... 47
6.2 Local Title Blocks.................................................................................................................................. 47
6.2.1 Creating Local Title Blocks Manually .................................................................................................. 48
6.2.2 Creating Local Title Blocks in DPL ..................................................................................................... 48
6.2.3 Title Block DPL Script Example .......................................................................................................... 49
6.3 Constants in Visplots ............................................................................................................................ 51
6.3.1 Constants DPL Script Example .......................................................................................................... 51
6.4 Exporting VI Panels to WMF .................................................................................................................. 52
D P L C o o k b o o k
4
T a b l e o f C o n t e n t s
1 Getting Started in DPL – A Quick Tutorial
This is a short step-by-step tutorial that attempts to get the user started in writing and running DPL scripts.
Before going through this tutorial, the user should already have a basic grasp of PowerFactory handling and
performing simple tasks such as load flows and short circuit simulations.
1.1 Create a small sample project
Firstly, we will create a small sample project. Create a new project and draw the following simple 20kV network
using line types from the global library:
Run a load flow to make sure the model works.
D P L C o o k b o o k
5
T a b l e o f C o n t e n t s
1.2 Create a DPL command object
1. Go to the scripts folder of the project library:
2. Right-click anywhere in the data window and select New->Others...
3. Select “DPL Command (ComDPL)” and press OK:
D P L C o o k b o o k
6
4. Call the script “DPL_Loading”:
T a b l e o f C o n t e n t s
D P L C o o k b o o k
7
T a b l e o f C o n t e n t s
1.3 Create a filter and put it inside the DPL command object
1. DPL command objects can contain other objects within it. To see the contents of a DPL command
object, click on the “Contents” button:
2. We want to create a filter object. Right-click anywhere in the contents area and select New->Others...
Select “General Filter (SetFilt)” and press OK.
D P L C o o k b o o k
8