PID algorithm to simulate generator reponse
PID algorithm to simulate generator reponse
(OP)
Hello,
I'm hoping someone can help me, I'm trying to recreate a PID controlled generator output using a in Fortran.
Here's the code:
error = setpoint - measured_value
integral = integral + (error*dt)
derivative = (error - previous_error)/dt
Output = ((KP * error) + (KI * integral) + (KD *derivative))
previous_error=error
The output from the generator can vary between 0 & 4000Nm. I'm trying to get something to hold at 1.0.
The output from the PID loop is very small ~ 10Nm unless I make the KP term very high ~ 20000000. I seem to have made a fundamental error somewhere but I don't know where.
Can anyone advise?
Thanks
George
I'm hoping someone can help me, I'm trying to recreate a PID controlled generator output using a in Fortran.
Here's the code:
error = setpoint - measured_value
integral = integral + (error*dt)
derivative = (error - previous_error)/dt
Output = ((KP * error) + (KI * integral) + (KD *derivative))
previous_error=error
The output from the generator can vary between 0 & 4000Nm. I'm trying to get something to hold at 1.0.
The output from the PID loop is very small ~ 10Nm unless I make the KP term very high ~ 20000000. I seem to have made a fundamental error somewhere but I don't know where.
Can anyone advise?
Thanks
George





RE: PID algorithm to simulate generator reponse
Proportional band - 3%
Integral - zero
Derivative - zero.
For isochronous operation, dial in a little integral. Look for a correction time of several seconds.
Bill
--------------------
"Why not the best?"
Jimmy Carter
RE: PID algorithm to simulate generator reponse
Thanks for the response. I think I'm some way off getting to the putting in the settings you suggest.
I can't seem to be able to get a sensible output from my PID loop, the numbers it supplies are tiny in comparison to the output they need to supply for the task, so in order to get any reaction I need have a huge value of P. I've made a fundamental error somewhere but I can't see how to fix it.
Thanks
George
RE: PID algorithm to simulate generator reponse
RE: PID algorithm to simulate generator reponse
I don't do Fortran, but in arithmatic,
For 60 Hz, setpoint = 60 Hz + 3% = 61.8 Hz.
Proportional band = 3%
3% error (1.8 Hz) = 100% output.
Gain and proportional band are reciprocal. If your program wants one and you inadvertantly add the other, you will be a long way out in the wilderness.
Bill
--------------------
"Why not the best?"
Jimmy Carter
RE: PID algorithm to simulate generator reponse
You have apparently a crude model of a PID controller which is supposed to "control a generator"
Is it controlling the prime mover? What type of prime mover? Do you have model of the system to include things like rotating inertia, power system characteristics?
=====================================
(2B)+(2B)' ?
RE: PID algorithm to simulate generator reponse
The governor models are from one of the IEEE standards, but I can't remember which one. The standard for the generator and AVR model is IEEE 421 if I recall correctly. You'll need this latter one if you want to model how your machine interacts with the grid.
----------------------------------
If we learn from our mistakes I'm getting a great education!