Skip to content

Commit

Permalink
Fixed black
Browse files Browse the repository at this point in the history
  • Loading branch information
jkwan2011 committed Dec 13, 2023
1 parent 53af648 commit be9b24e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
27 changes: 16 additions & 11 deletions rules-engine/src/rules_engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,20 @@ def get_outputs_normalized(
average_indoor_temperature = get_average_indoor_temperature(
thermostat_set_point=summary_input.thermostat_set_point,
setback_temperature=summary_input.setback_temperature,
setback_hours_per_day=summary_input.setback_hours_per_day
setback_hours_per_day=summary_input.setback_hours_per_day,
)
average_heat_load = get_average_heat_load(
design_set_point=Constants.DESIGN_SET_POINT,
design_set_point=Constants.DESIGN_SET_POINT,
avg_indoor_temp=average_indoor_temperature,
balance_point=home.balance_point,
design_temp=summary_input.design_temperature,
ua=home.avg_ua,
)
maximum_heat_load= get_maximum_heat_load(
design_set_point=Constants.DESIGN_SET_POINT,
design_temp=summary_input.design_temperature,
ua=home.avg_ua)
maximum_heat_load = get_maximum_heat_load(
design_set_point=Constants.DESIGN_SET_POINT,
design_temp=summary_input.design_temperature,
ua=home.avg_ua,
)

summary_output = SummaryOutput(
estimated_balance_point=home.balance_point,
Expand All @@ -144,8 +145,7 @@ def get_outputs_normalized(
average_heat_load=average_heat_load,
maximum_heat_load=maximum_heat_load,
)
return (summary_output) # TODO: add BalancePointGraph

return summary_output # TODO: add BalancePointGraph


def date_to_analysis_type(d: date) -> AnalysisType:
Expand Down Expand Up @@ -196,7 +196,9 @@ def period_hdd(avg_temps: List[float], balance_point: float) -> float:


def get_average_indoor_temperature(
thermostat_set_point: float, setback_temperature: float, setback_hours_per_day: float
thermostat_set_point: float,
setback_temperature: float,
setback_hours_per_day: float,
) -> float:
"""
Calculates the average indoor temperature.
Expand All @@ -211,7 +213,8 @@ def get_average_indoor_temperature(
# again, not sure if we should check for valid values here or whether we can
# assume those kinds of checks will be handled at the point of user entry
return (
(24 - setback_hours_per_day) * thermostat_set_point + setback_hours_per_day * setback_temperature
(24 - setback_hours_per_day) * thermostat_set_point
+ setback_hours_per_day * setback_temperature
) / 24


Expand Down Expand Up @@ -239,7 +242,9 @@ def get_average_heat_load(
return (design_set_point - (avg_indoor_temp - balance_point) - design_temp) * ua


def get_maximum_heat_load(design_set_point: float, design_temp: float, ua: float) -> float:
def get_maximum_heat_load(
design_set_point: float, design_temp: float, ua: float
) -> float:
"""
Calculate the max heat load.
Expand Down
1 change: 1 addition & 0 deletions rules-engine/src/rules_engine/pydantic_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class BalancePointGraph(BaseModel):

records: List[BalancePointGraphRow]


@dataclass
class Constants:
BALANCE_POINT_SENSITIVITY: float = 0.5
Expand Down
4 changes: 2 additions & 2 deletions rules-engine/tests/test_rules_engine/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_bp_ua_estimates():
thermostat_set_point=thermostat_set_point,
setback_temperature=setback_temperature,
setback_hours_per_day=setback_hours_per_day,
design_temperature=design_temperature
design_temperature=design_temperature,
)

home = engine.Home(
Expand Down Expand Up @@ -113,7 +113,7 @@ def test_bp_ua_with_outlier():
thermostat_set_point=thermostat_set_point,
setback_temperature=setback_temperature,
setback_hours_per_day=setback_hours_per_day,
design_temperature=design_temperature
design_temperature=design_temperature,
)

home = engine.Home(
Expand Down

0 comments on commit be9b24e

Please sign in to comment.