in analysis/GreenSKU-Framework/src/carbon_model.py [0:0]
def get_power_from_dict(component: Dict[str, Any], derate_curve: Callable,
spec: int=100, factor: float=1.0) -> float:
"""Calculate the power consumption of a component.
Args:
components: A dictionary containing the components' power consumption, SPECint rating, and derating curve.
Returns:
The power consumption of the server.
"""
if 'number' not in component:
component['number'] = 1
if not derate_curve:
derate_curve = lambda x: 1
return component['power'] * component['number'] * derate_curve(spec) * factor