Dynamic Model Documentation

This tutorial demonstrates how to generate HTML documentation for dynamic models in PowerFactory, specifically composite models (ElmComp) and their DSL models (ElmDsl). Such documentation is useful for project reports, or for sharing model details in an accessible format with collaborators who do not have access to PowerFactory.

1 Setup

We begin by starting PowerFactory and activating the project.

# If you use IPython/Jupyter:
import sys
import json
from powfacpy.base.active_project import ActiveProject
with open(r"..\..\settings_local.json") as settings_file:
    SETTINGS = json.load(settings_file)
sys.path.append(
    SETTINGS["local path to PowerFactory application"] # e.g. r"C:\Program Files\DIgSILENT\PowerFactory 2025 SP5\Python\3.13"
)
# Get the PF app
import powerfactory
app = powerfactory.GetApplication()
app.Show()
app.ActivateProject(rf"{SETTINGS["path to powfacpy folder in PowerFactory database"]}\powfacpy_tests_copy_where_tests_run")
act_prj = ActiveProject(app)

2 Generating the Documentation

The DynamicModelDocs class from powfacpy generates documentation for a composite model. In this example, we document a hydro turbine model from the Nordic test system [1] located in the template library of the project. The resulting HTML documentation is displayed in the section below.

from powfacpy.applications.dynamic_model_docs import DynamicModelDocs
pfdm = DynamicModelDocs(app)
try: 
    app.Hide()
    pfdm.composite_model = act_prj.get_unique_obj(r"Library\Templates\SM_hydro\Frame(g1)") # path to ElmComp
    pfdm.file_name = pfdm.composite_model.loc_name
    pfdm.target_directory = rf".\output\dynamic_model_docs"
    pfdm.create_composite_model_docs()
finally:
    app.Show()
Wrote self-contained: 'output\dynamic_model_docs\Frame(g1).html' (CSS and SVGs inlined).

3 Model Documentation

Back to top

References

[1]
L. D. P. Ospina, A. F. Correa, and G. Lammert, “Implementation and validation of the nordic test system in DIgSILENT PowerFactory,” in 2017 IEEE manchester PowerTech, 2017, pp. 1–6. doi: 10.1109/PTC.2017.7980933.