def __init__(self, costfn, discount, lifetime=50): """Construct transmission costs given a cost function, discount rate and lifetime. >>> t = Transmission(0.05, 30) """ # Vectorise the cost function so that we can call it with a matrix argument. self.cost_per_mw_km = np.vectorize(costfn) self.af = annuity_factor(lifetime, discount)
if args.reliability_std is not None: context.relstd = args.reliability_std # Likewise for the minimum share of regional generation. context.min_regional_generation = args.min_regional_generation assert context.min_regional_generation is None or \ (0 <= context.min_regional_generation <= 1), \ "Minimum regional generation must be in the interval [0,1]" cost_class = costs.cost_switch(args.costs) context.costs = cost_class(args.discount_rate, args.coal_price, args.gas_price, args.ccs_storage_costs) context.costs.carbon = args.carbon_price context.costs.transmission = transmission.Transmission(args.tx_costs, args.discount_rate) if args.coal_ccs_costs is not None: fom = context.costs.fixed_om_costs[generators.Coal_CCS] af = costs.annuity_factor(context.costs.lifetime, args.discount_rate) context.costs.capcost_per_kw_per_yr[generators.Coal_CCS] = args.coal_ccs_costs / af + fom # Set up the scenario. scenarios.supply_switch(args.supply_scenario)(context) # Apply each demand modifier in the order given on the command line. if args.demand_modifier is not None: for arg in args.demand_modifier: scenarios.demand_switch(arg)(context) if args.verbose and __name__ == '__main__': docstring = scenarios.supply_switch(args.supply_scenario).__doc__ assert docstring is not None # Prune off any doctest test from the docstring. docstring = docstring.split('\n')[0] print "supply scenario: %s (%s)" % (args.supply_scenario, docstring)