Another Engine Control and Regulator project - DC Alternator

Started by thomasonw, October 29, 2012, 01:10:35 PM

Previous topic - Next topic

thomasonw

So, the INA-220's are able to do a spot 12-bit sample every 600uS or so.  Currently in the DC regulators i am asking it to average 32 of these samples over a 17mS time frame before sending the results back to the CPU.  This is to largely smooth out noise on the DC battery.   And I needed the 12-bit resolution in order to get sufficient significant bits for the tight DC voltage regulations (+/- 75mV) without doing all sorts of pre-scaling / level shifting magic.    In moving to an AC sample, I am wondering if all of this is an overkill.

Perhaps just doing sampling using the built-in Atmel 10-bit A/D and feed it into an RMS formula would be sufficient?  The Atmel A/D takes up to 260uS per conversion, and can be triggered by a fixed speed timer.  Could set up to doing a conversions every 500uS as you suggest.  Detecting zero-crossing would allow for an RMS calculation on each 1/2 wave form, and then a post 'average' of several (6 or so?) of the half-waveform RMS calculations to filter out noise???    Zero-crossing would also be a way to monitor frequency which could then be used to make small adjustments to the throttle/governor control motor...

And am not really seeing how the Amps measurement could be helpful, given there is no real way to 'regulate' Amps.  About the only thing I could see  monitoring Amps for fault detection, or to tack number of VA (or KW) produced over time...






BruceM

You're right, Thomasonw, 10 bit would do it.  I'd put a bit of low pass LC filtering on the AC after rectifying and scaling to filter out high frequency spikes, but your software approach is equally valid, but not as effective for high frequency transients, and potentially slow. And active analog (op amp)  filter would also be effective, and might be more compact.  The software approach has the big advantage of no filtering inductors and capacitors.






thomasonw

On the DC controller I sample the Amps draw of the starter (via the same shunt used to measure Alternator output) in order to decide when the engine has 'taken up' and started.

It works steller.

I am wondering for an AC generator controller what other, reliable, ways there might be to sence the engine has indeed started - and turn off the starter / glow-plug.  What are some of the ways others have used in the past???

-al-

BruceM

The generator mains AC frequency (at well below normal voltage) could be a reliable start indicator.

thomasonw

Quote from: BruceM on June 29, 2013, 06:02:21 AM
The generator mains AC frequency (at well below normal voltage) could be a reliable start indicator.

Sounds good.  Over my 'break' I researched a bit on existing RMS measurements using the Arduino / Amtel CPU.  There are many examples out there, the more appropriate ones using direct Amtel register manipulation vs. the higher overhead Arduino library calls.   Seems that one could also add a current probe and come up with figures of power factor, THD, etc...

Perhaps the fall, once I get the stand alone regulator completed - and any issues with the integrated controller as I start using the water maker this summer, I can look at an AC generator version of this project.   But still will need someone to help me, as I do not have an AC generator to play with  ;D   So, if there is someone who might be interested in this, and has a bit of tech knowledge, drop me a line....

-al-

thomasonw

#140
OK,

Getting back to the real project at hand, the DC generator controller which integrates engine control (starting, stopping, throttle speed management) with a  smart DC alternator regulator (which manages Amps as well as Volts).   As a 'Generator' we have  100+ hours on it now, and it is working very well.   The past week or so I have been exercising another capability of my Kubota DC generator - the Reverse Osmosis Seawater to Fresh Water-maker.

There is very little automation in the Water-maker part of this, all valves and pressure adjustments are done by hand.  But the controller does need to engage and disengage the high pressure pump clutch, and at the same time reduce the output of the Alternator to account for 2-3hp being used to power the high pressure pump.   I have been working out a few bugs in the code (mostly around transitions to and from pure generator to co-gen/watermaker), and am getting it close to having it nailed down.   At the same time I have been taking advantage of the 2nd MAJOR goal of this whole project:  being able to generator DC power WHILE also powering the high pressure watermaker pump.   Prior when using commercial regulators, there was insufficient flexibility to reduce the Alternator load so I had to turn it off.  It was a DC generator -OR-  a Watermaker.  But now, I can manage the loads more closely and am able to make around 40GPH of fresh water from the Seawater, AND deliver 50A into the batteries - at the same time.  This is turning out to be a really nice feature  - reducing overall run time and keeping my batteries much happier (nearly fully charged) in the process.

I am going to give it a couple more weeks of 'testing', and then will post the revised firmware to the blog.  I am also working on small expansion board that will monitor the pre-filters and the RO membrane pressures, sounding an alarm as they approach out of range conditions, and shutting things down when they get out of tolerance.  The pre-filters are filling up with green algae in about 2 hours of run time, and I need to watch the setting every 10-15 minutes as we had one run that went wildly out of bounds. So even if I do not do watermaker automation, I do want the controller to monitor critical pressures to protect the expensive high pressure pump as well as the RO membranes.  (and in true a Micro co-gen spirit, I added a driver port to turn on a DC pump when the engine temp goes over a set temp, to route some engine heat into the domestic hot water tank to boot!)

