Do you have an example of a Matlab Script being used during a Dynamic Simulation?

Category:
Dynamic Simulation
Summary

--------------------------------------

For PowerFactory 2022 and onwards, a Matlab model can be easily linked with PowerFactory by means of the FMI Standard. Please refer to the PowerFactory User Manual, Chapter Models for Dynamic Simulations, Section Interfaces for Dynamic Models, subsection "Functional Mock-Up Interface".

--------------------------------------

For PowerFactory 2021 and earlier please refer to this example and attached files. Note also, that PowerFactory 2022 and onwards have discontinued support of the legacy PowerFactory-Matlab Co-simulation interface, as described in the PowerFactory 2021 User Manual, Chapter 30 Models for Dynamic Simulations, Section 30.6 Interfaces for Dynamic Models, subsection 30.6.3 Matlab Interface.

Answer

For PowerFactory 2021 and earlier please refer to this example and attached files. For PowerFactory 2022 and onwards, this example is not supported anymore. Instead, a much easier alternative is provided - by means of the FMI Standard. Please refer to the PowerFactory User Manual, Chapter Models for Dynamic Simulations, Section Interfaces for Dynamic Models, subsection "Functional Mock-Up Interface". In the text, there are also several links on how to address the interconnection with Matlab.

 

------------- PowerFactory 2021 and earlier ---------------------

A very simple Matlab script calculates a sine wave using a parameter for amplitude and an input variable (time) from DSL. There are no theoretical restrictions in terms of Matlab script complexity.

Import first the PowerFactory project and make sure that the common model "MatlabScript" is updated with the correct file path of the MatlabScript.m file as saved on your computer. Make sure Matlab and PowerFactory have the same bit architecture (either 32 or 64 bit). 

Run the simulation and observe the "Results" plot. Note the description details added to the MatlabScript.m code for more information.

 

Should you encounter issues, you may refer to the prerequisites on running together Matlab and PowerFactory  as detailed in the User Manual, Chapter "RMS/EMT Simulations", Section "Matlab Interface". 

Back