Wind Farm Array Sizing Module¶
This module provides functions for wind farm array sizing based on [1].
Sequential Cable Sizing (CSS)¶
- sequential_CSS(grid, NPV=True, n_years=25, Hy=8760, discount_rate=0.02, ObjRule=None, max_turbines_per_string=None, limit_crossings=True, MIP_solver='glpk', CSS_L_solver='gurobi', CSS_NL_solver='bonmin', svg=None, max_iter=None, time_limit=300, NL=False, tee=False, fs=False)¶
Iteratively alternates between a path selection MIP and a linear/nonlinear OPF-based cable type selection to converge to an efficient array layout. Returns models, a summary of iterations, timing info, solver stats, and the best iteration index.
Parameter
Type
Description
Default
gridGrid
Grid with candidate array lines and cable options
Required
max_turbines_per_stringint
Optional cap on per-string turbines (sets MIP flow bound)
None
limit_crossingsbool
Enforce one-active-per-crossing-group
True
MIP_solverstr
Solver for path MIP (e.g.,
glpk/gurobi)‘glpk’
CSS_L_solverstr
Solver for linear OPF step
‘gurobi’
CSS_NL_solverstr
Solver for nonlinear OPF step (if
NL=True)‘bonmin’
time_limitint
Solver time limit in seconds
300
NLbool
Use nonlinear OPF instead of linear in CSS
False
Example
import pyflow_acdc as pyf grid,res = pyf.barrow() print('grid loaded') pyf.sequential_CSS(grid,NPV=True,max_turbines_per_string=None,MIP_solver='gurobi',CSS_L_solver='gurobi',max_iter=None,time_limit=300,tee=True) res.All()
MIP Path Selection (Array)¶
- MIP_path_graph(grid, max_flow=None, solver_name='glpk', crossings=False, tee=False, callback=False)¶
Solves a master MIP to select array connection paths minimizing total cable length, with optional crossing constraints and Gurobi callback to record feasible solutions over time. Activates cable types on candidate lines upon success.
Parameter
Type
Description
Default
gridGrid
Grid with candidate array lines
Required
max_flowint
Per-line absolute flow bound (≈ turbines per string)
|nodes|-1solver_namestr
‘glpk’ or ‘gurobi’ (callback supported with Gurobi)
‘glpk’
crossingsbool
Enforce one-active-per-crossing-group
False
callbackbool
Enable Gurobi MIPSOL callback to track (time, objective)
False
Returns
flag(bool): feasible solution foundhigh_flow(int|None): maximum absolute line flowmodel: Pyomo modelfeasible_solutions: list of(time, objective)pairs (if callback)
Example
import pyflow_acdc as pyf grid,res = pyf.anholt() flag, high_flow,model_MIP,feasible_solutions_MIP = pyf.MIP_path_graph(grid, max_flow=10, solver_name='gurobi', crossings=True, tee=True,callback=True) pyf.ACDC_TEP.plot_feasible_solutions( feasible_solutions_MIP, 'MIP', show=True)
Simplified CSS Workflow¶
- simple_CSS(grid, NPV=True, n_years=25, Hy=8760, discount_rate=0.02, ObjRule=None, CSS_L_solver='gurobi', CSS_NL_solver='bonmin', time_limit=1200, NL=False, tee=False, export=True, fs=False)¶
Runs a simplified sequential cable sizing workflow with reduced setup.
- simple_assign_cable_types(grid, model, t_MW=None)¶
Assigns cable types from an optimized model back into the grid.
Linear CSS Solvers¶
- Optimal_L_CSS_gurobi(grid, OPEX=True, NPV=True, n_years=25, Hy=8760, discount_rate=0.02, tee=False, time_limit=300)¶
Solves the linear CSS formulation with Gurobi.
- Optimal_L_CSS_ortools(grid, OPEX=True, NPV=True, n_years=25, Hy=8760, discount_rate=0.02, tee=False, time_limit=300)¶
Solves the linear CSS formulation with OR-Tools.