You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Welcome to the Python scripting for DIgSILENT. This documentation will teach you how to leverage Python for automating tasks in DIgSILENT PowerFactory.
4
+
5
+
## Table of Contents
6
+
7
+
1.[Connect to PowerFactory Application](#connect-to-powerfactory-application)
8
+
9
+
---
10
+
11
+
## Connect to PowerFactory Application
12
+
13
+
Before you can perform any operations within DIgSILENT PowerFactory using Python, you need to establish a connection to the PowerFactory application. This connection allows your Python script to interact with PowerFactory's objects and functionalities.
14
+
15
+
### Steps to Connect:
16
+
17
+
1.**Import the PowerFactory Module**: PowerFactory provides a Python module that facilitates interaction with its environment. Begin by importing this module in your script.
2.**Initialize the PowerFactory Application**: Use the GetApplication() method to initialize and obtain a reference to the PowerFactory application instance.
24
+
25
+
```python
26
+
app = powerfactory.GetApplication()
27
+
28
+
ifnot app:
29
+
raiseException("Could not connect to PowerFactory application.")
30
+
else:
31
+
print("Connected to PowerFactory successfully.")
32
+
```
33
+
34
+
### Example:
35
+
36
+
Here's a complete example that connects to the PowerFactory application and verifies the connection:
0 commit comments