简体   繁体   中英

Diesel Generator Driver algorithm

I have an old diesel generator, and I am having big problems programing the governor. I need the engine to stay between 2400-2800 RPM

I have strong RC car servo pushing the gas lever of the engine and the servo is moving between 22°(Minimum) and 95°(Maximum) fuel injection

I drive it with an Atmel meg 328 Microcontroller. The speed is measured with a Hal effect sensor and a single magnet on the flywheel. I measure the time it takes to make a full turn and I calculate the RPM based on that (it means if the engine is faster the code reacts to it more often => Faster changes in injection amount)

First I tried the simplest, and dumbest way. If the RPM is bigger than my needed, step servo back => Smaller amount of fuel injection. If the RPM was lower than needed step servo forward. It turn out to be a really bad idea as the engine has a big latency, so My RPM write a perfect sine graph around my Needed RPM, because it has a big inertia. so when the RPM was above the upper limit the engine was still accelerating.

I also tried changing the amount of regulation degree, by multiplying it with the square of the difference (Needed RPM-Current RPM) It turn out to be the best, but it is still running over.

I'd like to be able to predict my curve somehow, and change the fuel injection according to my future curve. And the engine gets a huge RPM drop as the load increases suddenly (I start a compressor from that)

Help me please, I have no Idea. I'll send some picture f the graphs sortly.

As Avi Ginsburg mentioned, try using a PID controller:

https://en.wikipedia.org/wiki/PID_controller

Basically it consists of a P roportional, a I ntegration and D erivation element. This is always used as a looped circuit:

图片来自维基百科

There is also an Arduino library:

http://playground.arduino.cc/Code/PIDLibrary

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM