My user defined dynamic model was compiled as a DLL file but it cannot be loaded in PowerFactory. What can I do?

Dynamic Simulation

This issue appears due to various errors occuring during the loading process of the specific DLL (dynamic link library) file. As with any other DLL based file, the architecture with which the DLL was compiled matters:

- a 32 bit compiled DLL (in this case, the user-defined model DLL file) will be loaded only by 32 bit applications (in this case, PowerFactory 32 bit)
- a 64 bit compiled DLL will be loaded only by 64 bit applications


Failure to comply with the above requirement is the most common cause of a failed DLL loading process.

You can also monitor the loaded DLL files, load and unload the external DLLs directly in PowerFactory by using the DLL Manager (ComDllmanager):
- Open PowerFactory (no need to activate a project) and open the Data Manager;
- Create in the your PowerFactory user path in the database a new object: Click on New Object icon, check the "Others" radio icon and type in the field "Element" the following (without quotes) "ComDllmanager". Press OK. Onwards PowerFactory 2023, from the Data Manager, click on the icon New Object. A pop-up window New Object will appear. In the Filter as you type, write the text ComDllmanager and press OK. A pop-up window, namely DLL Manager.ComDllmanager will appear.

- The DLL Manager dialog shows up. Execute a Report: click the Report button. Check in the Output Window the provided report. A list with all DLL files that are additional to the standard PowerFactory package is reported. Verify if your DLL file is among the listed items.
- Select the specific DLL Type (i.e. the interface on which the DLL is based) and the action which is wished for: "Load" all (will try to load all DLL files existing in the predefined path) and "Unload" all (will unload all DLL files of this type). Press Execute to perform the action. Make sure that the "predefined path" is correctly configured. Please note that in the case of Dynamic Model DLL (Compiled DSL models, IEC61400-27 DLL models, FMUs), only unloading is supported.

In the above, the "predefined path" represents all local computer folder paths (not the database path) which are:
- configured explicitly in the block definition (BlkDef) objects (this is the case for DSL to C Interface based models or IEC 61400-27-1 models)
- configured in the field "Directories for external digex* libraries (DLL)" (this is the case for digexfun and digexdyn based models). This field is available by going to the main menu item Tools->Configuration->Advanced page

It is worth checking the above requirements for your particular setup. If these requirements are ok, then you might need checking the external requirements of the DLL file itself, i.e. depending on the additional user-defined DLL functionality, it may be that the DLL requires other files in order to function properly. These files (which are not part of the PowerFactory distribution, nor are they required by default) may be available on certain computers while on others, they could be missing. This can be checked, for example, with the dependency walker application, available for download on the website below (refer to the specific documentation of the product for more details). Do check with your IT administrator for permission of running any 3rd party program on your machine: