0

I am trying to export an fmu from matlab using the new tool coupling toolbox as shown in this link https://www.mathworks.com/help/simulink/ug/_mw_54e936ec-2fa7-4418-be70-d99c8f91d2bd.html

So I was able to export an fmu and it generated 64 bit binary of the source code as my platform is 64 bit. I wrote a testfile to import the fmu and run the model using just the binaries. So I started the matlab server as mentioned in the link and then tried to run my testfile. My testfile was working well with other fmus like qtronic exported example fmus. Now I would like to run the matlab generated fmu and it is giving the following error:

fmistatus = Error; Test CS model Instance (logStatusError ): fmi2Instantiate: Undefined function or variable 'fmuhelper'. fmi2Instantiate: Undefined function or variable 'fmuhelper'. fmi2_import_instantiate failed module= FMICAPI, log level=5:Calling fmi2SetupExperiment

I didn't write anything in any of my source code as fmuhelper. When I checked in matlab and went to the specific path, I was able to see that fmuhelper is part of matlab and that it is a constructor. I did not understand anything more than that from that function. can anyone please provide me some suggestions as to how to solve it? Thank you!

lorugant
  • 49
  • 7

2 Answers2

1

I was able to solve the above problem. The problem was that matlab was unable to locate the fmuhelper in the resources folder. So I added the path to the fmuhelper and other mex files to the matlab path and I was able to get past this error. But I still am encountering some issues with running it. But this problem is now resolved. Thank you!

lorugant
  • 49
  • 7
0

I assume importing the same FMU back to MATLAB works. If that's true, one possible reason why you can't simulate with your own code is that your simulator didn't unzip and preserve the entire folder structure inside FMU, more specifically, files under resources/ folder.

dchneric
  • 121
  • 5
  • Hi I was able to get past this problem yesterday but I am encountering new errors and I am on my way to more debugging. – lorugant Feb 07 '19 at 14:10