I am utilizing 'Python Power Electronics' tool to simulate and analyze Traction Inverters topologies along with synchronous motor as Load. In this simulator, the control logic is written in Python eg: inverter_PWM.py, control_motor.py etc. Now I would like to know the ways to dump this code in Automotive Hardware. Are there any tools or Interfaces available to deploy Python code into real-time systems.
for eg: in the context of MATLAB/Simulink models, the dSPACE Targetlink tool serves as a production code generator.
I googled about this: There are many ways to deploy Python into Hardware related to Artificial Intelligence topics. But here i am looking to deploy code in Automotive Hardware.
I came across MyHDL package in Python which can be used to convert Python code into Verilog or VHDL to deploy code into FPGA. But Python file(eg: Inverter_PWM.py) should be modified into supported data types and functionality of MyHDL at first.
I am still looking for other possibilities.
Info :
I use VS code as code Editor.
simulations executed in 'Python Power Electronics' tool is: discrete time simulations. Here i am attaching a sample of inverter_PWM.py file code.
dt = 1.0e-6 # sampling time interval if t_clock > t1: # carrier waveform -- a triangular waveform between -1 and 1 carr_sig += carr_slope*dt if carr_sig >= 1.0: carr_slope = -carr_slope_mag elif carr_sig <= -1.0: carr_slope = carr_slope_mag # modulation signals mod_signal_a = 0.98*cos(wavef*t1) mod_signal_b = 0.98*cos(wavef*t1 - 120*pi/180) mod_signal_c = 0.98*cos(wavef*t1 - 240*pi/180) # modulation - carrier comparison if mod_signal_a > carr_sig: gates1 = 1.0 gates2 = 0.0 else: gates1 = 0.0 gates2 = 1.0 t1 += dt
Python is an interpreted language and thus not executed in real time. Embedded devices are programmed in languages that are not interpreted, mostly C.
For power electronics you need very fast predictable real time behaviour which Python is not suited for.
Which embedded platform are you planning to use?
There are possibilities though: