PID Controller to tune an engine
blackhawk0042
Posts: 1
Hey everyone,
I just want to start out by giving you all a little background about myself. I am a team member on my senior design team that is working on our project called STEFI. This is our Self-Tuning Electronic Fuel Injection system. We are currently using the Propeller 1 as our micro-controller. The part that I am working on is the PID Controller loop. Basically I am to take the value of the current AFR (Air/Fuel Ratio) and try to get it to a specific value by controlling the amount of time the fuel injectors are open putting fuel into the engine.
Basically I want to know if there are any good examples of PID controller codes out there that I can take a look at. I have never really coded for the Propeller so this is a first for me. Consider me a Noob on all levels when talking to me about this. Thanks for your time and patience!
Tom
I just want to start out by giving you all a little background about myself. I am a team member on my senior design team that is working on our project called STEFI. This is our Self-Tuning Electronic Fuel Injection system. We are currently using the Propeller 1 as our micro-controller. The part that I am working on is the PID Controller loop. Basically I am to take the value of the current AFR (Air/Fuel Ratio) and try to get it to a specific value by controlling the amount of time the fuel injectors are open putting fuel into the engine.
Basically I want to know if there are any good examples of PID controller codes out there that I can take a look at. I have never really coded for the Propeller so this is a first for me. Consider me a Noob on all levels when talking to me about this. Thanks for your time and patience!
Tom
Comments
Also this:
http://forums.parallax.com/showthread.php/105978-PID-Enhanced-is-finally-done!?highlight=Enhanced+PID
Mickster
in google searh type:
If you look for a topic in the forum limit the search with
Massimo
The first thing to start with is, what is the source of your error in terms of how you are going to present the error to the loop. What are the ranges of the error min to max. Is there a requirement for a maximum output, or maximum Integral value. Does the output need to be scaled to your device, and what is the method of controlling your device. Do the values inside the loop need to be constrained to positive values only, or is there a need for signed values( I always keep the error as a positive as in error := ||(encoder position - desired position). Is there any feedback (sensor) from the device to track?
Hope this helps.
To do automatic mixture tuning with a PID loop you have to first get the mixture "close enough". A gasoline engine can't just run with an arbitrary amount of injected fuel that slowly gets adjusted to the optimum range; it must be within a specific mixture range to ignite the fuel successfully in the first place. Also, wideband air-fuel meters are slow within the context of a running engine (approximately 100ms step response at the absolute fastest, and that's claimed numbers, not real-world), so they can't react fast enough to do per-cycle adjustment even at idle. Then there are issues of lean- and rich-misfire that trick the sensor into reading the wrong mixture.
At the very least what you need is a feed-forward component to your PID loop, from a fuel table that references rpm on one axis and load on the other. Then you have to limit the maximum PID authority so that it doesn't deviate the injection amounts beyond a safe range.
In the Megasquirt world we run the engine parameters through a formula to get a base fuel table to work from before starting the tuning process, this is the feed-forward component.
That's some good advice. Do you have any Prop/Prop2 plans?