I have generated sine wave using PWM. Now I want to control the output voltage using PID controller technique with less THD.
I tried in many ways but I am not getting proper output(the sine wave disturbed).
Would you please guide me ?
I have taken Kp=0.1 and Ki=0.1
Code C - [expand]
1
2
3
4
5
6
7
8
9
error = setPoint-Feedback_Value;
iError +=error;
outPut =(Kp*error)+(Ki * iError);// PI value
percentage =((outPut*100/setPoint));//Error in percentage
PDC1 +=((PDC1*percentage)/100);// I have used a variable in place of PDC1 for calculation and in next step I added that to PDC1