Puppeteer

Author Topic: automatic frequency control, revisited  (Read 11396 times)

cujet

  • Hero Member
  • *****
  • Posts: 957
  • Lister power rules!
    • View Profile
    • www.cujet.com
automatic frequency control, revisited
« on: October 23, 2008, 08:06:38 PM »
OK, I cannot deal with the wide frequency swings, even with the most linear spring my engine will accept. I want accurate freq control. It does not need to be instant, but I want 60HZ under load and 60HZ under no load conditions.

Here is what I want to do:

1) use a governor spring similar to the original for rapid governor response.
2) build some form of electronic control that will slowly bring the engine back to "on freq" 60HZ.
3) attach this device to the engine in place of the spring perch.

The idea would be similar to adjusting the "knob" under high/low loads.

My guess is a radio control type servo attached to a force increasing/distance decreasing lever arm would do the trick. The movement is minimal, but the tension is high. The default setting would be no load 59.5HZ. The electronics would trim the engine to 60HZ and as load increases, the electronics would continuously trim the engine.

Using a pic processor and some simple components might just do the trick. It would be powered by 115V.

Chris
People who count on their fingers should maintain a discreet silence

mobile_bob

  • Administrator
  • Hero Member
  • *****
  • Posts: 2940
    • View Profile
Re: automatic frequency control, revisited
« Reply #1 on: October 24, 2008, 03:55:05 AM »
you might consider looking into a differential lever approach
wherein the original spring does most of the work, and the fulcrum is electromechanically adjusted
by your controller.
that way if there is a malfunction the spring action can maintain the rpm within a reasonable range
albeit probably wider than you like, but probably within safe limits.

there used to be a guy selling onan genset electronic govenors on ebay, pretty reasonable
barber coleman units if i recall, they were capable of tight control of rpm.

bob g
otherpower.com, microcogen.info, practicalmachinist.com
(useful forums), utterpower.com for all sorts of diy info

ronmar

  • Hero Member
  • *****
  • Posts: 1227
    • View Profile
Re: automatic frequency control, revisited
« Reply #2 on: October 24, 2008, 04:29:42 AM »
Yep, by it's nature, a flyweight governor MUST change RPM in order to change the throttle/rack.  But I can also see problems with a microcontroller used to augment it.  Say you throw on a really big load, and the microcontroller adds to the spring tension to get the RPM back to achieve 60HZ.  What kind of overspeed are you going to get when that load comes off, untill the servo can reduce the spring tension?  Here is a test you could run...  Put on a really big load, and crank the spring tension knob up to get back to 60HZ.  then drop the load and see what happens  I would keep my hand on the switch to be able to re-apply the load quickly, or the fuel cut lever to hand throttle the engine for this type experiment,  then see if you would be comfortable with those kind of freq surges.

What are you doing anyway that you can't tollerate what sounds like less than +/- 5% swings in frequency?   
PS 6/1 - ST-5.

cujet

  • Hero Member
  • *****
  • Posts: 957
  • Lister power rules!
    • View Profile
    • www.cujet.com
Re: automatic frequency control, revisited
« Reply #3 on: October 24, 2008, 08:13:06 PM »
Bob G, I think you and I are thinking alike. The lever arm would allow the original spring to do nearly all the work. The default would be just about 60HZ, so if the system fails, the engine would operate normally. Worst case with the servo locked up at high RPM, 63HZ, no load, maybe.

jens, The overspeed upon loss of a large load would not be any worse than it is now, as I must "crank up" the knob to carry the air conditioning. I could program the pic to dump the first 2HZ instantly. That way, overspeed is damped. But you are right, it would be prone to a few seconds of overspeed. I am certain that the pic can control it faster than I can run outside and turn down the knob.

FYI, no worries about overspeeding the engine. I run my 1000RPM 20/2 at 850 or 600RPM. I do not have the pulley to run it at 1000.

Chris

People who count on their fingers should maintain a discreet silence

