×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

PID algorithm to simulate generator reponse

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
 

RE: PID algorithm to simulate generator reponse

A typical generator governor setting may be:
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

(OP)
Hi Bill,
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

Maybe your error coming in is not scaled correctly?  Seems like your error is a size logrithmic (x10-x) too small.

RE: PID algorithm to simulate generator reponse

I would use;
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

I'm confused about what you are trying to accomplish.

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

Some diagrams in this link might be  useful, if you fancy doing Laplace transforms in Fortran. Sounds like torture to me - easier to buy a piece of software to do the work!

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!
 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources