Cantera in Simulink

224 views
Skip to first unread message

Lucas van de Voorde

unread,
Oct 3, 2016, 8:38:13 AM10/3/16
to Cantera Users' Group
Hi,

I try to use Cantera in Simulink. I have a written a simple matlab function in a Simulink block
For now I try to import an phase in that function. But I get this error message from Simulink:

"Cannot load 'Solution' because code generation does not support classes and enumerations in @-directories."

If I try to import the phase in the command windows of Matlab everything works fine, but not in Simulink.

Can anyone help me?

Greets,

Lucas

Bryan W. Weber

unread,
Oct 3, 2016, 8:51:47 AM10/3/16
to Cantera Users' Group
Lucas,

I would expect this is because all of the Cantera classes are defined in @ folders. This is documented here: https://www.mathworks.com/help/matlab/matlab_oop/class-files-and-folders.html There are actually several OOP paradigms in Matlab, and Cantera uses one of the older ones, so its possible that upgrading would allow you to use Cantera with Simulink. However, I'm not sure if its possible to use user-defined classes at all in Simulink, so this is something you'll have to investigate.

Best regards,
Bryan

Lucas van de Voorde

unread,
Oct 5, 2016, 8:25:44 AM10/5/16
to Cantera Users' Group
Thanks Bryan for your responce. 

I found another solution.
Just add: coder.extrinsic('matlab_function') to your matlab function block. And replace matlab function by the file name of the function in which you are using Cantera files.

Greets,

Lucas


Op maandag 3 oktober 2016 14:51:47 UTC+2 schreef Bryan W. Weber:

J Chapman

unread,
Oct 20, 2016, 9:46:48 AM10/20/16
to Cantera Users' Group
Hi,

The open source Toolbox for the Modeling and Analysis of Thermodynamic Systems (T-MATS) has this interface set up.
You could use it as created, or use it as a reference of one method of using Cantera with Simulink.

The software/source code can be found at: https://github.com/nasa/T-MATS

GL,
-Jeff


On Monday, October 3, 2016 at 8:38:13 AM UTC-4, Lucas van de Voorde wrote:

Prasad Raut

unread,
Sep 25, 2019, 10:13:57 PM9/25/19
to Cantera Users' Group
Hi Lucas,
I am facing similar issue.
Can show me an example. I am trying to run constant volume combustion through simulink.
Thanks
Reply all
Reply to author
Forward
0 new messages