ADC_PID_EPWM simulation

6 views (last 30 days)
Muhammad Arsalan Athar
Muhammad Arsalan Athar on 22 Aug 2023
Edited: Anudeep Kumar on 27 Apr 2025
Hi Community members,
I am a beginner in PID simulation.
I use ADC block to generate a voltage/digital number at Time Scope0. but it gives 0 values all the time. Why?
PID is tuned by Automatic generator and then I can get the results at Time Scope 4,5,6.
Vref is 2V which is compared with my ADC values through Adder/Subtractor. the result of Adder/Subtractor is shown in Time Scope3 .
The Problem is why do i get always 0 amplitude at Time Scope0? Is there any problem in ADC settings to run the simulation?
MATLAB2021b version
Please suggest to simulate this PID based ADC conversion and genrating ePWM signals.
Thanks
Kind Regards
Arsalan

Answers (1)

Anudeep Kumar
Anudeep Kumar on 25 Apr 2025
Edited: Anudeep Kumar on 27 Apr 2025
Hey Muhammad,
I tried to reproduce your model based on the figure and tried to dig deeper in the issue you are facing. I believe there could be two possible reasons :
  1. ADC Block output is Always zero: You need to check if the ADC block is configured correctly based on your board’s configuration and what output is it producing. Check the reference voltage, resolution and other properties and the input to it.
  2. Zero-Order Hold Block: The Zero order hold block samples its input at a specified interval. If the sample time is not aligned with the simulation, or the input is always zero at the sample instant, the output will be 0. So make sure the sample time of the zero order hold block is configured correctly.
I am attaching here the documentation for the ADC and the ZOH block for better understand how to configure them to achieve your goal.
In addition, I am attaching a few examples and a MATLAB Answer link that might help you simulate PID based ADC conversion and generate EPWM signal.
How to convert PID output Signal to a PWM signal in simulink? :
ADC-PWM Synchronization using ADC Interrupt:
Control Peripherals Examples:
Hope the above links guide you in the right direction.

Communities

More Answers in the  Power Electronics Control

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!