How to include extension scripts in PDF reports?

Category:
Scripting
Answer

PDF reports can by default use results that are present in the memory of PowerFactory, e.g. after a Load Flow calculation. Therefore, the calculation always has to be executed first before creating a PDF report.

In case results from a result object shall be used in a report, they have to be processed first. This can be done by an extension script which are linked on the “Extensions” page of the report template (IntReport). The extension script is executed before the report is created and should be used to generate data tables which can be used in the report. The necessary scripting methods can be found in the Python/DPL scripting reference.

Attached are two PowerFactory projects with examples:

  1. “FAQ_Studycase_Comparison_Report.pdf” contains two study cases where the load flow results of both are displayed in a report. First, the load flow results have to be stored in a result object (ElmRes). This is done with the Python script “Load Flow” which is located in the project library in the folder “Scripts”. After it is executed, the results can be processed by the extension script which is part of the report (IntReport) “Load Flow Report for Study Cases”. The report shows line loading results of both study cases.
  2. “FAQ_WindFarm_ExtensionScript_Report.pdf” contains a report with an extension script for the Power Park Energy Analysis tool. After the calculation is executed, the results which are stored in a dedicated result file can be processed by an extension script. This can be seen in the report (IntReport) “PowerPark result file script”.
Back