This commit is contained in:
Cal Wing 2025-02-14 21:36:10 +01:00
parent cc97e16ff9
commit d201782caf

21
a1.py
View File

@ -65,6 +65,24 @@ def determine_water_released(gen_power: float, elevation: float, pumping_time: f
return water_mass
# Task 3
def determine_cost_to_pump(gen_power: float, pumping_time: float, off_peak_tariff: float) -> float:
"""
Calculates the cost of using the pump during off peak period
Parameters:
gen_power (float): the amount of power generated by the pump [kW]
pumping_time (float): the amount of time the pump is running for [hrs]
off_peak_tariff (float): the off-peak tarriff cost for electricity [$/kWh]
Returns:
(float): the cost of running the pump ($)
"""
cost = gen_power * pumping_time * off_peak_tariff
return cost
# See if I get what the task sheet wants
@ -72,7 +90,8 @@ def sheet_tasks():
import numpy as np
TASKS = (
(determine_power_used, (5e6, 250, 8, 85), 500.9191176470588),
(determine_water_released, (300, 250, 8, 85), 2994495.4128440367)
(determine_water_released, (300, 250, 8, 85), 2994495.4128440367),
(determine_cost_to_pump, (300, 8, 0.02), 48),
)
for i, (task, args, expected) in enumerate(TASKS):