Skip to content

Commit

Permalink
fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
jkwan2011 committed Nov 8, 2023
1 parent 5979715 commit 75d26b4
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions rules-engine/src/rules_engine/engine.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import statistics as sts
from typing import List, Optional
from typing import List, Optional, Tuple

import numpy as np

Expand All @@ -19,12 +19,12 @@ def getOutputsNaturalGas(
summaryInput: SummaryInput,
dhwInput: Optional[DhwInput],
naturalGasBillingInput: NaturalGasBillingInput,
) -> (SummaryOutput, BalancePointGraph):
) -> Tuple[SummaryOutput, BalancePointGraph]:
# home = Home(summaryInput, naturalGasBillingInput, dhwInput, naturalGasBillingInput)
# home.calculate()
# return(home.summaryOutput, home.balancePointGraph)

pass
raise NotImplementedError


def hdd(avg_temp: float, balance_point: float) -> float:
Expand Down Expand Up @@ -188,6 +188,11 @@ def _initialize_billing_periods_reworked(
ngb_start_date = billingperiods.period_start_date
ngbs = billingperiods.records

# TODO: fix these
usages: List[float] = []
inclusion_codes: List[int] = []
temps: List[List[float]] = []

# winter months 1; summer months -1; shoulder months 0
for i, usage in enumerate(usages):
billing_period = BillingPeriod(
Expand Down Expand Up @@ -347,7 +352,7 @@ def calculate(
stdev_pct_max: float = 0.10,
max_stdev_pct_diff: float = 0.01,
next_balance_point_sensitivity: float = 0.5,
):
) -> None:
"""
For this Home, calculates avg non heating usage and then the estimated balance point
and UA coefficient for the home, removing UA outliers based on a normalized standard
Expand All @@ -372,7 +377,7 @@ def initialize_ua(self, billing_period: BillingPeriod) -> None:
billing_period.partial_ua = self.calculate_partial_ua(billing_period)
billing_period.ua = billing_period.partial_ua / billing_period.total_hdd

def calculate_partial_ua(self, billing_period: BillingPeriod) -> None:
def calculate_partial_ua(self, billing_period: BillingPeriod) -> float:
"""
The portion of UA that is not dependent on the balance point
"""
Expand All @@ -386,6 +391,10 @@ def calculate_partial_ua(self, billing_period: BillingPeriod) -> None:


class BillingPeriod:
avg_heating_usage: float
partial_ua: float
ua: float

def __init__(
self,
avg_temps: List[float],
Expand Down

0 comments on commit 75d26b4

Please sign in to comment.