def capacity_cost_rule(mod, g, p):
    """
    The capacity cost for new-build generators in a given period is the
    capacity-build of a particular vintage times the annualized cost for
    that vintage summed over all vintages operational in the period.
    """
    return sum(
        mod.GenNewBin_Build[g, v]
        * mod.gen_new_bin_build_size_mw[g]
        * mod.gen_new_bin_annualized_real_cost_per_mw_yr[g, v]
        for (gen, v) in mod.GEN_NEW_BIN_VNTS_OPR_IN_PERIOD[p]
        if gen == g
    )