alternative way of calling Coolprop every sampling time in simulink
10 次查看(过去 30 天)
显示 更早的评论
Hello all,
I am using Coolprop for humid air properties in Simulink with Matlab function block. It is working well without any error, but it's too slow. I guess it is calling Coolprop from python library every sampling time, and it makes simulation slow. Here is how I use the Coolprop on my code below.
function y = matlabfunc(input1, input2, input3)
coder.extrinsic('py.CoolProp.CoolProp.HAPropsSI');
y = py.CoolProp.CoolProp.HAPropsSI('Vha','Hha',input1,'P',input2,'RH',input3);
end
Is there any alternative way to use Coolprop with faster speed? For example, calling Coolprop only one time before simulation starts, load it into workspace or somewhere, and use it.
Thanks!
0 个评论
回答(1 个)
Rasmita
2023-2-16
Hi Seungho,
It is my understanding that, you want to run above mentioned function only one time before simulation.
For this, you can add this function content in 'startFcn' callback of the model.
For this, go to Model Properties -> Callback Tab -> startFcn.
It will be called once before the simulation starts.
Hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!