3. API¶
3.1. WecOptTool¶
The WecOptTool package provides the main interface for the toolbox.
-
class
WecOptTool.
RM3Study
¶ Interface for preparing, executing and inspecting a simulation based on the RM3 device
-
addControl
(controlObj)¶ Add a controller type to the simulation
Parameters: controlObj (WecOptTool.control.AbsControl) – Controller specification object
-
addGeometry
(geomObj)¶ Add a design variable type to the simulation
Parameters: geomObj (WecOptTool.control.AbsGeom) – Design variable geometry specification object
-
addSpectra
(spectra)¶ Add a spectra to the simulation
A single spectrum or weighted multi-spectra sea-states can be simulated.
Parameters: spectra ( struct
) –spectrum structure (can be arrary) in WAFO with the fields:
- S.w: column vector of frequencies in [rad/s]
- S.S: column vector of spectral density in [m^2 rad/ s]
- S.mu (optional): weighting for spectrum in multi-spectra sea-states
-
-
WecOptTool.
plot
(study)¶ Plots frequency vs. power for optimized study
Parameters: study ( WecOptTool.RM3Study
) – executed RM3Study object
-
WecOptTool.
result
(study)¶ Displays the results from the optimized study
Parameters: study ( WecOptTool.RM3Study
) – executed RM3Study object
-
WecOptTool.
run
(study, optimOptions)¶ Run a simulation with optional optimiser options
Parameters: - study (
WecOptTool.RM3Study
) – configured RM3Study object - optimOptions (optional) – options to fmincon, created with
optimoptions
- study (
3.1.1. WecOptTool.control¶
The control subpackage provides options for device control.
-
class
WecOptTool.control.
ComplexConjugate
¶ Provides complex congugate control
Seeks optimal power absorption, see Falnes2002 for technical details.
-
class
WecOptTool.control.
ProportionalDamping
¶ Provides proportional damping control
Resistive damping (i.e., a proportional feedback on velocity). See Falnes2002 for technical details.
-
class
WecOptTool.control.
PseudoSpectral
(deltaZmax, deltaFmax)¶ Provides psuedo spectra control
Seeks optimal power absorption subject to constraints. See Bacelli2014 for technical details.
Parameters: - deltaZmax (double, optional) – maximum relative oscillation amplitude [m]
- deltaFmax (double, optional) – maximum PTO force [N]
Note
deltaZmax and deltaFmax must be provided together.
3.1.2. WecOptTool.geom¶
The geom subpackage provides options for device geometry variation.
-
class
WecOptTool.geom.
Existing
(nemohRunDirectory)¶ Use an existing geometry for control optimisation
Parameters: nemohRunDirectory (str) – path to the directory containing the NEMOH results files
-
class
WecOptTool.geom.
Parametric
(x0, upperBound, lowerBound)¶ Vary device geometry parametrically.
For the RM3 study the design variables are
r1
: the radius of the surface floatr2
: the radius of the heave plated1
: the draft of the surface floatd2
: the depth of the heave plate,
The resulting design array is given as
x = [r1, r2, d1, d2]
.Parameters: - x0 (double[4]) – optimisation initial guess
- upperBound (double[4]) – optimisation upper bound
- lowerBound (double[4]) – optimisation lower bound
-
class
WecOptTool.geom.
Scalar
(x0, upperBound, lowerBound)¶ Vary device geometry by a global scalar value.
The entire RM3 device model is scaled using a multiple of the base RM3 device dimensions.
Parameters: - x0 (double) – optimisation initial guess
- upperBound (double) – optimisation upper bound
- lowerBound (double) – optimisation lower bound