arguments in function calls instead of kwarg-style
This commit is contained in:
parent
8cb5bd27d5
commit
f28a088ea3
@ -549,11 +549,11 @@ if __name__ == "__main__":
|
|||||||
n = pypsa.Network(paths.base_network)
|
n = pypsa.Network(paths.base_network)
|
||||||
Nyears = n.snapshot_weightings.objective.sum() / 8760.
|
Nyears = n.snapshot_weightings.objective.sum() / 8760.
|
||||||
|
|
||||||
costs = load_costs(paths.tech_costs, config['costs'], config['electricity'], Nyears=Nyears)
|
costs = load_costs(paths.tech_costs, config['costs'], config['electricity'], Nyears)
|
||||||
ppl = load_powerplants(paths.powerplants)
|
ppl = load_powerplants(paths.powerplants)
|
||||||
|
|
||||||
attach_load(n, paths.regions, paths.load, paths.nuts3_shapes, config['countries'],
|
attach_load(n, paths.regions, paths.load, paths.nuts3_shapes, config['countries'],
|
||||||
scaling=config['load']['scaling_factor'])
|
config['load']['scaling_factor'])
|
||||||
|
|
||||||
update_transmission_costs(n, costs, config['lines']['length_factor'])
|
update_transmission_costs(n, costs, config['lines']['length_factor'])
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ if __name__ == "__main__":
|
|||||||
elec_config = config['electricity']
|
elec_config = config['electricity']
|
||||||
|
|
||||||
Nyears = n.snapshot_weightings.objective.sum() / 8760.
|
Nyears = n.snapshot_weightings.objective.sum() / 8760.
|
||||||
costs = load_costs(paths.tech_costs, config['costs'], elec_config, Nyears=Nyears)
|
costs = load_costs(paths.tech_costs, config['costs'], elec_config, Nyears)
|
||||||
|
|
||||||
attach_storageunits(n, costs, elec_config)
|
attach_storageunits(n, costs, elec_config)
|
||||||
attach_stores(n, costs, elec_config)
|
attach_stores(n, costs, elec_config)
|
||||||
|
@ -374,12 +374,10 @@ if __name__ == "__main__":
|
|||||||
custom_busmap = pd.read_csv(paths.custom_busmap, index_col=0, squeeze=True)
|
custom_busmap = pd.read_csv(paths.custom_busmap, index_col=0, squeeze=True)
|
||||||
custom_busmap.index = custom_busmap.index.astype(str)
|
custom_busmap.index = custom_busmap.index.astype(str)
|
||||||
logger.info(f"Imported custom busmap from {paths.custom_busmap}")
|
logger.info(f"Imported custom busmap from {paths.custom_busmap}")
|
||||||
|
|
||||||
clustering = clustering_for_n_clusters(n, n_clusters, custom_busmap, aggregate_carriers,
|
clustering = clustering_for_n_clusters(n, n_clusters, custom_busmap, aggregate_carriers,
|
||||||
line_length_factor=line_length_factor,
|
line_length_factor, potential_mode, config['solving']['solver']['name'],
|
||||||
potential_mode=potential_mode,
|
"kmeans", hvac_overhead_cost, focus_weights)
|
||||||
solver_name=config['solving']['solver']['name'],
|
|
||||||
extended_link_costs=hvac_overhead_cost,
|
|
||||||
focus_weights=focus_weights)
|
|
||||||
|
|
||||||
update_p_nom_max(n)
|
update_p_nom_max(n)
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ def average_every_nhours(n, offset):
|
|||||||
return m
|
return m
|
||||||
|
|
||||||
|
|
||||||
def apply_time_segmentation(n, segments, solver_name="cplex"):
|
def apply_time_segmentation(n, segments, solver_name="cbc"):
|
||||||
logger.info(f"Aggregating time series to {segments} segments.")
|
logger.info(f"Aggregating time series to {segments} segments.")
|
||||||
try:
|
try:
|
||||||
import tsam.timeseriesaggregation as tsam
|
import tsam.timeseriesaggregation as tsam
|
||||||
@ -212,11 +212,9 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
n = pypsa.Network(paths[0])
|
n = pypsa.Network(paths[0])
|
||||||
Nyears = n.snapshot_weightings.objective.sum() / 8760.
|
Nyears = n.snapshot_weightings.objective.sum() / 8760.
|
||||||
costs = load_costs(tech_costs = paths.tech_costs,
|
costs = load_costs(paths.tech_costs, config['costs'], config['electricity'], Nyears)
|
||||||
config = config['costs'],
|
|
||||||
elec_config = config['electricity'], Nyears = Nyears)
|
|
||||||
|
|
||||||
set_line_s_max_pu(n, s_max_pu=config['lines']['s_max_pu'])
|
set_line_s_max_pu(n, config['lines']['s_max_pu'])
|
||||||
|
|
||||||
for o in opts:
|
for o in opts:
|
||||||
m = re.match(r'^\d+h$', o, re.IGNORECASE)
|
m = re.match(r'^\d+h$', o, re.IGNORECASE)
|
||||||
@ -228,7 +226,7 @@ if __name__ == "__main__":
|
|||||||
m = re.match(r'^\d+seg$', o, re.IGNORECASE)
|
m = re.match(r'^\d+seg$', o, re.IGNORECASE)
|
||||||
if m is not None:
|
if m is not None:
|
||||||
solver_name = config["solving"]["solver"]["name"]
|
solver_name = config["solving"]["solver"]["name"]
|
||||||
n = apply_time_segmentation(n, m.group(0)[:-3], solver_name=solver_name)
|
n = apply_time_segmentation(n, m.group(0)[:-3], solver_name)
|
||||||
break
|
break
|
||||||
|
|
||||||
for o in opts:
|
for o in opts:
|
||||||
|
@ -285,8 +285,7 @@ if __name__ == "__main__":
|
|||||||
with memory_logger(filename=fn, interval=30.) as mem:
|
with memory_logger(filename=fn, interval=30.) as mem:
|
||||||
n = pypsa.Network(paths[0])
|
n = pypsa.Network(paths[0])
|
||||||
n = prepare_network(n, solve_opts)
|
n = prepare_network(n, solve_opts)
|
||||||
n = solve_network(n, config=config, opts=opts,
|
n = solve_network(n, config, opts, solver_dir=tmpdir,
|
||||||
solver_dir=tmpdir,
|
|
||||||
solver_logfile=logs.solver)
|
solver_logfile=logs.solver)
|
||||||
n.export_to_netcdf(out[0])
|
n.export_to_netcdf(out[0])
|
||||||
|
|
||||||
|
@ -116,9 +116,8 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
fn = getattr(logs, 'memory', None)
|
fn = getattr(logs, 'memory', None)
|
||||||
with memory_logger(filename=fn, interval=30.) as mem:
|
with memory_logger(filename=fn, interval=30.) as mem:
|
||||||
n = prepare_network(n, solve_opts=config['solving']['options'])
|
n = prepare_network(n, config['solving']['options'])
|
||||||
n = solve_network(n, config=config, opts=opts,
|
n = solve_network(n, config, opts, solver_dir=tmpdir,
|
||||||
solver_dir=tmpdir,
|
|
||||||
solver_logfile=logs.solver)
|
solver_logfile=logs.solver)
|
||||||
n.export_to_netcdf(out[0])
|
n.export_to_netcdf(out[0])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user