wecopttool.pto.PTO.post_process
- PTO.post_process(wec, res, waves=None, nsubsteps=1)[source]
Transform the results from optimization solution to a form that the user can work with directly.
Examples
The
wecopttool.WEC.solve()method only returns the raw results dictionary produced byscipy.optimize.minimize().>>> res_opt = wec.solve(waves=waves, obj_fun=pto.average_power, nstate_opt=2*nfreq+1)
To get the post-processed results for the
wecopttool.pto.PTO, you may call>>> res_pto_fd, res_pto_td = pto.post_process(wec,res_opt,waves)
For smoother plots, you can set
nsubstepsto a value greater than 1.>>> res_pto_fd, res_pto_td = pto.post_process(wec,res_opt,waves, nsubsteps=4) >>> res_pto_td[0].power.plot()
- Parameters:
wec (WEC) –
wecopttool.WECobject.res (OptimizeResult | list) – Results produced by
wecopttool.WEC.solve().waves (DataArray | None) –
xarray.DataArraywith the structure and elements shown bywecopttool.waves.nsubsteps (int | None) – Number of steps between the default (implied) time steps. A value of
1corresponds to the default step length.
- Returns:
results_fd – list of
xarray.Datasetwith frequency domain results.results_td – list of
xarray.Datasetwith time domain results.
- Return type:
tuple[Dataset, Dataset]