You are on page 1of 5

Scripting in PowerFactory with Python

Python is a powerful tool, which is integrated into the standard PowerFactory application. It
is commonly used to automate the execution of time-consuming simulations, but its application
extends far beyond that. It may be used to process results, or to implement a routine that applies
sequential changes to the network and calls PowerFactorys analysis functions in each step.

This seminar provides a compact and efficient introduction to the fundamental aspects of writing
a scripts inside of PowerFactory by using Python. The course includes basic concepts, syntax,
accessing and modification of objects from within the code, automation of a series of calcula-
tions and presentation of the results etc. Participants will be provided with numerous examples
of Python scripts, which they may use for ideas, or adapt to suit their particular requirements.

The number of participants is limited to 10. Each participant will have access to a workstation
which will be used for the completion of exercises. Each participant should be familiar with
the general handling of the PowerFactory software, acquired through our load flow and short
circuit seminar, a PowerFactory basic training course or through relevant experience in the use
of PowerFactory. Programming experience is a prerequisite.

DIgSILENT PowerFactory Trainings Program 1


Scripting in PowerFactory with Python

Time Schedule

2 Days Training. 19-20 November

Time Duration
Start of the training 9:00 -
1st Coffee break 10:30 30 min
Lunch break 12:30 60 min
2nd Coffee break 15:00 30 min
End of the training 17:00 -

Program

Introduction

Welcome
Presentation

1 Basic Python Scripting in PowerFactory

Purpose: Familiarisation with the general handling of the Python Programming


Language in PowerFactory, e.g. How to create Python script in Power-
Factory and how to access PowerFactory data by using Python.

Contents: Creating a Python scripts in PowerFactory.


Python PowerFactory module.
ComPython Object.
Simple Python Script examples.

Level: Basic.

DIgSILENT PowerFactory Trainings Program 2


2 PowerFactory Objects access with Python

Purpose: Learn to access objects of different classes and their attributes.

Contents: Creating a Python scripts in PowerFactory.


Basics of Object classes in PowerFactory.
Object access.
Read/Write of Objects attribute.

Level: Basic.

3 Execution of the PowerFactory Commands with Python

Purpose: Execute of calculation commands by using Python.

Contents: Basics of Python methods in PowerFactory.


Scripted execution of commands.
Modify command attributes.
Level: Basic.

4 Report Results, Subroutines and Modules

Purpose: Learn how to output customised results in the output window, use sub-
routines, keep the script readable by avoiding long code.

Contents: Report Results in PowerFactory output window.


Import modules.
reloading modules.
use of exceptions.
Study case sweep.

Level: Intermediate.

DIgSILENT PowerFactory Trainings Program 3


5 Results File

Purpose: Get familiarised with the Result File element (ElmRes) and learn how
to write it and read from it.

Contents: Result file Handling.


Writing/reading a Result File.

Level: Intermediate.

6 Graphical Representation

Purpose: Get familiarised with graphical representation in PowerFactory and


learn how to create a plot.

Contents: Virtual Instruments.


Graphic Board.
Create a plot and change its variables.

Level: Intermediate.

7 Graphical User Interface

Purpose: Get familiarised with graphical user interface build in library that Python
offers, and implementation of the this library in PowerFactory.

Contents: tkinter module.


Tkinter objects widgets.

Level: Advanced.

DIgSILENT PowerFactory Trainings Program 4


8 External File Access

Purpose: Access an external file to read the date into PowerFactory or to write
date out of PowerFactory into file.

Contents: Write in an external csv file.


read from an external csv file.

Level: Advanced.

9 Component Object Models (Optional)

Purpose: Presentation of one of many Python interfaces to Excel.

Contents: basic of how to write data from PowerFactory to Excel.

Level: Advanced.

DIgSILENT PowerFactory Trainings Program 5

You might also like