Hi guys!
I’m having some trouble with my simulations using simplified C block to generate modulation signals for a PWM block.
I have a discrete controller working fine in a general simulation (look a brief at pic 1 attached). However, when I try to use SimCoder elements, my modulation signal goes insane (see attachment 2)…I haven’t been able to figure that out.
Some observations:
- I’m sure that my signals are within the range for the ADC block, controller, and all calculations.
- I’m using the same timestep for both simulations (I actually only created a new file, changing for using inputs with ADC block and the PWM block with the same characteristics). It’s 8.33333E-007, so I think it should be enough for a 24kHz switching.
- I’m using the same sampling intervals (ZOHs) in both simulations.
I’ve made some tests and my PWM scheme seems to work fine in SimCoder, so I’m thinking the issue is somehow related to how my code is running inside the Simplified C block. I’m confused once it works fine without the SimCoder elements.
Let me know if you need any further information.
Thanks a lot!