Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add power_source to graph data #1226

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/helpermodules/measurement_logging/process_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def get_totals(entries: List) -> Dict:
def get_daily_log(date: str):
data = _collect_daily_log_data(date)
data = _process_entries(data, CalculationType.POWER)
# data = _analyse_power_source(data)
data = _analyse_power_source(data)
return data


Expand All @@ -166,7 +166,7 @@ def _collect_daily_log_data(date: str):
def get_monthly_log(date: str):
data = _collect_monthly_log_data(date)
data = _process_entries(data, CalculationType.ENERGY)
# data = _analyse_power_source(data)
data = _analyse_power_source(data)
return data


Expand All @@ -191,7 +191,7 @@ def _collect_monthly_log_data(date: str):
def get_yearly_log(year: str):
data = _collect_yearly_log_data(year)
data = _process_entries(data, CalculationType.ENERGY)
# data = _analyse_power_source(data)
data = _analyse_power_source(data)
return data


Expand Down
38 changes: 12 additions & 26 deletions packages/helpermodules/measurement_logging/process_log_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from copy import deepcopy
from helpermodules.measurement_logging.process_log import (
# _analyse_percentage,
_analyse_percentage,
_calculate_average_power,
_process_entry,
get_totals,
Expand All @@ -14,31 +15,16 @@ def test_get_totals(daily_log_sample, daily_log_totals):
assert totals == daily_log_totals


# def test_analyse_percentage(daily_log_entry_kw):
# # setup and execution
# entry = _analyse_percentage(daily_log_entry_kw)

# # evaluation
# assert entry == {'bat': {'all': {'energy_exported': 3.316262207357859, 'energy_imported': 0.0, 'soc': 15},
# 'bat2': {'energy_exported': 3.316262207357859, 'energy_imported': 0.0, 'soc': 15}},
# 'counter': {'counter0': {'energy_exported': 0.0,
# 'grid': True,
# 'energy_imported': 8.983420735785948}},
# 'cp': {'all': {'energy_exported': 0.0, 'energy_imported': 11.556276923076913},
# 'cp3': {'energy_exported': 0.0, 'energy_imported': 6.932299665551841},
# 'cp4': {'energy_exported': 0.0, 'energy_imported': 2.3131384615384603},
# 'cp5': {'energy_exported': 0.0, 'energy_imported': 2.3108387959866237}},
# 'date': '09:35',
# 'ev': {'ev0': {'soc': 0}},
# 'pv': {'all': {'energy_exported': 1.517056856187291},
# 'pv1': {'energy_exported': 1.517056856187291}},
# 'sh': {'sh1': {'energy_exported': 0.0,
# 'energy_imported': 0.0012040133779264216,
# 'temp0': 300,
# 'temp1': 300,
# 'temp2': 300}},
# 'timestamp': 1690529761,
# "power_source": {"grid": 65.02, "pv": 10.98, "bat": 24.0, "cp": 0.0}}
def test_analyse_percentage(daily_log_entry_kw):
# setup
expected = deepcopy(daily_log_entry_kw)
expected.update({"power_source": {'bat': 24.0, 'cp': 0.0, 'grid': 65.02, 'pv': 10.98}})

# execution
entry = _analyse_percentage(daily_log_entry_kw)

# evaluation
assert entry == expected


def test_convert_value_to_kW():
Expand Down