> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/hypersim/model-and-simulation/import-models-from-external-software-or-code/import-from-powerfactory/import-into-hypersim.md).

# Import into HYPERSIM

This page describes how to import a **PowerFactory** network model into **HYPERSIM** using the DGS export workflow.

## Input file requirements

The input file must be an **XML file in DGS format** exported from PowerFactory. To generate the required XML file, follow this procedure:

{% stepper %}
{% step %}

## Import the Export Definition Project

1. Download the **OPAL-RT UDB Export Definition** (`.pfd`) file:

{% file src="/files/y6cUKHUYaAuOi19VDE0x" %}

2. Copy the file to a location accessible by PowerFactory.
3. Open a **PowerFactory** session.
4. Import the `.pfd` file:
   * From **File > Export / Data (\*.pfd; \*.dz)**, or
   * By right-clicking the **User Database** in the Data Manager and selecting **Import…**

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-d1b5458d7ebf5361ac1c55ca100821873592c318%2Fpowerfactory-export-definition-project.gif?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

## Activate the source project

1. Import the PowerFactory project containing the network model (if not already done).
2. In the **Data Manager**, activate the project.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-628234bf818f54893269668d96cb189361e3175b%2Fpowerfactory-activate-source-project.gif?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

## Prepare the project for export (optional)

This step is required only if you need to import **events from a specific Study Case**.

1. Duplicate the original PowerFactory project.
2. Rename and activate the copy.
3. Activate the desired **Study Case**.
4. Remove unused Study Cases and Network Variations.
5. Consolidate the Network Variation of the active Study Case.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-6d5e22b79747db3ba08541841e5509686ba4b2a9%2Fpowerfactory-prepare-project-export.gif?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

## Export the model (DGS format)

1. Open the **Load Flow** calculation window.
2. Configure:
   * Method: **AC Load Flow (balanced, positive sequence)**
   * Enable **Consider Voltage Dependency of Loads**
3. Execute the calculation.
4. Go to **File > Export > DGS Format…**
5. Configure the export:
   * Format: **XML**
   * Specify output file path and name
   * In the **Selection** section:
     * Enable **Allow hierarchy and references of exported objects to be incomplete**
     * Choose:
       * **Only calculation relevant elements** (no events), or
       * **All elements of the active project** (includes events)
   * Select the **Export Definition Variable Set** (imported in Step 1)
6. Click **Execute** to generate the `.xml` file.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-2f7053c84d16d83692e732e2512f493a92a67dbe%2Fpowerfactory-export-model-dgs.gif?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

## Import procedure

{% stepper %}
{% step %}

## Create a new HYPERSIM model

1. Open the **File** tab.
2. Select **New** to create a new HYPERSIM model.
3. Choose the desired folder and enter a file name.
4. Click **Save**.
   {% endstep %}

{% step %}

## Import the PowerFactory model

1. In the **HYPERSIM** tab, click **Import Network** in the **Import/Export** section to open the **Import Panel** window.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-8e6de4965022afe7bd6696e2537e0db357ad0be5%2Fimport-network.png?alt=media" alt=""><figcaption></figcaption></figure>

2. Select **PowerFactory**, browse for the `.xml` file, configure the import options, and click **Import**.
   * **Remove switches**: Buses are connected directly to components; switches are removed.
   * **Import all switches**: All switches are imported and cubicles are added as buses.
   * **Import switches with events only**: Only switches associated with events are imported; corresponding cubicles are added as buses.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-68daeff1286f86b5adb977b28ba983b1e1db5063%2Fpowerfactory-import-model.gif?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

## Wait for the import to complete

Once the import is started, HYPERSIM automatically processes the PowerFactory model and builds the corresponding network. The import duration depends on the size and complexity of the model and may take several minutes.
{% endstep %}

{% step %}

## Review import reports

After the import is complete, a set of reports is generated in the `ConversionReports_YYYY-MM-DD_HH-mm` folder, located next to the input files. These reports provide detailed information about the conversion process and help assess its quality and completeness. In particular, they can be used to identify unsupported or ignored components, diagnose errors and warnings encountered during import, and assist OPAL-RT support in troubleshooting issues.

<figure><img src="https://3623212549-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLxgTpoh7kyPmQ5vuyqD7%2Fuploads%2Fgit-blob-976efff97fe0640e58c5f357227e4664caf3ffeb%2Fnetwork-reports-folder.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Main reports

* **hs\_error.log**: Provides information about the connection status to HyWorks.
* **hs\_import.log**: Contains warnings and errors related to component creation, connections, rotation, and parameter assignment.
* **netlist.xlsx**: Lists all imported components along with their parameters.

#### Detailed logs

* **{model\_name}\_full.log**: Consolidates information from the parser and mapper logs.
* **{model\_name}\_mapper.log**: Lists unsupported or skipped components during mapping to Unified Database components.
* **{model\_name}\_parser.log**: Provides details about parsing the input file.
* **{model\_name}\_modelexporter.log**: Contains information about the generation of the Python import script.

#### Generated files

* **{model\_name}.edd**: Intermediate file used during the import process.
* **{model\_name}.py**: Generated Python script used to build the model in HYPERSIM.
  {% endstep %}
  {% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/hypersim/model-and-simulation/import-models-from-external-software-or-code/import-from-powerfactory/import-into-hypersim.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
