Run Python function from inside Simulink
Hello!
I have a simulink electric motor example that is being controlled via PWM.
I want the controller that spits out the PWM to be a Python function ( a NN controller I have written in Python INPUT: motor rpm OUT: PWM signal) — and it returns in real time floating point numbers. e.g. 2,504; 2,103 etc.
I want that to be the input for the PWM block in the Simulink model. And the output of the electric motor (rpm) to be the input for the Python function (I have a special measurement input for that function).
Has anybody had any succes with linking .py files and Simulink ?
__________________________________________________________________________________________________________
And to run the python files, do I need to containerize them or to do something special ? Because there are 5 files in the whole project which I will need. I cannot run the function alone.
Thanks a lot!Hello!
I have a simulink electric motor example that is being controlled via PWM.
I want the controller that spits out the PWM to be a Python function ( a NN controller I have written in Python INPUT: motor rpm OUT: PWM signal) — and it returns in real time floating point numbers. e.g. 2,504; 2,103 etc.
I want that to be the input for the PWM block in the Simulink model. And the output of the electric motor (rpm) to be the input for the Python function (I have a special measurement input for that function).
Has anybody had any succes with linking .py files and Simulink ?
__________________________________________________________________________________________________________
And to run the python files, do I need to containerize them or to do something special ? Because there are 5 files in the whole project which I will need. I cannot run the function alone.
Thanks a lot! Hello!
I have a simulink electric motor example that is being controlled via PWM.
I want the controller that spits out the PWM to be a Python function ( a NN controller I have written in Python INPUT: motor rpm OUT: PWM signal) — and it returns in real time floating point numbers. e.g. 2,504; 2,103 etc.
I want that to be the input for the PWM block in the Simulink model. And the output of the electric motor (rpm) to be the input for the Python function (I have a special measurement input for that function).
Has anybody had any succes with linking .py files and Simulink ?
__________________________________________________________________________________________________________
And to run the python files, do I need to containerize them or to do something special ? Because there are 5 files in the whole project which I will need. I cannot run the function alone.
Thanks a lot! python, simulink, electric_motor_control, embedded matlab function MATLAB Answers — New Questions