Skip to content

Commit

Permalink
Add documentation to ChargingState
Browse files Browse the repository at this point in the history
  • Loading branch information
mvysny committed Oct 3, 2022
1 parent 5de8ae5 commit 1c342d1
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 7 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,15 @@ It's directly compatible with the "number input" timestamp of the [sqlite Grafan
Values for the `ChargingState` column:
* 0 = ChargingDeactivated
* 1 = ChargingActivated
* 2 = MpptChargingMode
* 3 = EqualizingChargingMode
* 4 = BoostChargingMode
* 5 = FloatingChargingMode
* 6 = CurrentLimiting (overpower)
| Value | Constant | Meaning |
|-------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 0 | ChargingDeactivated | Charging is deactivated. There is no current/voltage detected from the solar panels. This happens when it's night outside, or the solar array is disconnected: either the fuse tripped, or perhaps the cables are broken. |
| 1 | ChargingActivated | ? |
| 2 | MpptChargingMode | Bulk Charging. This algorithm is used for day to day charging. It uses 100% of available solar power to recharge the battery and is equivalent to constant current. In this stage the battery voltage has not yet reached constant voltage (Equalize or Boost), the controller operates in constant current mode, delivering its maximum current to the batteries (MPPT Charging). Also called Bulk Charging. |
| 3 | EqualizingChargingMode | Equalization: Is carried out every 28 days of the month. It is intentional overcharging of the battery for a controlled period of time. Certain types of batteries benefit from periodic equalizing charge, which can stir the electrolyte, balance battery voltage and complete chemical reaction. Equalizing charge increases the battery voltage, higher than the standard complement voltage, which gasifies the battery electrolyte. Should not be used for AGM batteries. |
| 4 | BoostChargingMode | Constant Charging Mode. When the battery reaches the constant voltage set point, the controller will start to operate in constant charging mode, where it is no longer MPPT charging. The current will drop gradually. This has two stages, equalize and boost and they are not carried out constantly in a full charge process to avoid too much gas precipitation or overheating of the battery. See EqualizingChargingMode for more details. Boost stage maintains a charge for 2 hours by default. The user can adjust the constant time and preset value of boost per their demand. |
| 5 | FloatingChargingMode | After the constant voltage stage (BoostChargingMode/EqualizingChargingMode), the controller will reduce the battery voltage to a float voltage set point. Once the battery is fully charged, there will be no more chemical reactions and all the charge current would turn into heat or gas. Because of this, the charge controller will reduce the voltage charge to smaller quantity, while lightly charging the battery. The purpose for this is to offset the power consumption while maintaining a full battery storage capacity. In the event that a load drawn from the battery exceeds the charge current, the controller will no longer be able to maintain the battery to a Float set point and the controller will end the float charge stage and refer back to bulk charging (MpptChargingMode). |
| 6 | CurrentLimiting | Overpower |
Use the [Sqlite Grafana plugin](https://grafana.com/grafana/plugins/frser-sqlite-datasource/)
to allow Grafana to read the Sqlite database.
Expand Down
44 changes: 44 additions & 0 deletions src/nativeMain/kotlin/RenogyClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,55 @@ data class RenogyStatus(
)

enum class ChargingState(val value: UByte) {
/**
* Charging is deactivated. There is no current/voltage detected from the solar panels.
* This happens when it's night outside, or the solar array is disconnected:
* either the fuse tripped, or perhaps the cables are broken.
*/
ChargingDeactivated(0.toUByte()),
ChargingActivated(1.toUByte()),

/**
* Bulk Charging. This algorithm is used for day to day charging. It uses 100% of available solar
* power to recharge the battery and is equivalent to constant current. In this stage the battery
* voltage has not yet reached constant voltage (Equalize or Boost), the controller operates in
* constant current mode, delivering its maximum current to the batteries (MPPT Charging).
*/
MpptChargingMode(2.toUByte()),

/**
* Equalization: Is carried out every 28 days of the month. It is intentional overcharging of
* the battery for a controlled period of time. Certain types of batteries benefit from periodic
* equalizing charge, which can stir the electrolyte, balance battery voltage and complete
* chemical reaction. Equalizing charge increases the battery voltage, higher than the standard
* complement voltage, which gasifies the battery electrolyte.
*
* Should not be used for AGM batteries.
*/
EqualizingChargingMode(3.toUByte()),

/**
* Constant Charging Mode. When the battery reaches the constant voltage set point, the controller
* will start to operate in constant charging mode, where it is no longer MPPT charging. The current
* will drop gradually. This has two stages, equalize and boost and they are not carried out
* constantly in a full charge process to avoid too much gas precipitation or overheating of the
* battery. See [EqualizingChargingMode] for more details.
*
* Boost stage maintains a charge for 2 hours by default. The user
* can adjust the constant time and preset value of boost per their demand.
*/
BoostChargingMode(4.toUByte()),

/**
* After the constant voltage stage ([BoostChargingMode]/[EqualizingChargingMode]), the controller will reduce the battery voltage
* to a float voltage set point. Once the battery is fully charged, there will be no more chemical
* reactions and all the charge current would turn into heat or gas. Because of this,
* the charge controller will reduce the voltage charge to smaller quantity, while lightly charging
* the battery. The purpose for this is to offset the power consumption while maintaining a full
* battery storage capacity. In the event that a load drawn from the battery exceeds the charge
* current, the controller will no longer be able to maintain the battery to a Float set point and the
* controller will end the float charge stage and refer back to bulk charging ([MpptChargingMode]).
*/
FloatingChargingMode(5.toUByte()),
/**
* Current limiting (overpower)
Expand Down

0 comments on commit 1c342d1

Please sign in to comment.