hif2k1 / battery_sim

Home assistant home battery simulator - allows you to model how much energy you would save with a home battery
124 stars 14 forks source link

Battery showing value of max_charge_rate when transiting between discharge/charging #95

Closed niggles1973 closed 11 months ago

niggles1973 commented 1 year ago

Hi,

Have the following battery_config which was working perfectly up until the latest version (about 9 days ago when I installed it)

in this version.- What happens is when the delta is Δ 9.000003046821803e-06 Wh** (aka a very small number) - the charge rate goes to 30kw momentarily

  {
    "entry_id": "a3caa9b076cc8b26ef13b4a924d1cc0c",
    "version": 1,
    "domain": "battery_sim",
    "title": "battery_sim: 65.0_kWh_battery",
    "data": {
      "size_kwh": 65.0,
      "max_discharge_rate_kw": 30.0,
      "max_charge_rate_kw": 30.0,
      "efficiency": 0.9,
      "setup_type": "config_flow",
      "name": "battery_sim: 65.0_kWh_battery",
      "type_of_energy_meter": "one_import_one_export",
      "tariff_type": "Sensors that track tariffs",
      "import_sensor": "sensor.grid_total_lifetime_import",
      "export_sensor": "sensor.grid_total_lifetime_export",
      "energy_import_tariff": "sensor.aurora_tariff_price",
      "energy_export_tariff": "sensor.aurora_tariff_price_export"
    },
    "options": {},
    "pref_disable_new_entities": false,
    "pref_disable_polling": false,
    "source": "user",
    "unique_id": "battery_sim: 65.0_kWh_battery",
    "disabled_by": null
  },