Petersbpus

  • Full Member
  • ***
  • Posts: 111
    • View Profile
Re: automatic frequency control, revisited
« Reply #4 on: October 24, 2008, 09:03:50 PM »
It seems that my equipment is far less tolerant of voltage fluxuations than HZ, I don't as yet have more than just a little test experience with my Lister genset (with AVR)
But I did intentionally watch for problems with chip controlled air conditioner when I applied and removed a resistive 2160 watt load (9 amps per leg. at 240)
Hz went between 59.5  all the way up to 63.5 or a little higher, the AC unit also drawing about 9 amps didn't kick off or sputter.  seemed OK?
When I had low volts(but very stable HZ) on my China 1115 single and ST head before I added an AVR to that, even my stupid water heater(with fancy mode control with a chip in it) would wig out and refuse to work. Applied\removed loads caused resultant volt fluxuations, I had to cut out it's brain and hot wire to get thru hurricane outage, 8 days.
Are you having trouble with computer backups kicking out?? or just on quest for most stable power on the forum?
I know I left myself wide open to attack, pls be gentle.
Bob
Listeroid 6/1 in progress
Alllis Chalmers 60KW 3 ph
Changfaoid 12KW w/  auto shutdowns, modern AVR and panel
2nd Changfaoid 12KW Marine conversion w/ full auto shutdown and remote panel
Changfaoid 7.7 hp driving 5kw alternater /inverter,
other diesel gensets bought fixed and sold

Tom

  • Hero Member
  • *****
  • Posts: 1746
  • Green power is good.
    • View Profile
Re: automatic frequency control, revisited
« Reply #5 on: October 24, 2008, 09:49:48 PM »
Here is a Kiss idea I'll toss out. How mounting the stationary side of the spring to a lever with a stop. Drill a bunch of holes along the length of the lever to set the sensitivity of the adjustment. Then take a high idle solenoid from a carbureted car with A/C and move the lever off the stop when frequency gets to low. Now all you will need is some simple electronics to turn the solenoid on/off with a bit of hysteresis to prevent it from cycling to much at in between loads.

By setting for 60 hz at no load you will have a fail safe system that will also continue to work if it fails. 
Tom
2004 Ashwamegh 6/1 #217 - ST5 just over 3k hours.

cujet

  • Hero Member
  • *****
  • Posts: 957
  • Lister power rules!
    • View Profile
    • www.cujet.com
Re: automatic frequency control, revisited
« Reply #6 on: October 24, 2008, 09:54:17 PM »
Really, so much electronic stuff in my house does not work correctly with the Lister/ST combo, I am just trying to get it as close as possible to eliminate problems. For starters, the microwave won't heat properly, the TV UPS will not accept lister power at all, EVER. The computer UPS' simply beep once in a while, but click constantly. But the washing machine, dryer, aircond, window aircond, security system and battery chargers are all prone to problems with lister power. All this stuff is computerized and finicky.

I have 2 other el-cheapo generators. Both run the house with somewhat 80% fewer problems. The listeroid, however is 100% pain in the @$$ with the constant wide frequency/voltage swings.

One other issue. The RPM of the system has a huge affect on the voltage. Keeping the HZ/RPM correct will also minimize voltage related problems.

I don't mind a few beeps upon load changes. But, not being able to charge one UPS at all, plus constant relay clicking/beeping/cycling off is out of the quesiton. It simply cannot be good for anything, inculding my sanity.
People who count on their fingers should maintain a discreet silence

Petersbpus

  • Full Member
  • ***
  • Posts: 111
    • View Profile
