@mtkmodel-ize LimPI

I am playing around to get some motor control simulations running with modeling toolkit. Last time I did that it was 2y ago so the syntax has changed (and got more simple to read).

While trying to implement a timediscrete PI controller I started to copy LimPI from the ModelingToolkitStandardLibrary. Since I thought it would be good idea I modified it to use the @mtkmodel syntax :slight_smile:

But for some reason I am not able to get it to run. I am trying to debug why, but I have no success.

The error I am getting is:

ERROR: MethodError: Cannot `convert` an object of type SymbolicUtils.BasicSymbolic{Real} to an object of type Float64

Plus the stacktrace. Here is the file I am working with:

dc_motor_discretecontrol.jl (3.7 KB)

If you could point me in the direction why/what is failing, it woudl be great. But even better would be if you could point me in a direction to learn how to better debug these.

I have tried to inspect the equations and parameters, between the working version (with function LimPI(…) ) and the non working version, but I really miss the know how how to even properly compare the models…

Thank you for your help!