def get_dict_opex()

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


def get_dict_opex(components: 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 a component.

    Args:
        components: A dictionary containing the components' 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.
    """
    total_opex = 0
    for key, component in components.items():
        total_opex += get_opex_from_dict(component, 
                                              spec, 
                                              derate_curve, 
                                              opex_rate, 
                                              monthly_lifetime,
                                              factor=factor)
    return total_opex