Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ext_sus = network.storage_units[network.storage_units.p_nom_extendable]
ext_stores = network.stores[network.stores.e_nom_extendable]
passive_branches = network.passive_branches()
extendable_passive_branches = passive_branches[passive_branches.s_nom_extendable]
extendable_links = network.links[network.links.p_nom_extendable]
suc_gens_i = network.generators.index[~network.generators.p_nom_extendable & network.generators.committable & (network.generators.start_up_cost > 0)]
sdc_gens_i = network.generators.index[~network.generators.p_nom_extendable & network.generators.committable & (network.generators.shut_down_cost > 0)]
marginal_cost_it = zip(get_switchable_as_iter(network, 'Generator', 'marginal_cost', snapshots),
get_switchable_as_iter(network, 'StorageUnit', 'marginal_cost', snapshots),
get_switchable_as_iter(network, 'Store', 'marginal_cost', snapshots),
get_switchable_as_iter(network, 'Link', 'marginal_cost', snapshots))
objective = LExpression()
for sn, marginal_cost in zip(snapshots, marginal_cost_it):
gen_mc, su_mc, st_mc, link_mc = marginal_cost
weight = network.snapshot_weightings[sn]
for gen in network.generators.index:
coefficient = gen_mc.at[gen] * weight
objective.variables.extend([(coefficient, model.generator_p[gen, sn])])
for su in network.storage_units.index:
ext_stores = network.stores[network.stores.e_nom_extendable]
passive_branches = network.passive_branches()
extendable_passive_branches = passive_branches[passive_branches.s_nom_extendable]
extendable_links = network.links[network.links.p_nom_extendable]
suc_gens_i = network.generators.index[~network.generators.p_nom_extendable & network.generators.committable & (network.generators.start_up_cost > 0)]
sdc_gens_i = network.generators.index[~network.generators.p_nom_extendable & network.generators.committable & (network.generators.shut_down_cost > 0)]
marginal_cost_it = zip(get_switchable_as_iter(network, 'Generator', 'marginal_cost', snapshots),
get_switchable_as_iter(network, 'StorageUnit', 'marginal_cost', snapshots),
get_switchable_as_iter(network, 'Store', 'marginal_cost', snapshots),
get_switchable_as_iter(network, 'Link', 'marginal_cost', snapshots))
objective = LExpression()
for sn, marginal_cost in zip(snapshots, marginal_cost_it):
gen_mc, su_mc, st_mc, link_mc = marginal_cost
weight = network.snapshot_weightings[sn]
for gen in network.generators.index:
coefficient = gen_mc.at[gen] * weight
objective.variables.extend([(coefficient, model.generator_p[gen, sn])])
for su in network.storage_units.index:
coefficient = su_mc.at[su] * weight
passive_branches = network.passive_branches()
extendable_passive_branches = passive_branches[passive_branches.s_nom_extendable]
extendable_links = network.links[network.links.p_nom_extendable]
suc_gens_i = network.generators.index[~network.generators.p_nom_extendable & network.generators.committable & (network.generators.start_up_cost > 0)]
sdc_gens_i = network.generators.index[~network.generators.p_nom_extendable & network.generators.committable & (network.generators.shut_down_cost > 0)]
marginal_cost_it = zip(get_switchable_as_iter(network, 'Generator', 'marginal_cost', snapshots),
get_switchable_as_iter(network, 'StorageUnit', 'marginal_cost', snapshots),
get_switchable_as_iter(network, 'Store', 'marginal_cost', snapshots),
get_switchable_as_iter(network, 'Link', 'marginal_cost', snapshots))
objective = LExpression()
for sn, marginal_cost in zip(snapshots, marginal_cost_it):
gen_mc, su_mc, st_mc, link_mc = marginal_cost
weight = network.snapshot_weightings[sn]
for gen in network.generators.index:
coefficient = gen_mc.at[gen] * weight
objective.variables.extend([(coefficient, model.generator_p[gen, sn])])
for su in network.storage_units.index:
coefficient = su_mc.at[su] * weight
objective.variables.extend([(coefficient, model.storage_p_dispatch[su,sn])])
ext_stores = network.stores[network.stores.e_nom_extendable]
passive_branches = network.passive_branches()
extendable_passive_branches = passive_branches[passive_branches.s_nom_extendable]
extendable_links = network.links[network.links.p_nom_extendable]
suc_gens_i = network.generators.index[~network.generators.p_nom_extendable & network.generators.committable & (network.generators.start_up_cost > 0)]
sdc_gens_i = network.generators.index[~network.generators.p_nom_extendable & network.generators.committable & (network.generators.shut_down_cost > 0)]
marginal_cost_it = zip(get_switchable_as_iter(network, 'Generator', 'marginal_cost', snapshots),
get_switchable_as_iter(network, 'StorageUnit', 'marginal_cost', snapshots),
get_switchable_as_iter(network, 'Store', 'marginal_cost', snapshots),
get_switchable_as_iter(network, 'Link', 'marginal_cost', snapshots))
objective = LExpression()
for sn, marginal_cost in zip(snapshots, marginal_cost_it):
gen_mc, su_mc, st_mc, link_mc = marginal_cost
weight = network.snapshot_weightings[sn]
for gen in network.generators.index:
coefficient = gen_mc.at[gen] * weight
objective.variables.extend([(coefficient, model.generator_p[gen, sn])])
for su in network.storage_units.index:
coefficient = su_mc.at[su] * weight
objective.variables.extend([(coefficient, model.storage_p_dispatch[su,sn])])