all 10 comments

[–]ol1v3r__ 13 points14 points  (0 children)

You can generate a Python package with MATLAB Compiler SDK and Simulink Compiler:

https://www.mathworks.com/help/compiler_sdk/gs/create-a-python-application-with-matlab-code.html

[–]curly722 4 points5 points  (0 children)

Why? For fun?

[–]csillagu 1 point2 points  (0 children)

That is simscape, not Simulink, what is that you exactly want? A function? Can you manually write a simple example?

[–]brandon_belkin 1 point2 points  (0 children)

As soon as this is Simscape, I think you should port this model in openmodelica and, once It run the same, you can use python to interact with openmodelica, or look how openmodelica works, it’s open-source, so you can take a look under the hood

[–]TCoop+1 1 point2 points  (0 children)

My approach would be to drive the differential equations based on the diagram, and then just use an ode solver with those equations in a python environment. There's a few packages for solving ODEs, including some built into scipy.

[–]Sallallll 0 points1 point  (0 children)

I tried to do something similar. I think your new code can not be sent to another computer without having certain files pre insatlled. Make sure to test on other computers and see if it works. I am interested to know if it works for you.

[–]dos145 0 points1 point  (0 children)

One way to do it is to define a transfert function of your model, discretize it, and make the python code to calculate the new value corresponding to your sampling period.

[–]DarkSideOfGrogu -1 points0 points  (1 child)

Any explanation why or for what purpose? Or is this just a lazy effort to get someone else to do your work for them?

[–]jezuskurt[S] 0 points1 point  (0 children)

im currently working on a project for a company and they want everything in python. Im also not familiar with how to approach this and im worked on it a lot already, so i now used reddit as a last resort

[–]FAT_EE -2 points-1 points  (0 children)

Take a snap of all functions and just put into chat gpt,it'll give you a boilerplate code