Ignoring Errors Generated by an Interpreted MATLAB Function Block in Simulink

14 Ansichten (letzte 30 Tage)
I’m using an interpreted MATLAB function block to call a function (refprop) which determines real gas properties of a mixture. So far I have been able to get this block to work most of the time, however as I am operating near the vapor dome, occasionally the refprop function fails to converge on an answer and throws an error. I’m relatively confident that the function will be able to converge on an answer after several more time steps as the gas conditions are continually changing. However as soon as the interpreted MATLAB function block throws an error, the entire Simulink model stops. Is there some way to intercept this error (such as the try/catch function in MATLAB) that would allow me to continue running the simulation even if the function occasionally throws an error? I’ve also tried to use a MATLAB function block but it’s not compatible with the refprop function. Another approach would be to compile lookup tables for the mixture but I’d prefer to call the refprop function directly at this point (speed is not currently a concern).
Thanks for any assistance,
Mike
  3 Kommentare
jonas thiaucourt
jonas thiaucourt am 20 Nov. 2017
Hi, I'm facing more or less the same issue. This is what I'm doing so far: I ask for the quality (Q) of the vapor phase and when it fails to converge then Q=999 and based on this, I ignore failed values and move on. Regards, Jonas
Guilnaz Mirmoshtaghi
Guilnaz Mirmoshtaghi am 17 Aug. 2023
@jonas thiaucourt since the error occurs inside refprop, how do you ignore it by putting Q=999?
because as you wrote, it is due to Q value and if we somehow can have a line in code which changes the Q value, then refprop can go on. But how can we change Q inside?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Modeling finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by