Borrar filtros
Borrar filtros

How to integrate Cantera Solution method (Solution.m contained in a @class folder) to a Matlab function used in Simulink

9 visualizaciones (últimos 30 días)
I have the problem that I create a Simulink model which includes an additional user defined function which contained a call to an external Cantera toolbox (gas = Solution('gri30.cti','gri30')). I had just copy and paste the running code from a regular matlab file and put it to a Simulink Matlab Function block. But if I started the Simulink model I got the error "No class Solution". So I have read something about the propably underlying problem with @class folders but I cannot find a solution. Does anybody know how I can fix this problem?

Respuestas (1)

Prasad Raut
Prasad Raut el 27 de Ag. de 2019
Hi Timo,
I am facing similar issue. Were you able to resolve it?
  6 comentarios
Timo
Timo el 26 de Sept. de 2019
I had/have the same problem creating a reactor network but for my application the equilibrium state was sufficient respectivley accurate enough (works fine). Including python to simulink/matlab is possible but the output format of python numpy array's is not directly readable in matlab so you can store results to csv file and reloaded the csv into matlab (also not very nice). Or make the complete implementation in python :-) (often easier and faster).
maybe there is a possiblity to create your own class in matlab with classdef and integrate cantera into this class (https://de.mathworks.com/help/matlab/matlab_oop/create-a-simple-class.html)
Roberto Paolinelli.
Roberto Paolinelli. el 8 de Nov. de 2021
Hi Timo
same problem as you but tried to go ahead...
I was succesful in running reactor2.m then I'm trying to run it in Simulink
I have converted @class to classdef Solution.m, ThermoPhase.m and Kinetics.m and some more.
I'm using matlab.system object to make it run on Simulink and it all works as interpreted execution.
Problems arise when I try and use it as Code Generation (I would this model to run as hardware in the loop...) and Simulink complains about mxArray (probably in ctmethods but it is a mexw64).
Did you succeed on your side? How?
Thank you very much
Roberto Paolinelli

Iniciar sesión para comentar.

Categorías

Más información sobre Create Large-Scale Model Components en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by