Try to fix task 7

This commit is contained in:
Cal Wing 2025-02-27 19:44:55 +10:00
parent ca11566c83
commit c30f1290c1

5
a1.py
View File

@ -148,7 +148,7 @@ def calc_heights_water_out(initial_height: float, final_height: float,
return water_height, water_mass
# Task 7
def calc_energy_power(heights: float, water_mass_outs: float,
def calc_energy_power(heights: tuple[float, ...], water_mass_outs: tuple[float, ...],
relative_elevation: float, efficiency: float,
time_inc: float) -> tuple[tuple[float, ...], tuple[float, ...]]:
@ -172,6 +172,7 @@ def calc_daily_profit(energy: tuple[float, ...], peak_tariff: float,
# See if I get what the task sheet wants
# [NOTE] It seems I am witing my own test suite :/ that wasn't the initention lol
# Tests do equal what I get when i test it in the shell
def sheet_tasks():
from debug_lib import NO_EVAL, TUPLE_EVAL
from debug_lib import compair_outputs
@ -184,7 +185,7 @@ def sheet_tasks():
(calc_new_water_height, (20, 40000, 1, 30), (19.985143183382704, 592567.1021442247)),
(calc_heights_water_out, (40, 5, 40000, 1, 30), ((39.97898928844613, 39.95798409574207, 39.93698442188801), (838016.4324684857, 837796.3120398963, 837576.1916037091), TUPLE_EVAL)),
(calc_energy_power, tuple(i for i in calc_heights_water_out(30, 20, 40000, 1, 30)) + (200, 85, 30), ((387.7129370269342, 387.56468335928287, 387.4164575872225), (46525.5524432321, 46507.762003113945, 46489.9749104667), TUPLE_EVAL))
# (calc_daily_profit, (calc_energy_power(*(tuple(i for i in calc_heights_water_out(30, 20, 40000, 1, 30)) + (200, 85, 30)))[0], peak, off, 30), 2726.5251609213365)
# (calc_daily_profit, (calc_energy_power(*(tuple(i for i in calc_heights_water_out(30, 20, 40000, 1, 30)) + (200, 85, 30)))[0], 0.02, 0.005, 85), 2726.5251609213365)
)
compair_outputs(TASKS)