Re: automatic frequency control, revisited
« Reply #7 on: October 24, 2008, 10:22:07 PM »
cujet,
My point exactly! HZ fulxuations to me, seem not as deal breaking as Voltage swings.
Once I stabalized the volts with an AVR, (as little as $165). It helped with flicker too, and my equipment with computer chips in control were more accepting. central AC, water heater with a brain, much much better. Power backups are going to be a problem, may need to run them separately off a small inverter.  I did have a severe case of screwed up (low) voltage on my ST head, I 'm sure they forgot to put in some of the wire turns. The rectifyer was a joke. All bypassed with AVR on the 1115.
For my lister project I just went with a brushless head, synthetic greased, unit with AVR installed, so far so good, I ain't relly got that far but made some power, and to the auto shutdown, fancy gizmo point of the project.
I'll try to run some more accurate tests this weekend.
Bob
 
Listeroid 6/1 in progress
Alllis Chalmers 60KW 3 ph
Changfaoid 12KW w/  auto shutdowns, modern AVR and panel
2nd Changfaoid 12KW Marine conversion w/ full auto shutdown and remote panel
Changfaoid 7.7 hp driving 5kw alternater /inverter,
other diesel gensets bought fixed and sold

mjn

  • Full Member
  • ***
  • Posts: 116
    • View Profile
    • My Changfa Generator Project
Re: automatic frequency control, revisited
« Reply #8 on: October 24, 2008, 11:12:08 PM »
Chris,

I have built exactly what you are thinking about.  It works fine.  My biggest mistake was to add too many bells and whistles.  I would have been better off with just controlling the frequency, I ended up with a system that does everything except feed the cat.  You can read the whole story here: http://martin.nile.googlepages.com/automaticgeneratorcontroller.

As Jens pointed out, the trickiest part of building a PID controller is tuning the gain variables.  Mine is not perfect,  There is room for improvement.  I stopped tweaking when I got it to hold the frequency close enough to keep my APC ups happy.  I'm doing this with a Changfa 195 running at 1800rpm.  I haven't tried this on my listeroid. I assume it would take longer for the PID controller to catch any frequency excursions.

Here is a graph that shows how my controller behaves versus the stock spring.



When I add a 5000 watt load, the stock governor (purple line) drops to 1700 rpm (56.6hz) within half a second.  The PID governor starts picking up at .4 seconds and has recovered to 1800 rpm by 3 seconds.

This graph shows the behavior when the load is removed.


The spring governor behaves nicely and the rpm's return to 1800 within about a second.  The PID controller overshoots the mark by 60rpm (62 hz) but eventually settles to around 1800rpm within 1.5 seconds.

For your reading enjoyment, here is my fixed point implementation of the PID controller.
Code: [Select]
/*******************************************************
 * pidcontroller -- calculate the adjustment to the stepper position
 *
 * based on emprical tests: Pc=20, Kc=280
 *
 * Ziegler-Nichols tuning: pgain=0.65 * Kc  = 182
 *                               Ti=0.5 * Pc = 10
 *                              Td=0.12 * Pc = 2.4
 *                         dgain= pgain*Td = 182*2.4=436
 *                         igain= pgain/Ti = 18 *4 = 72
  * All gain values are multiplied by 256 so we can do
 * the arithmetic in integers.  The result is divided by 256
 *
 ******************************************************/
int pidcontroller(void) {
int error;
long pterm; // proportional term.  The pterm is long because on startup
// the pterm has a very large error when multiplied by the pgain
// will exceed the size of a normal int.
int iterm; // integral term
int dterm; // derivative term

int temp;


#ifdef PIDTUNE
pgain=(getadc10(3)-8)*2; // pc3 (uco empty) is temporarily used as a pgain control
if(pgain < 0) pgain=0;
igain=getadc(4)-8; // pc4 (diesel empty) is used as igain control
if(igain < 0) igain = 0;
dgain=(getadc10(1)-8)*4; // pc1 (watertemp) is dgain control
if(dgain < 0) dgain = 0;
#endif


error=TARGETRPM-rpm;

// calculate the proportional portion
pterm=((long)error*pgain);


// calculate the integral portion
// If we are at the stepper limit, and still want to go higher,
// do not add any more to the integral
if(!(PINB & LIMITHI) && pterm > 0) {
temp=sumerror;
}
else {
temp = sumerror + error;
}

if(temp > 5000){ // limit the integral windup
temp=5000;
}
else if(temp < -5000){
  temp=-5000;
}

sumerror = temp;
iterm = (igain * sumerror)/32; // note!! /32 gives us more fractional resolution for the igain variable

// Calculate the derivative portion
dterm = dgain *  (rpm - lastrpm);
lastrpm = rpm;

temp = (pterm + iterm + dterm) / 256;

// if the adjustment is less than 2 steps, don't bother
if(abs(temp) < 2) {
temp=0;
}

#ifdef PIDTUNE
putstr("\r\n");
print4(rpm);
putch(' ');
print3(pgain);
putch(' ');
print3(igain);
putch(' ');
print3(dgain);
putch(' ');
print5(temp);
#endif
return(temp);
}


