Skip to content

Commit

Permalink
more kpi for electricity_meter
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoppe-J committed Jan 15, 2025
1 parent 5ec78e5 commit 7020f0e
Showing 1 changed file with 69 additions and 1 deletion.
70 changes: 69 additions & 1 deletion hisim/components/electricity_meter.py
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
DynamicComponentConnection,
)
from hisim.simulationparameters import SimulationParameters
from hisim.postprocessing.kpi_computation.kpi_structure import KpiEntry, KpiTagEnumClass
from hisim.postprocessing.kpi_computation.kpi_structure import KpiEntry, KpiTagEnumClass, KpiHelperClass


@dataclass_json
@@ -562,6 +562,20 @@ def get_component_kpi_entries(
total_energy_from_grid_in_kwh = postprocessing_results.iloc[:, index].sum() * 1e-3
elif output.field_name == self.ElectricityToGrid:
total_energy_to_grid_in_kwh = postprocessing_results.iloc[:, index].sum() * 1e-3
elif output.field_name == self.ElectricityFromGridInWatt:
total_power_from_grid_in_watt = postprocessing_results.iloc[:, index].sum() * 1e-3
elif output.field_name == self.ElectricityToGridInWatt:
total_power_to_grid_in_watt = postprocessing_results.iloc[:, index].sum() * 1e-3

(mean_total_power_from_grid_in_watt,
max_total_power_from_grid_in_watt,
min_total_power_from_grid_in_watt,
) = KpiHelperClass.calc_mean_max_min_value(list_or_pandas_series=total_power_from_grid_in_watt)

(mean_total_power_to_grid_in_watt,
max_total_power_to_grid_in_watt,
min_total_power_to_grid_in_watt,
) = KpiHelperClass.calc_mean_max_min_value(list_or_pandas_series=total_power_to_grid_in_watt)

total_energy_from_grid_in_kwh_entry = KpiEntry(
name="Total energy from grid",
@@ -581,6 +595,60 @@ def get_component_kpi_entries(
)
list_of_kpi_entries.append(total_energy_to_grid_in_kwh_entry)

mean_total_power_from_grid_in_watt_entry = KpiEntry(
name="Mean power from grid",
unit="kW",
value=mean_total_power_from_grid_in_watt,
tag=KpiTagEnumClass.ELECTRICITY_METER,
description=self.component_name,
)
list_of_kpi_entries.append(mean_total_power_from_grid_in_watt_entry)

max_total_power_from_grid_in_watt_entry = KpiEntry(
name="Max power from grid",
unit="kW",
value=max_total_power_from_grid_in_watt,
tag=KpiTagEnumClass.ELECTRICITY_METER,
description=self.component_name,
)
list_of_kpi_entries.append(max_total_power_from_grid_in_watt_entry)

min_total_power_from_grid_in_watt_entry = KpiEntry(
name="Min power from grid",
unit="kW",
value=min_total_power_from_grid_in_watt,
tag=KpiTagEnumClass.ELECTRICITY_METER,
description=self.component_name,
)
list_of_kpi_entries.append(min_total_power_from_grid_in_watt_entry)

mean_total_power_to_grid_in_watt_entry = KpiEntry(
name="Mean power to grid",
unit="kW",
value=mean_total_power_to_grid_in_watt,
tag=KpiTagEnumClass.ELECTRICITY_METER,
description=self.component_name,
)
list_of_kpi_entries.append(mean_total_power_to_grid_in_watt_entry)

max_total_power_to_grid_in_watt_entry = KpiEntry(
name="Max power to grid",
unit="kW",
value=max_total_power_to_grid_in_watt,
tag=KpiTagEnumClass.ELECTRICITY_METER,
description=self.component_name,
)
list_of_kpi_entries.append(max_total_power_to_grid_in_watt_entry)

min_total_power_to_grid_in_watt_entry = KpiEntry(
name="Min power to grid",
unit="kW",
value=min_total_power_to_grid_in_watt,
tag=KpiTagEnumClass.ELECTRICITY_METER,
description=self.component_name,
)
list_of_kpi_entries.append(min_total_power_to_grid_in_watt_entry)

# get opex costs
opex_costs = self.get_cost_opex(all_outputs=all_outputs, postprocessing_results=postprocessing_results)
opex_costs_in_euro_entry = KpiEntry(

0 comments on commit 7020f0e

Please sign in to comment.