Almost all these options are defined via the SERC_config.h file. There are a few options contained in the main source code, ala to enable Debug or Testing mode. But by and large, once you edit the .h file you can maintain your configuration decisions with newer updates to the source code. This Blog post will cover how to configure a system, and is done using source v0.1.6 - and a final note: Though examples are shown here, often the formatting is off, or odd. The actual source code and .h file can be a bit easier to follow, and also include many additional comments on how to set these parameters and what they mean.
Step 1: Gather information:We need to know details about your battery, alternator, and engine. Specifically find the following details:
- Battery capacity and charge profiles. Check the 'resources' tab above for a collection of specs from different manufactures (and send me new ones if you have them). We want to know recharge profiles, limits and exit criteria: Volts, Amps as well as adjustments and charging limits due to temperature.
- Engine Capabilities: Speed / HP table being most critical.
- Alternator capacity - You can specify a lower number of Amps then the 'label' if you are concerned about burning out a small alternator by overloading it.
- Drive ratio and Alternator polls: Side of engine and alternator pulley as well as # of poles in the alternator (Used to calibrate RPM measurement)
- Addresses for your DS18B20 temperature probes. (Click on the Installation tab above and scroll down to the 'Temperature Sensing' section)
For this example, we have a system as follows:
- Kubota EA-300 engine driving an xxx alternator
- Engine is new, we need to break it in.
- Will at some time include a Watermaker
- Batteries consist of 3x Daka 8A8D (245Ah) AGM batteries in parallel
- Pulley ratios are: 7.0" and 2.6", alternator has 14 poles.
Bulk = Max 30% of c/20 rate (73.5A per battery -> 220A the 3 battery system)
Max Volts = Absorption
Absorption = 2.35-2.40 vpc (14.10 - 14.40v)
Max time: 12hr
Exit Amps: <0.10A change over 1hr period.
Float = 2.24 - 2.26vpc (13.44 - 13.56v)
Equalization: 2.40 - 2.43vpc (14.40 - 14.60v)
Max time 12hr
Exit Amps < 0.10A per Ah
Temp Co = -3mv/cell/C (-10mV/f for 12v) - centered on 25c/77f nominal
Cap limit adder at 35c(95f) and 15c(59f)
Step 2: Edit 'SERC_config.h' file:The configuration file is grouped...
Modules to Include and Hardware Options#defines will control switches in the source to code to include and exclude different modules. Care should be taken here as some modules re-purpose controller ports, ala the Watermaker, Co-Gen and Engine Temperature Control modules all can make use to the W-Mkr port on the controller board.
Remove the '//' in front of the modules you wish to include (commenting them), adding // to modules you do not wish. (This same method is used in the main source to enable/disable debug and testing modes)
Review and select which modules to include
Next make sure the hardware selections match the revision and configuration of your boards. There are only a few common options, and the source code has some more details (like resister divider ratios if you change them from the recommended values)
Review and select hardware options matching your controller board.
No changes here as this is for the latest board design.
Critical Faults and LimitsMany ports in your system can be monitored. Temperatures (engine, Battery, Alt, cooling water), voltages, amps to name a few. Often actions are taken to adjust the running the the generator based on these values, for example - battery target voltages are often adjusted based on the battery temperature. But if things really get out of hand we just want to stop everything. That is what this section is for. it defines critical values and limits that if exceeded will shut things down. These checks are done in a dedicated function, independent of the normal runtime code.
You might want to adjust some of these parameters after the system has ran a while.
Review and adjust critical limits if desired.
Here I only changed the Fault_bat_volts from 16.8 to 14.9v. Because AGM batteries are being used. I calculated the 14.9v based on the max allowable change for temperature compensation around the max 'equalize' voltage allowed. Remember, this value it to catch things that have gone very very wrong - meaning the core code has failed. The fault voltage will be checked against both the INA226 measurement, as well as an additional raw Atmel A/D reading as a dbl check.
If the system does not use sea water cooling, I do not need to worry about the checks for Sea Water Pump, or Exhaust Mixer, as if no temperature sender is installed those checks will by bypassed.
System Tuning ParametersThe next section likely will not need to be changed. It defined timings used to manage the engine, example: How long should we 'jab' the throttle control motor each time we want to make a speed adjustment, and how long should we wait to see the results of that 'jab'. Other timings like how long we stay at idle before starting to ramp up RPMs after starting, how long to crank the starter and how many times to try it...
Review and adjust as needed for different engines. Best to fine-tune these after system is running a while
As these parameters are already adjusted for the Kubota EA-300, I made changes here.
System Running ParametersThis is where we enter the capabilities of the system. The engine speed/HP data, alternator size (Under specifying it if we want to limit the amount of heat the alternator has to put up with). We also define the max system capabilities in terms of watts - this should match the capability of your engine to keep it from being overloaded, while at the same time making sure we get the work out of it it is capable of.
These values (combined with the battery charge profiles) are the core of the system - take time to review these and adjust them. After running a while, look at the debug data and make adjustments to these values. When setting up my system, I worked to get the Watts / Speed / HP limits close, but a little high. Then I let the EGT probe measure load on the engine and reduce things in real time. In this way the controller can adjust as needed depending on changing conditions such as air temperature, cooling water, etc. Get these values close - or low, and then adjust them up as you gain experience with your system.
Adjusted as needed, and fine tune when system is operating.
As this values are already set for a Kubota EA-300 system I made no changes. For the initial running the 'break-in' mode is selected, so we will be running with a light load (half power) anyway. Once break-in is finished we can see how these values fit the system. One parameter of particular interest is the Alternator_size; we might want to set this at either 220A to match the max current allowed for our 3x batteries, or perhaps set it for a slightly smaller size then the alternator specifications if we are worried about overworking the alternator (ala, using a small-frame alternator). Another parameter of interest is the Alt_watts)_setpoint: Here we can are the Alternator_size and Alt_watts_setpoint. It, combined with the HP/RPM table defines the load that will be placed on the engine.
Battery Charge ProfileThis is the other key area of configuration - battery information. You have the option of configuring a standard 3-step profile (Bulk, Acceptance, Float) or 4-step (adding Overcharge step) for your system. Each phase has parameters to set voltage limits, time limits, and exit criteria. Here is also where you can select auto-stop; stopping the generator instead of remaining in Float mode.
Note that because the controller measures Amps we have the ability to more closely follow manufactures recommended charge profiles. Specifically, we can measure the current being accepted by the battery and use that to decide when to terminate the Acceptance phase - doing so when the battery is truly full. As opposed to using a time limit / guess. Even so it is a good idea to always define time limits, just in case - but make them long and let the Amps to the work!
Note there is no equalize phase parameters, maybe I will add them in the future. For now to equalize perhaps make up a different include file and re-flash the firmware - restoring things once the equalize task is finished.
Adjust to fit your battery manufactured profile
I made a lot of changes here. The default values were selected around a large (1,800 Ah) 12v FLA battery, while this is a 12v AGM battery - we need to be very very careful with voltages.
Referring to the Deka specs, it targets 14.1 to 14.4v as the acceptance voltage. I selected 14.3, towards the higher end of the range for faster recharging, but a bit lower than Max to take it a little easier on the batteries. Remember, a battery will recharge fully even at rather low voltages, it just takes longer. I put in the 12h max time for acceptance as recommended, but when it came to exit Amps I had to make a decision.
Deka is one of the very few (if any) manufactures who specific their Acceptance exit criteria as a low rate-of-change in amps, as opposed to a % of capacity in absolute amps. Currently rate-of-change is not a coded in for an exit criteria (I may add it later); so I instead looked at other AGM batteries and noted their exit amps % used ranged from 0.1% of AH capacity to 0.6%, or in the case of this 735Ah battery bank - until the acceptance amps drops to a range of under 1 amp to almost 5A. I selected the higher end of this range, and added in an extra 5A to account for some amount of background house loads and selected 10A as the value to use for exiting Acceptance. As you define your exit criteria, do consider what, if any, baseline house loads might be present while generating - as the DC generator will be supporting (and measuring) the current needed to not only recharge the battery, but also support those house loads.
These values are ones that can be adjusted to meet your total system needs and desire of how to run it. Want to recharge things faster? Increase the Acceptance Voltage limit. Want to increase battery life? Lower it. OK with using the Generator to recharge to say the 90% point, and perhaps let Solar cells do the rest? Raise the Exit Amps to say 25A. Want to make sure the battery is 100% recharged each and every time? Set it for 1A. Lots of flexibility here.
Temperature limits also need to be edited to match the battery manufactures guidance. The default values are OK for most all lead-acid based batteries, but if you are using say LiFePO4 batteries typically you would set the 1F_comp to 0, and adjust the min and max charge temperatures to protect the batteries. Take special note of the Min charge temp - some LiFePO4 batteries specify 0c (32f) as the lower limit for charging batteries...
Included Modules ParametersHere some customization of optional include modules are defined. Auto-gen startup, watermaker, etc. In the future this section may expand. Example, adding black-out time periods for the Auto-gen..
Review and adjust as needed
As none of these modules are currently being used, I made no changes here.
System Configuration ParametersFinally we have a grouping of system configurations to adjust. Things like the AMP shunt ratio, the address of the DS1820 temperature senders, even our 'welcome' splash on the LCD and any back light timeout we want to use.
Review and adjust as needed, esp: Amp shunt ratio and DS18B20 temperature probe addresses
Here I changed the Amp Shunt ratio to match what is being used. I also set the calibration factor to 100%, after running we can calibrate it against an accurate meter if we want. I have found the Amp Shunts are very poor in calibration - having at times as much as a 5-10% error.. Measure your system near the point that matters most, ala around 25A or so to center the calibration for use by the Acceptance Exit Amps. Notice how I entered 0x00's for the address of probes not used, like the 2nd alternator temperature sensor. This will disable any actions taken by the code around that probe, including fault checking.
That is it! Save your new configuration file. Copy it to the Arduino sketch folder in the same sub-directory as the controller code - overwriting the default config file. As new revisions to the source come out there may be some additional parameters added to this config.h file, if so just copy out the new default definitions into your customized file and adjust as appropriate