MATLAB: Using an FMU in a while iterator block

fmu model exchangewhile iteratorsimulink

Hello,
we try to use an FMU in w "while iterator" block. We import the FMU as model exchange but Simulink gives the following message: 'Validation/While Iterator Subsystem1/FMU' has sample time 0. Only constant (inf) or inherited (-1) sample times are allowed in iterator subsystem 'Validation/While Iterator Subsystem1'.
I thought the communication step size might be the problem. But this parameter cannot be changed in model exchange mode. I also thought that in model exchange mode there cannot be a problem with step size because the FMU gets the step size from the solver.
Thank your very much!

Best Answer

I found a solution! I do not know what the problem is exactly. I think the Simulink FMU wrapper is not as powerful as other tools to implement FMU's. I found the following package: https://sourceforge.net/projects/matlab-fmu/. There are functions to implement FMU's in matlab code. It is then possible to execute an FMU in a loop. No error.
Thanks