I have been kicking around the idea of building a minimal frequency controller without all of the bells and whistles of my generator controller.  I'm thinking of using an 8 pin MCU and the guts of an old 5 1/4" floppy drive to apply a bias to the stock governor spring.  Total out of pocket expense should be less than 10 bucks for the CPU and hall effect sensor to pick up rpm.  Everything else is sitting in my junk box.

My Listeroid has had all of the water drained and buttoned up for the winter, so I won't be able to do any testing until sometime next year.

--
Martin

Changfa 195 7.5 kw ST.  WVO conversion http://martin.nile.googlepages.com/
Metro 6/1 DI Listeroid. Pumping water for fire control.
1933 Stover CT-1 hit and miss
1936 Farmall F-12 -- unrestored, still used to mow the field

Petersbpus

  • Full Member
  • ***
  • Posts: 111
    • View Profile
Re: automatic frequency control, revisited
« Reply #9 on: October 25, 2008, 04:34:34 PM »
What is happening to the voltage during these rpm changes?
Listeroid 6/1 in progress
Alllis Chalmers 60KW 3 ph
Changfaoid 12KW w/  auto shutdowns, modern AVR and panel
2nd Changfaoid 12KW Marine conversion w/ full auto shutdown and remote panel
Changfaoid 7.7 hp driving 5kw alternater /inverter,
other diesel gensets bought fixed and sold

cujet

  • Hero Member
  • *****
  • Posts: 957
  • Lister power rules!
    • View Profile
    • www.cujet.com
Re: automatic frequency control, revisited
« Reply #10 on: October 25, 2008, 11:21:11 PM »
MJN, I took the time to look at your data and the website. Very impressive. It is exceedingly complex, I'll bet that took some time. While I would love to control every aspect of my Listeroid, I want to start with a simple RPM control scheme that manages to hold 60HZ.

Do you have any interest in providing a unit like this for the group here? I would guess that there would be a few takers. I would be interested in purchasing one if the price was right. Obviously, I can build this type of thing myself, but if someone else has already worked out the bugs, well then......

I don't need a 100% "ready to go" product. However, having the basics, like the proper actuator, some instructions and the processor/power supply would be a great start. Let me know if you have any interest in producing the basics.

Thanks a lot for taking the time to post all the information.


Chris
People who count on their fingers should maintain a discreet silence

oliver90owner

  • Hero Member
  • *****
  • Posts: 861
    • View Profile
Re: automatic frequency control, revisited
« Reply #11 on: October 26, 2008, 07:36:51 AM »
IF I were to want something like this I would steal a cruise control from a scrap car and have a go.  There must be something cheap out there to experiment with.

My other thought about this thread is whether Cujet is having trouble with Hz, V or just simply with a rubbish wave-form with too many harmonics popping up at every sinewave cycle.

I'M NOT, so an inverter for the touchy loads might be an easier way to go for me with a suitable battery bank (always good for back-up power in small amounts) and lose the small amount of efficiency in changing A/C to dc and in the inverter. 

