Getting started

DigSILENT Initialization

import sys
sys.path.append(r"C:\PF15_1_7\python")
import powerfactory

# start PowerFactory  in engine  mode
app = powerfactory.GetApplication('user_name','password') # change 'user_name' by your user name and 'password' by your password

# activate project
project = app.ActivateProject("name_of_project")  # change by the name of your project
prj = app.GetActiveProject()    # active project instance

Get application methods

ldf = app.GetFromStudyCase("ComLdf")    # Load flow
ini = app.GetFromStudyCase('ComInc')    # Dynamic initialization
sim = app.GetFromStudyCase('ComSim')    # Transient simulations

Get folders

elmres = app.GetFromStudyCase('Results.ElmRes')  # Results folder ??
events_folder = app.GetFromStudyCase('IntEvt');  # to get events folder

Get elements

buses = app.GetCalcRelevantObjects("*.ElmTerm")  # Buses
syms = app.GetCalcRelevantObjects("*.ElmSym")    # Synchronous machines
loads = app.GetCalcRelevantObjects("*.ElmLod")   # Loads
dsls = app.GetCalcRelevantObjects("*.ElmDsl")    # DSL models

Channel definition for buses

for bus in buses:
    elmres.AddVars(bus,'m:u','m:phiu','m:fehz')  # creating channels for:
                                                 # voltage ('m:u'),  angle ('m:phi') and frequency ('m:fehz')

Channel definition for loads

for load in loads:                        # creating channels for:
    elmres.AddVars(load, 'n:u1:bus1',     # voltage ('m:u')
                          'm:I1:bus1',     # current ('s:P1')
                          'm:Psum:bus1',   # active power ('s:P1')
                          'm:Qsum:bus1')   # reactive power ('s:Q1')

Power flow

ldf.Execute()  # executes power flow

Run time simulation

ini.Execute()  # executes initialization
sim.Execute()  # executes simulation

Indices and tables