Unknown hook 'FMUExportTestingMode'. Either no such hook is registered or the module registering the hook is currently not loaded.

I'm trying to run a script that generates FMUs using the MATLAB function exportToFMU. I ran it successfully many times yesterday. When I started MATLAB today and ran my script I got this error message:
Error using GenerateFMUs (line 12)
Unknown hook 'FMUExportTestingMode'. Either no such hook is registered or the module registering the hook is currently not loaded.
The code I use to generate the FMUs:
exportToFMU(modelName,'FMIVersion','2.0','FMUType','CS', 'CreateModelAfterGeneratingFMU', 'off', 'supportMultiInstance', 'on', 'SaveDirectory', outputFolder, 'FMUName', fmuName64Bit)
exportToFMU(modelName,'FMIVersion','2.0','FMUType','CS', 'CreateModelAfterGeneratingFMU', 'off', 'supportMultiInstance', 'on', 'SaveDirectory', outputFolder, 'Generate32BitDLL', 'on', 'FMUName', fmuName32Bit)
UPDATE 1:
If I open and close Simulink once, the error goes away and I am able to generate FMUs.
UPDATE 2:
Added code example.

2 comentarios

Hey Nils, could you share the model ?
Sorry, can't share the model. It's a simple model containing a single 'MATLAB Function' block and some input- and output-ports.
I'm pretty sure that the model doesn't matter. It looks like something is beeing initialized when Simulink is started. Probably something in the ' FMU Builder for Simulink® support package'.

Iniciar sesión para comentar.

 Respuesta aceptada

The solution is to call load_system() before calling exportToFMU():
load_system(modelName);
exportToFMU(modelName,'FMIVersion','2.0','FMUType','CS', 'CreateModelAfterGeneratingFMU', 'off', 'supportMultiInstance', 'on', 'SaveDirectory', outputFolder, 'FMUName', fmuName64Bit)
exportToFMU(modelName,'FMIVersion','2.0','FMUType','CS', 'CreateModelAfterGeneratingFMU', 'off', 'supportMultiInstance', 'on', 'SaveDirectory', outputFolder, 'Generate32BitDLL', 'on', 'FMUName', fmuName32Bit)

Más respuestas (0)

Categorías

Más información sobre Export Simulink Model as Standalone FMU en Centro de ayuda y File Exchange.

Productos

Versión

R2024b

Etiquetas

Preguntada:

el 21 de Nov. de 2024

Respondida:

el 21 de Nov. de 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by