AC regulator for the 5kw generator


More Photos

Source code

Generator Manuual in PDF form

ODU engineering school project report

ODU engineering school project video

last updated 12/11/07


Background

I recently bought a surplus military 5kw gas generator. The military rates the machine at 5kw under extreme conditions (5000 ft, 32 degrees, .8 PF load etc.) so Home Depot would probably call it a 7500w machine. The engine works great, but the AC regulator is dead. The original regulator module takes one of the three phases from the AC output against neutral for its voltage reference and its power. The output of the regulator is a variable 0-24 ish volts DC drive for the stationary exciter field. The generator uses a rotating alternator/rectifier arrangement to generate a rotating field. The original regulator used a 1960's op-amp circuit and a Darlington power transistor pair to modulate the exciter field current. As best I can tell, the original circuit implemented a proportional and differential control. The setpoint input came from a 15ohm pot on the control panel.

After searching in vain for a replacement regulator module, I started thinking in terms of building my own. The first circuit I built was an analog deal that provided proportional control with an LM324 opamp. The AC output of the generator was stepped-down (10:1), full-wave rectified, resistor voltage-divided and low-pass filtered to produce a DC equivalent for comparison to a reference voltage. The difference voltage was then applied to the gate of an IRF540 to linearly modulate the DC drive current through the exciter field winding. The voltage reference was derived from a zener diode and divided through a pot.

The circuit basically worked, but had flaws that should be obvious the anyone who's eyes have not glazed-over yet:

  1. The low-pass AC-to-DC output sensing arrangement is not RMS, and it is inherently slow responding to sudden changes in generator output.
  2. The linear FET drive keeps the device in the high-heat region all the time.
The obvious answer to both problems is microprocessor-based control to do true RMS detection and switch-mode output control. My choice of processor brand was Microchip because I've done the most with them recently. However, Motorola would probably be easier to deal with because they tend to have a more reasonable instruction set. I chose the PIC16F88 processor for its fast 10-bit ADC and 10-bit PWM modules.


Hardware

I chose to use two separate transformers for power and line sampling. I probably could get away with just one, but the voltage-drop due to loading the power transformer would give a skewed measurement of the line voltage. The second transformer drives a full-wave rectifier that is grounded on the negative side and feeds a resistive voltage divider with it's positive side. The divider brings down the rectified AC to range that the ADC can deal with. I chose the divider ratio to yield 3.75 volts peak (3/4's of the ADC's 5-volt range) when the generator is operating at 120 VAC. Because of the negligible load on sampling transformer, it can have a very small VA rating (.08 VA).

One major issue with the whole system is that because the machine's exciter field is ultimately powered by the output of the generator, the generation process relies on the residual magnetic field to start. So the AC output "spools up" after the machine starts turning. If the machine has been sitting too long, that residual field tends to dissipate. In this case, the machine will run indefinitely at rated RPM with no AC output. The work-around for this issue on most generators is called "field flash". It's a momentary switch that applies system battery to the field winding. (this switch is visible on the upper-left side of the inside of the control panel) This self-powering issue gets more tricky when you bring a microcontroller-based system into the loop. Because there has to be stable power to run the processor that controls the field current, you end up with chicken-and-egg situation. My solution to this (which is probably a cop-out) was to use a normally-closed relay to bypass the control circuitry and apply power strait to the field until the processor boots up. I'm sure there is a more elegant way to do it.

Modulating the field current is done with a common-source FET. The rectified/filtered DC (around 24 volts) is connected to one side of the field winding and the other side connects to the FET's drain. (the bypass relay mentioned above is actually across the FET's drain/source.) Gate drive for the FET is done through a Texas Instruments TPS2814. I have had problems in the past driving an inductive load without a high-current gate driver.

I used the built-in USART on the PIC for communication with a PC serial port through a Maxim MAX232CPE. The PC is used mainly for tuning/diagnostic purposes. I implemented a simple command structure on the PIC to accept fixed frame-length messages (commands) from the PC.


Firmware

The RMS detection ended up being far more tricky than I anticipated. Early in the project, I was sampling the AC at a fixed rate that was chosen to give 32 samples per 60Hz line-cycle. However, the sampling was not phase-locked or frequency-locked to the AC line. This produced a very jittery result. The measured AC value had about 5% worth of random noise while sampling a clean power company-provided 120v source. I accomplished a phase/frequency locking mechanism by connecting a high-value (1Mohm) from the "high" side of the AC line to a port pin (Port B0). Clamping diodes are used to limit the input to a -.5 to 5.5 volt squarewave. The B0 port has edge-triggered interrupt service associated with it. This interrupt is used to begin/end the sample collection process. This interrupt service does several things:

During the line cycle, 12 samples are taken and each one is squared and added to the accumulated total for the cycle. On completion of the 12th sample, the sampling process is disabled and the accumulated value is divided by 12 and then square-rooted. The sampling process restarts on the next rising edge of the line (interrupt). The net result is an RMS measurement for every line cycle (60/second). All math is done in signed 32-bit. I used a suite of 32-bit math routines that I found here.


Software

I wrote a simple Visual Basic application for convenient testing and monitoring of what the regulator is doing. It was faster to implement a light-weight command set on the PIC and PC than trying to LCD/buttons interface. Ultimately I plan to design a removable, modular attachment with LCD and buttons for tweaking the setpoint and PID terms.