Start task 7 - not functional
This commit is contained in:
parent
f64025eb35
commit
df23b0cfb8
22
a1.py
22
a1.py
@ -147,8 +147,28 @@ 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,
|
||||
relative_elevation: float, efficiency: float,
|
||||
time_inc: float) -> tuple[tuple[float, ...], tuple[float, ...]]:
|
||||
|
||||
energy, power = (), ()
|
||||
|
||||
for i in range(len(heights)):
|
||||
energy += water_mass_outs[i] * GRAVITY_ACC * \
|
||||
(heights[i] + relative_elevation) * (efficiency/100), # note the comma
|
||||
|
||||
power += energy[i] * time_inc,
|
||||
|
||||
return energy, power
|
||||
|
||||
# Task 8
|
||||
def calc_daily_profit(energy: tuple[float, ...], peak_tariff: float,
|
||||
off_peak_tariff: float, efficiency: float) -> float:
|
||||
|
||||
|
||||
|
||||
return 0.0
|
||||
|
||||
# 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
|
||||
@ -163,6 +183,8 @@ def sheet_tasks():
|
||||
(calc_speed_at_outlet, (30,), 24.261079942986875),
|
||||
(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)
|
||||
)
|
||||
|
||||
compair_outputs(TASKS)
|
||||
|
@ -53,7 +53,7 @@ def compair_outputs(tasks):
|
||||
flag = False
|
||||
for ii, comp_res in enumerate(comp_lenths):
|
||||
for iii in range(comp_res):
|
||||
bar = isinstance(expected[ii][iii], (float, int))
|
||||
bar = isinstance(expected[ii][iii], (float, int)) and isinstance(result[ii][iii], (float, int))
|
||||
baz = np.isclose(result[ii][iii], expected[ii][iii], IS_CLOSE_VAR) if bar else (result[ii][iii] == expected[ii][iii])
|
||||
if not baz:
|
||||
flag = True
|
||||
|
Loading…
x
Reference in New Issue
Block a user