Of course pure sine wave inverters (big enough to run a 50% efficiency microwave) are expensive and one might better be served with a small conduction/convection oven and just have to wait a little longer for the meal to heat up.

Regards, RAB

Regards, RAB

cujet

  • Hero Member
  • *****
  • Posts: 957
  • Lister power rules!
    • View Profile
    • www.cujet.com
Re: automatic frequency control, revisited
« Reply #12 on: October 27, 2008, 12:49:28 AM »
My other thought about this thread is whether Cujet is having trouble with Hz, V or just simply with a rubbish wave-form with too many harmonics popping up at every sinewave cycle.

The problem seems to be a combo of all 3. There is no single "issue" that is the solution.

The sine wave can be slightly modified by a filter cap. I plan on doing this last.

The Freq swings are more than I would like.

The Freq swings also affect the voltage, even with AVR.


So, the first step is to maintain proper RPM, which I now do by running outside and tweaking the knob. The second step is to get the AVR 100% functional, but I cannot do this until the generator head is at the proper speed. I hate seeing 56HZ and 93 volts when the AC is running, as the AC eventually figures out that the voltage/freq is too low and shuts off, if I don't run outside and tweek the RPM back up.
People who count on their fingers should maintain a discreet silence

compig

  • Hero Member
  • *****
  • Posts: 1264
  • 1953 Lister CS 6/1 SOM owner
    • View Profile
Re: automatic frequency control, revisited
« Reply #13 on: October 27, 2008, 09:43:28 AM »
MJN , I like that system !! The irony that occurs to me is the sheer complexity of electronics required to exceed the function of a coil spring !!

JUst a thought , how about a linear actuator instead of a stepper motor ?
DON'T STEAL , THE GOVERNMENT DOESN'T LIKE COMPETITION !!!
Lister A
Onan W3S Genny
Petter A1
Villiers C45 industrial
Continental flat six powerpacket
ANOTHER Lister 6/1 CS SOM , temporarily !!!

mjn

  • Full Member
  • ***
  • Posts: 116
    • View Profile
    • My Changfa Generator Project
Re: automatic frequency control, revisited
« Reply #14 on: October 27, 2008, 04:59:58 PM »
Do you have any interest in providing a unit like this for the group here? I would guess that there would be a few takers. I would be interested in purchasing one if the price was right. Obviously, I can build this type of thing myself, but if someone else has already worked out the bugs, well then......

I can't promise to have one working very soon.  I expect that this will be my project this winter.  Unfortunately, I won't be able to test it on my listeroid until after the last freezing temperatures next spring. When I get it working, I'd be glad to provide schematics and source code. 

MJN , I like that system !! The irony that occurs to me is the sheer complexity of electronics required to exceed the function of a coil spring !!

JUst a thought , how about a linear actuator instead of a stepper motor ?
Yeah, it seems like overkill having a 16mhz cpu just to do the function of a simple spring.  The spring is in reality a "P" (proportional) controller.  It would be a real trick to add the "I" (integral) and "D" (Derivative) functions with a purely mechanical solution.

The linear actuator was one of my options when I was working on my design.   I ran into a good deal on my stepper motor assembly, so that helped set the design.   Also, I already had the correct MOSFETs for driving a unipolar stepper.  I would have had to buy more stuff to build the H-Bridge necessary for a linear actuator.  Personally, I like the accuracy of a stepper motor.  The additional code needed to drive a stepper motor was not that bad.

What is happening to the voltage during these rpm changes?
I don't have the exact voltages, but from experience I would estimate that the low end, the voltage would be around 115 volts for about a second, and would peak at 125 for half a second or so.  An AVR would probably keep these under control.

--
Martin
Changfa 195 7.5 kw ST.  WVO conversion http://martin.nile.googlepages.com/
Metro 6/1 DI Listeroid. Pumping water for fire control.
1933 Stover CT-1 hit and miss
1936 Farmall F-12 -- unrestored, still used to mow the field