2023-09-16 07:34:06.378 DEBUG (SyncWorker_8) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.788454 Wh => 39728.79129 Wh = Δ 0.0028359999996609986 Wh 2023-09-16 07:34:06.378 DEBUG (SyncWorker_8) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.0) Export: (0.0028359999996609986) .... Timing: 1694813646.3787653 = Now / 1694813636.1520584 = Last Update / 10.226706981658936 Time (sec). 2023-09-16 07:34:06.378 DEBUG (SyncWorker_8) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:34:06.384 DEBUG (SyncWorker_8) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:34:16.444 DEBUG (SyncWorker_5) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.79129 Wh => 39728.794007 Wh = Δ 0.0027169999957550317 Wh 2023-09-16 07:34:16.445 DEBUG (SyncWorker_5) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.0) Export: (0.0027169999957550317) .... Timing: 1694813656.4450245 = Now / 1694813646.3787653 = Last Update / 10.066259145736694 Time (sec). 2023-09-16 07:34:16.445 DEBUG (SyncWorker_5) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:34:16.445 DEBUG (SyncWorker_5) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:34:26.492 DEBUG (SyncWorker_9) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.794007 Wh => 39728.796386 Wh = Δ 0.0023790000050212257 Wh 2023-09-16 07:34:26.493 DEBUG (SyncWorker_9) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.0) Export: (0.0023790000050212257) .... Timing: 1694813666.4930859 = Now / 1694813656.4450245 = Last Update / 10.04806137084961 Time (sec). 2023-09-16 07:34:26.493 DEBUG (SyncWorker_9) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:34:26.493 DEBUG (SyncWorker_9) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:34:36.387 DEBUG (SyncWorker_1) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.796386 Wh => 39728.799126000005 Wh = Δ 0.002740000003541354 Wh 2023-09-16 07:34:36.387 DEBUG (SyncWorker_1) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.0) Export: (0.002740000003541354) .... Timing: 1694813676.3872604 = Now / 1694813666.4930859 = Last Update / 9.894174575805664 Time (sec). 2023-09-16 07:34:36.387 DEBUG (SyncWorker_1) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:34:36.391 DEBUG (SyncWorker_1) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:34:46.427 DEBUG (SyncWorker_7) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.799126000005 Wh => 39728.801761 Wh = Δ 0.00263499999709893 Wh 2023-09-16 07:34:46.427 DEBUG (SyncWorker_7) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.0) Export: (0.00263499999709893) .... Timing: 1694813686.427597 = Now / 1694813676.3872604 = Last Update / 10.040336608886719 Time (sec). 2023-09-16 07:34:46.427 DEBUG (SyncWorker_7) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:34:46.428 DEBUG (SyncWorker_7) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:34:56.349 DEBUG (SyncWorker_6) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.801761 Wh => 39728.804695 Wh = Δ 0.0029339999964577146 Wh 2023-09-16 07:34:56.349 DEBUG (SyncWorker_6) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.0) Export: (0.0029339999964577146) .... Timing: 1694813696.3496993 = Now / 1694813686.427597 = Last Update / 9.922102212905884 Time (sec). 2023-09-16 07:34:56.349 DEBUG (SyncWorker_6) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:34:56.350 DEBUG (SyncWorker_6) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:35:06.603 DEBUG (SyncWorker_9) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.804695 Wh => 39728.80736200001 Wh = Δ 0.0026670000079320744 Wh 2023-09-16 07:35:06.603 DEBUG (SyncWorker_9) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.0) Export: (0.0026670000079320744) .... Timing: 1694813706.6033595 = Now / 1694813696.3496993 = Last Update / 10.253660202026367 Time (sec). 2023-09-16 07:35:06.603 DEBUG (SyncWorker_9) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:35:06.614 DEBUG (SyncWorker_9) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:35:16.518 DEBUG (SyncWorker_0) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.80736200001 Wh => 39728.81026 Wh = Δ 0.002897999991546385 Wh 2023-09-16 07:35:16.518 DEBUG (SyncWorker_0) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.0) Export: (0.002897999991546385) .... Timing: 1694813716.5186527 = Now / 1694813706.6033595 = Last Update / 9.915293216705322 Time (sec). 2023-09-16 07:35:16.518 DEBUG (SyncWorker_0) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:35:16.519 DEBUG (SyncWorker_0) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:35:26.352 DEBUG (SyncWorker_11) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.81026 Wh => 39728.812872 Wh = Δ 0.002612000003864523 Wh 2023-09-16 07:35:26.353 DEBUG (SyncWorker_11) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.0) Export: (0.002612000003864523) .... Timing: 1694813726.3532112 = Now / 1694813716.5186527 = Last Update / 9.834558486938477 Time (sec). 2023-09-16 07:35:26.353 DEBUG (SyncWorker_11) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:35:26.353 DEBUG (SyncWorker_11) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:35:36.411 DEBUG (SyncWorker_8) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.812872 Wh => 39728.815696000005 Wh = Δ 0.002824000002874527 Wh 2023-09-16 07:35:36.411 DEBUG (SyncWorker_8) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.0) Export: (0.002824000002874527) .... Timing: 1694813736.4115796 = Now / 1694813726.3532112 = Last Update / 10.058368444442749 Time (sec). 2023-09-16 07:35:36.411 DEBUG (SyncWorker_8) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:35:36.411 DEBUG (SyncWorker_8) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:35:46.346 DEBUG (SyncWorker_5) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.815696000005 Wh => 39728.818048 Wh = Δ 0.0023519999958807603 Wh 2023-09-16 07:35:46.346 DEBUG (SyncWorker_5) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.0) Export: (0.0023519999958807603) .... Timing: 1694813746.3464947 = Now / 1694813736.4115796 = Last Update / 9.93491506576538 Time (sec). 2023-09-16 07:35:46.346 DEBUG (SyncWorker_5) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:35:46.346 DEBUG (SyncWorker_5) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:35:57.001 DEBUG (SyncWorker_9) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_import True: 25774.821398 Wh => 25774.821407000003 Wh = Δ 9.000003046821803e-06 Wh 2023-09-16 07:35:57.001 DEBUG (SyncWorker_9) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (9.000003046821803e-06) Export: (0.0) .... Timing: 1694813757.0017343 = Now / 1694813746.3464947 = Last Update / 10.655239582061768 Time (sec). 2023-09-16 07:35:57.002 DEBUG (SyncWorker_9) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:35:57.008 DEBUG (SyncWorker_0) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.818048 Wh => 39728.820247 Wh = Δ 0.0021990000022924505 Wh 2023-09-16 07:35:57.008 DEBUG (SyncWorker_0) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.0) Export: (0.0021990000022924505) .... Timing: 1694813757.0087142 = Now / 1694813757.0017343 = Last Update / 0.006979942321777344 Time (sec). 2023-09-16 07:35:57.009 DEBUG (SyncWorker_0) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:35:57.009 DEBUG (SyncWorker_0) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:35:57.040 DEBUG (SyncWorker_9) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:36:06.411 DEBUG (SyncWorker_10) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_import True: 25774.821407000003 Wh => 25774.822034 Wh = Δ 0.0006269999976211693 Wh 2023-09-16 07:36:06.412 DEBUG (SyncWorker_10) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.0006269999976211693) Export: (0.0) .... Timing: 1694813766.4122815 = Now / 1694813757.0087142 = Last Update / 9.40356731414795 Time (sec). 2023-09-16 07:36:06.412 DEBUG (SyncWorker_10) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:36:06.412 DEBUG (SyncWorker_10) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:36:06.413 DEBUG (SyncWorker_7) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.820247 Wh => 39728.821232 Wh = Δ 0.0009849999987636693 Wh 2023-09-16 07:36:16.329 DEBUG (SyncWorker_5) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_import True: 25774.822034 Wh => 25774.823011 Wh = Δ 0.000976999999693362 Wh 2023-09-16 07:36:16.329 DEBUG (SyncWorker_5) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.000976999999693362) Export: (0.0009849999987636693) .... Timing: 1694813776.3295445 = Now / 1694813766.4122815 = Last Update / 9.91726303100586 Time (sec). 2023-09-16 07:36:16.329 DEBUG (SyncWorker_5) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:36:16.337 DEBUG (SyncWorker_5) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:36:16.338 DEBUG (SyncWorker_0) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.821232 Wh => 39728.822013 Wh = Δ 0.0007809999951859936 Wh 2023-09-16 07:36:26.355 DEBUG (SyncWorker_12) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_import True: 25774.823011 Wh => 25774.824421999998 Wh = Δ 0.001410999997460749 Wh 2023-09-16 07:36:26.356 DEBUG (SyncWorker_12) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.001410999997460749) Export: (0.0007809999951859936) .... Timing: 1694813786.35601 = Now / 1694813776.3295445 = Last Update / 10.02646541595459 Time (sec). 2023-09-16 07:36:26.356 DEBUG (SyncWorker_12) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:36:26.358 DEBUG (SyncWorker_12) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:36:26.358 DEBUG (SyncWorker_12) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.822013 Wh => 39728.822663000006 Wh = Δ 0.0006500000090454705 Wh 2023-09-16 07:36:36.445 DEBUG (SyncWorker_3) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_import True: 25774.824421999998 Wh => 25774.826071 Wh = Δ 0.001649000001634704 Wh 2023-09-16 07:36:36.445 DEBUG (SyncWorker_3) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.001649000001634704) Export: (0.0006500000090454705) .... Timing: 1694813796.445603 = Now / 1694813786.35601 = Last Update / 10.089592933654785 Time (sec). 2023-09-16 07:36:36.445 DEBUG (SyncWorker_3) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:36:36.446 DEBUG (SyncWorker_3) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:36:36.447 DEBUG (SyncWorker_10) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.822663000006 Wh => 39728.823179 Wh = Δ 0.0005159999927855097 Wh 2023-09-16 07:36:46.449 DEBUG (SyncWorker_6) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_import True: 25774.826071 Wh => 25774.827831000002 Wh = Δ 0.0017600000028323848 Wh 2023-09-16 07:36:46.449 DEBUG (SyncWorker_6) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.0017600000028323848) Export: (0.0005159999927855097) .... Timing: 1694813806.4499307 = Now / 1694813796.445603 = Last Update / 10.004327774047852 Time (sec). 2023-09-16 07:36:46.450 DEBUG (SyncWorker_6) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:36:46.454 DEBUG (SyncWorker_6) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:36:46.455 DEBUG (SyncWorker_6) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.823179 Wh => 39728.823545 Wh = Δ 0.0003660000002128072 Wh 2023-09-16 07:36:56.363 DEBUG (SyncWorker_2) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_import True: 25774.827831000002 Wh => 25774.829843 Wh = Δ 0.002011999997193925 Wh 2023-09-16 07:36:56.363 DEBUG (SyncWorker_2) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.002011999997193925) Export: (0.0003660000002128072) .... Timing: 1694813816.363223 = Now / 1694813806.4499307 = Last Update / 9.913292407989502 Time (sec). 2023-09-16 07:36:56.363 DEBUG (SyncWorker_2) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery normal mode. 2023-09-16 07:36:56.363 DEBUG (SyncWorker_2) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Battery update complete. 2023-09-16 07:36:56.364 DEBUG (SyncWorker_2) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_export False: 39728.823545 Wh => 39728.823813 Wh = Δ 0.0002680000034160912 Wh 2023-09-16 07:37:06.407 DEBUG (SyncWorker_11) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_import True: 25774.829843 Wh => 25774.832284000004 Wh = Δ 0.0024410000041825697 Wh 2023-09-16 07:37:06.408 DEBUG (SyncWorker_11) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) Import: (0.0024410000041825697) Export: (0.0002680000034160912) .... Timing: 1694813826.40805 = Now / 1694813816.363223 = Last Update / 10.044826984405518 Time (sec)

