i am using a sepic converter. ac to dc converter. my input is 75 volt and output is 12 volt. my requirement is to control the output voltage . if i give 10 volt as reference in pid controller, i should get 10 volt as output.
The type of controller you use depends on the open-loop frequency response, especially the phase angle at desired crossover frequency. Most of the times, PI controllers suffice.
PID based feedback loop are much more difficult to design than PI based ones.
You may need to say why you prefer PID control to PI.
sir, i need the pic 16f877a code for pi or pid control. i have to do both controllers for the academic purpose. if you have the code for pi controller please help me sir....
int pid(int in) {
I = in*Ki + I
P = in*Kp
return I + P
}
It's that simple. Almost. You'll want protection so I can't rollover and ideally anti-windup on I as well.
You'll also need to know where you want to place your poles and zeros and understand how to map the Ki and Kp coefficients to them. I'd also want a final pole although it may come elsewhere (like an analog filter on the ADC input). But if not you'd want a single pole IIR for an additional pole.
A simulation tool like matlab or PSIM would be ideal for experimenting with this.
If TypeIII compensation is needed you'd add a D term and another single pole IIR. The IIR is quite easy as well:
Code:
int IIR1 (int in) {
out = (in - out)*ka + out
return out
}
It's not the way how a forum works.
We will help to solve problems with your own code, but we are not here to write code for you.
If you want someone to do your job you should consider to pay for it.
And then you have to give a full specification/requirement ....
Currently we don't know essential informations like your languuage and compiler, PID loop timing, sample frequency, inputs, outputs, data format... flow chart...
The error suggests this is code written for a different compiler that has 'pwm2_init' built in as a library or that you are missing the source file that contains it.
Either use the original compiler, use an equivalent library function in MPLAB or write your own function.
The name suggests it is a function to initialize the PWM registers so it should be very simple, read section 8.3.3 of the datasheet it explains everything.