def get_opex_from_dict()

in analysis/GreenSKU-Framework/src/carbon_model.py [0:0]


def get_opex_from_dict(component: Dict[str, Any], spec: int=100, derate_curve: Callable=None,
                            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:
        component: A dictionary containing the component's power consumption, SPECint rating, and derating curve.
        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 no number is specified, assume there is only one
    if 'number' not in component:
        component['number'] = 1
    return get_opex(component['power'], 
                         spec, 
                         derate_curve, 
                         component['number'], 
                         opex_rate, 
                         monthly_lifetime,
                         factor=factor)