Is it possible to generate a PWM signal in a real-time model with a pulse width resolution smaller than the fixed time step of the model?
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Findlay McCormick am 13 Jul. 2021
Beantwortet: Dimitri MANKOV am 12 Aug. 2022
I am developing a simulink real-time model that should output several PWM signals to control a series of servo motors. Since this is a real-time model, I have to use a fixed time step when executing the model and this is where I have encountered a problem. I need the PWM signal to have a resolution of about 10 microseconds. I have found that the only way to achieve this resolution is to likewise set the time step of the model to 10 microseconds. Unfortunately, running the model with this time step requires way to much processing power and is overloading my CPU.
Is there any way I can run my real-time simulink model with a more reasonable time step (0.01 to 0.001 second) and still generate a PWM signal with the pulses having a resolution of 10 microseconds?
Dimitri MANKOV am 12 Aug. 2022
Absolutely, this is possible, though you would probably not use the CPU of your target machine for this purpose. If you're using Simulink Real-Time, then you probably have Speedgoat hardware as well.
Speedgoat offers FPGA-based solutions for applications where a faster sampling frequency and signal post-processing are required, such as PWM generation and capture, quadrature encoding/decoding, protocols like I2C, SPI, etc. I highly encourage you to have a look at the code modules offered by Speedgoat for their FPGAs.
An alternative would be to use one of Speedgoat's Programmable FPGAs with HDL Coder to deploy your own algorithms to it.
I hope this is helpful!
Weitere Antworten (0)
Find more on Hardware-in-the-Loop Simulation with Simulink Real-Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!