-al-


thomasonw

Today I posted v0.1.2 of the controller source (See link in Blog:  http://smartdcgenerator.blogspot.com/).  This resolved a few small errors (ala, the next key would not only restore backlighting on the LCD but also advance to the next screen, as opposed to only restoring backlighting), improved OneWire handling (Still think there is more to do there…), but mostly this version has been exercised using the Watermaker in conjunction with the ‘generator’. 

The capability of producing some Amps while also driving the watermaker high pressure pump was the 2nd major goal for this project.   Commercial regulators did not give me sufficient control and previously I would turn off the alternator when making water.   Now I can get 800w (50+ amps) into the batteries WHILE also running the reverse osmosis watermaker.


At this point I consider this project largely completed.   Over the next months I will continue to correct any small bugs I find, but for the core of the project it is completed.   As next steps I see three potential opportunities:

  • Add the ability to monitor critical Watermaker pressures (boost pump and High pressure pump), issuing warning when they are getting out of range, and faulting then they cross the line.
  • Rollback hardware / software learning’s from the stand-alone alternator regulator projected.  E.g., the improved FET driver ckt, etc..
  • Enhanced the User interface on the LCD display.  Now that it is based on its own Atmel CPU, I can add a binary communication protocol and do things like provide the ability to select ‘Quite Mode’ at startup for the generator (ala, starting it up, but limiting the RPMS, and of course Amps , to keep things at a nice quite noise level), or perhaps a gateway into NMEA-2000?   Who knows?

Overall I think the 1st item is critical - I currently need to watch the watermaker settings every 15-20 minutes or so to make sure they do not drift out of allowable settings when the pre-filters clog up and / or the system changes as temperatures change.   I am debating to use a simple pre-existing China I2C A/D board with some jumper wires, or to do up a small 'expansion board' that will have a bit more functionality and also better physical mounting.   But this is all a Fall project as I do not have access to mail-drops until we return to a port somewhere for the winter.

And I still have one board set left, if anyone is interested.  Thanks again to all who have helped with this project, and to those building up aboard set – looking forward to hearing about your results!

-al-

BruceM

Hi Thomasonw,
Congrats on the dual mode operation.  That should be more fuel efficient and cut down on engine run time nicely. I remember this was an important goal for this project.

I know that however you add you new A/D capability for the critical water maker monitoring, that it will be done as nicely and professionally as the rest of the project.  Your work impresses!

Well done!

BruceM

thomasonw

Today I posted v0.1.3 of the source code for the DC generator engine controller and alternator regulator.  It includes some bug fixes, a couple of new modes of operation, and a bit of work around management of temperate limits (chiefly the EGT) as well as dedicated load-dump detection.

One of the biggest changes is the addition of dedicated load-dump detection code - being more aggressive in reducing the field-drive in response to larger overvoltage situations and also looking at the voltage rate of change (dV/dT) to try and prevent them in the 1st place.  I found while debugging the stand-alone regulator that the PID logic was OK constraining smaller alternators, but could not reign in the 270A alternator on the main engine of Viking Star fast enough in response to some load-dump conditions.  At times it would overshoot the target voltage by 450mV (almost 1/2 a volt!) when say the dryer heater turned off and the battery was almost fully charged.  With the improvements I now cap load-dump overshoot to 35mV.

The other big change was looking at situations where the generator approached its running temperature limits (EGT, Engine coolant, and/or Alternator temperature).  The existing PIDs would pull things back once those limits were reached, but then the same conditions as before would again drive the system back over the line.  This was most noticeable with EGT - as I am trying to run the engine at its max continuous load to reduce total generator run time.   New code now will self-learn from any temperate limits and self-adjust to reduce the maximum load placed on the engine - preventing crossing the line again.  This self learning and adjusting is done every time the system is started as I noticed that things like sea water and air temperature had a noticeable impact on what load the engine could truly drive before reaching its target EGT.

I also added in two new modes of operation:  Quiet Mode which will limit the RPMs to a defined max, thereby running the generation in a more civilized (and quiet) way.  I also added a mode to use after changing engine oil - Prime Oil.  In this mode the starter is enabled, but not the fuel, and I watch for the engine oil pressure to come up.  This is, btw, what the Cummins Operations manual suggests to do after changing oil (or leaving the engine sit for 2 weeks or more).  It was an easy edit to modify the existing Start-Engine code.

We have several hundred hours running now and am still very happy with its performance.  See http://smartdcgenerator.blogspot.com/2013/10/v013-of-source-code-posted.html   for more details on the changes and for a link to the source.

-al-




BruceM

I like your new quiet mode, and all the other refinements.  It's one sweet system.

The beauty of a roll-your-own is that you can get the operational characteristics exactly right for you needs...even when those needs evolve.

thomasonw

Thanks Bruce.  Yes, this has been a fun project, and always tempting to do the SMOP (See http://en.wikipedia.org/wiki/Small_matter_of_programming) with extra 'features'.  I still have stubbed in quiet-time blackout periods for the auto-generator startup mode, but have not flushed them out..

And now that we have a summer of operation under our belts and interesting usage pattern has developed.   Perhaps the key goal of this project was to reduce generator run time by manage the amount of power delivered to match the capability of the driving engine at each point in the charge cycle.  Regulating Watts to fill in the triangle I talked about it in earlier posts.  And the regulator does this very very well.  In fact, by monitoring the EGT it is able to self adjust to changing conditions of the engine and keep it at its max continuous load point.

Looking back over the summer what is interesting is our run-time per month increased as opposed to going down!!  I blame this on one simple thing:  Throttle Control.   When using my commercial 'smart' regulator I would run the generator until the battery acceptance rate dropped to say 60-70A, this equated to about the 85% recharge point for our FLA batteries.  I figured this was a good compromise vs. having to listen to the generator running while packing in those last few %'s of charge.   (It is very common for boaters to operate their batteries between the 50% and 80% charge points, balancing engine run time vs. battery life)

Well, with the active throttle control our usage pattern has totally changed.  Because the generator engine slows down under lighter loads (at that 60-70A charge point, it might have slowed down 1,000 RPMS), even to the point of almost idle speed when doing the final topping off, we now let the generator run topping off the battery.   Due to the slower engine speed it is much quieter, hardly distracting to us.  It will continue to top-off the batteries until the they are fully charged as indicated by the actual battery acceptance amps (vs. some pre-determined timeout).  I have it set up at 35A for our system - might be a little high truth be told.  Once exiting Acceptance Phase it is configured to automatically shut down (vs. continuing into Float mode).

So, what has changed is we tend to just let it run.  Bringing the batteries up to 98-100% recharge point each time.  With the throttle control the noise is not unacceptable, kind of like those Honda 2000 generators idling down under light load.  But more so, with the full instrumentation (over temp limits, cooling water flow, etc) I feel comfortable letting it run while we are off the boat.  A pattern we now have is to start the generator when we leave the boat for a few hours, knowing that when we return the batteries will be FULLY recharged, and the generator will have turned itself off.  And we tend to do a recharge cycle every couple of days as opposed to stretching it out to 4-5 days..  We now operate between 80-98% charge points vs. 50-85% points.

So ya - key goal was to reduce the total run time was not realized.  The hour meter shows it almost doubled vs. the year before.   Bit I think it is a good trade off as I am sure the batteries are MUCH happier being fully charged vs. the 80-85% point we did before.

So there - learnings from doing  ;)



ps: A bit of a delay in posting,  I tried to share my coffee with my laptop last week.   It did not like it - let out some of the Magic Smoke.  Think that might perhaps be because the coffee was Decaf??

-al-

BruceM

Hi Thomasonw,
It's sure handy to have auto shut down of a generator, I have that for my Listeroid; 10 minutes of no load shuts her down. Since I can't hear it, very important.  I have a special skill; I can forget anything in 5 minutes or less.

Next year you can implement the fuel saving mode at the expense of battery life.  :)

Thanks for sharing this great automation and control project!
Bruce




thomasonw

#147
All,

Quick note:  I have revised the DC generator controller + alternator regulator project and posted the design:  http://smartdcgenerator.blogspot.com/search/label/v0.3.x




There are two major changed:

  • Inclusion of learning from stand-along alternator regulator project - esp universal Field FETs 12v-48v, P or N type
  • Migration of most components to SMT parts

This last item allows much of the PCB to be machine assembled and reflowed, though the high power parts (ala FETs, etc) still need hand soldering.  Not only will this increase the solder quality of the SMT parts - by eliminating hand soldering (esp those oh-so-small INA226's), but by taking advantage of high volume production lines the costs are lower (am able to source the SMT assembled board + SMT components for about what just the blank PCB was costing).

All sets but one of this run is spoken for spoken for, if anyone is interested.  And if down the road there continues to be interest I may coordinate another group build.

-al-

focodiesel

(2) cummins 6bt 12valves
cummins 4bt
(4) Farymann 43f
(2) perkins 103.15
Isuzu c240
Jianghuai S1100AN
Danyang r170f
Yanclone 186fe
Yanclone 170fe