niggles1973 commented 1 year ago

Screenshot 2023-09-16 at 8 25 03 pm

niggles1973 commented 1 year ago

Screenshot 2023-09-16 at 8 41 48 pm Screenshot 2023-09-16 at 8 42 51 pm

niggles1973 commented 1 year ago

Screenshot 2023-09-17 at 7 49 50 am 10 day charge rate graph; should difference between previous charge rate and "something" changing.

hif2k1 commented 1 year ago

Thanks for getting all the debug info. So the battery is charging and discharging OK its just showing an incorrect charging rate (the maximum possible) is that right? I'll look into it.

On Sat, 16 Sept 2023, 22:53 niggles1973, @.***> wrote:

[image: Screenshot 2023-09-17 at 7 49 50 am] https://user-images.githubusercontent.com/95966990/268472806-de8e63e7-e8ca-412c-8bec-01ca0b3312a1.png 10 day charge rate graph; should difference between previous charge rate and "something" changing.

— Reply to this email directly, view it on GitHub https://github.com/hif2k1/battery_sim/issues/95#issuecomment-1722323704, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFAIZGKRU5SCSNAVMU2OZI3X2YNUJANCNFSM6AAAAAA42ZP75E . You are receiving this because you are subscribed to this thread.Message ID: @.***>

