How to connect StationWare with my local PowerFactory installation?

Category:
Scripts
Answer

In order to access data stored in StationWare by a Python script that is located and run from the PowerFactory, the suds-py3 package must be installed in your Python installation.

Suds is a lightweight SOAP python client that provides a service proxy for Web Services. For more information on this module refer to offical Python literature.

 

Here is an example of how you can access StationWare data in PowerFactory Python script:

import powerfactory

import suds

app=powerfactory.GetApplication()

#Connect to StationWare
user="XXXXX"
password="XXXXXX"
https="http://stationware.digsilent.de/XXXXX/PSMSService.asmx?WSDL"

try:

client=suds.client.Client(https)

except suds.transport.TransportError:

app.PrintPlain("could not find the requested URL")

response=client.service.Login(User=user,Password=password)

if response['LoginResult']['Success']==False:

app.PrintPlain("Could not login to SW, check user and password")

filterDate='0001-01-01T00:00:00'
authTicket=response["AuthTicket"]

#run StationWare code and use the responds in order to make changes in PowerFactory project

processInfo=client.service.ProcessGetDetails (authTicket,processID)     #get Process Info

for eachDeviceInfo in processInfo[1][0][0]: #get each device assinged to the process

device=client.service.DeviceGetDetails(authTicket,eachDeviceInfo.Id)     #get Device Info
deviceContainer=device[1].DeviceContainer

...

 

For more information on this topic refer to StationWare user manual chapter "Web-Services Interface"

Back