Connecting a Matlab function to Modelica

26 ビュー (過去 30 日間)
Gabriele Galli
Gabriele Galli 2020 年 4 月 12 日
コメント済み: Sahil Wagh 2023 年 10 月 22 日
Hello All,
I am trying to connect dynamically a MATLAB function to a Modelica Model.
This Matlab function I created is based on the MATLAB function lsqnonlin.
This function has to be called by Modelica everytime I run the model as it is used to obtain initial values.
Basically, what I want to obtain is something like this:
1) Run the simulation
2) Modelica sends the input value to Matlab
3) Matlab calculates a vector of outputs using lsqnonlin
4) Matlab sends these values to Modelica to initialize the simulation values
5) Start the simulation in Modelica
What I really want to obtain are points 3 to 5 (i.e. I can set manually the input value in Matlab before running the simulation in Modelica)
Do you know if there is a way to do this?
Thank you so much in advance!
Gabriele
  1 件のコメント
Sahil Wagh
Sahil Wagh 2023 年 10 月 22 日
Were you able to do it? I am stuck on a similar problem.

サインインしてコメントする。

回答 (1 件)

Rajani Mishra
Rajani Mishra 2020 年 4 月 17 日
You can store values in a mat file and that can be used to communicate between MATLAB and Modelica.The part of the question - " I can set manually the input value in Matlab" is not clear.
Also check below provided functions:

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by