in analysis/GreenSKU-Framework/src/carbon_model.py [0:0]
def get_opex(power: float, spec: int=100, derate_curve: Callable=None, number: int=1,
opex_rate: float=205.0, monthly_lifetime: int=72,
factor: float=1.0) -> float:
"""Calculate the monthly opex cost of something that consumes power.
Args:
power: The power consumption of the server in Watts.
spec: The SPECint rating of the server.
derates: A list of derating factors for the server.
opex_rate: The rate (per kW-Month) that opex is being generated.
monthly_lifetime: The monthly lifetime of the server.
Returns:
The monthly opex cost of the server.
"""
if not derate_curve:
derate_curve = lambda x: 1
# Calculate the monthly opex cost of the server
return (power/1000) * opex_rate * derate_curve(spec) * monthly_lifetime * number * factor