niggles1973 commented 1 year ago

yes, the house has 3 phase power; so some of the phases are exporting and some are importing when consumption and production are near evenly matched (not sure how are battery behaves in practice in that scenario). When all 3 phases are exporting all is good; ditto when all 3 phases are importing - during the transition between all phases importing or all phases exporting there is the momentarily spike to max charge rate (being 30kw for my battery sim - Powerplus Escape 30) - haven't been able to exactly pick the exact scenario apart from being around the time of this log entry

2023-09-16 07:35:57.001 DEBUG (SyncWorker_9) [custom_components.battery_sim] (battery_sim: 65.0_kWh_battery) sensor.grid_total_lifetime_import True: 25774.821398 Wh => 25774.821407000003 Wh = Δ 9.000003046821803e-06 Wh

as mentioned; noticed when I installed the latest version; and the 10 day graph shows the noticeable change in the charge rate behaviour. Actually I updated to 2023.9.0 from 2023.8.x around the same time (just to add another variable)

niggles1973 commented 1 year ago

Also, just to double check - Grid Total Lifetime Export is always increasing. anywhere where it looks a little suspect (for instance 8am September 15th) ; I "zoomed" in to a 1 hour view and confirmed that it always increasing.

image

niggles1973 commented 1 year ago

Sorry I just realised I didn’t specifically answer

So the battery is charging and discharging OK its just showing an incorrect charging rate (the maximum possible) is that right? I'll look into it.

yes; it’s charging and discharging as expected - it’s just the charge rate is wrong (momentarily goes to max charge rate) when there is what looks like charging and discharging during the same delta time period (I think)

hif2k1 commented 1 year ago

Sorry have been a bit snowed under. Will try and get on it asap.

On Sat, 23 Sept 2023 at 02:28, niggles1973 @.***> wrote:

Sorry I just realised I didn’t specifically answer

So the battery is charging and discharging OK its just showing an incorrect charging rate (the maximum possible) is that right? I'll look into it.

yes; it’s charging and discharging as expected - it’s just the charge rate is wrong (momentarily goes to max charge rate) when there is what looks like charging and discharging during the same delta time period (I think)

— Reply to this email directly, view it on GitHub https://github.com/hif2k1/battery_sim/issues/95#issuecomment-1732170715, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFAIZGN7H5DOHTWKOW27OVTX3Y3LTANCNFSM6AAAAAA42ZP75E . You are receiving this because you commented.Message ID: @.***>

hif2k1 commented 1 year ago

I think I have reproduced the problem in my install. The short answer is that it's a rounding problem.

The long answer: If you zoom right in on the import meter graph does it look something like this with some pattern of alternating small steps and big ones?

image

My meter updates every 10s and is rounded to 0.01kWh. It must be going up roughly 0.02kWh every 30s, but because of the rounding it does 0.01kWh after 10s and then nothing and then another 0.01kWh after 20s. The battery sees this as alternating fast/slow.

Does yours look similar when you zoom in? I can see that it is updating every 10 seconds as well.

The solution could be to update the battery less frequently - say once a minute and accumulate a minutes worth of readings before updating to average out these steps. This would make the battery less real time responsive, but possibly more accurate. Should we go for that do you think?

niggles1973 commented 1 year ago

haven't had a chance to have to have a ponder about this yet ; but ack'ing I have read the above

hif2k1 commented 11 months ago

This should be resolved in the latest release - the battery doesn't update as often which results in a smoother graph