Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions ard/collection/optiwindnet_wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from optiwindnet.mesh import make_planar_embedding
from optiwindnet.interarraylib import L_from_site
from optiwindnet.heuristics import EW_presolver
from optiwindnet.heuristics import constructor
from optiwindnet.MILP import OWNWarmupFailed, solver_factory, ModelOptions

from . import templates
Expand Down Expand Up @@ -153,6 +153,18 @@ def initialize(self):
def setup(self):
"""Setup of OM component."""
super().setup()
self.constructor_args = {}
model_options = self.modeling_options["collection"]["model_options"]
if model_options.get("feeder_limit") == "unlimited":
self.constructor_args["straight_feeder_route"] = (
model_options.get("feeder_route") == "straight"
)
if model_options.get("topology") == "branched":
self.constructor_args["method"] = "rootlust"
elif model_options.get("topology") == "radial":
self.constructor_args["method"] = "radial_EW"
else:
self.constructor_args.clear()

def setup_partials(self):
"""Setup of OM component gradients."""
Expand Down Expand Up @@ -192,12 +204,12 @@ def compute(
# start from previous solution if available, else from heuristic if it fits
if self.S_previous is not None:
S_warm = self.S_previous
elif (
model_options.get("topology") == "branched"
and model_options.get("feeder_limit") == "unlimited"
and model_options.get("feeder_route") == "segmented"
):
S_warm = EW_presolver(A, capacity=max_turbines_per_string)
elif self.constructor_args:
S_warm = constructor(
A,
capacity=max_turbines_per_string,
**self.constructor_args,
)
else:
S_warm = None

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencies = [
"openmdao",
"shapely",
"jax",
"optiwindnet>=0.0.6",
"optiwindnet>=0.2.2",
"statsmodels",
"highspy",
"pyyaml",
Expand Down