Add OSWEC PTO damping optimization application - #116
Conversation
akeeste
left a comment
There was a problem hiding this comment.
Great work @basaucier! Some preliminary review comments included here. A few on some typical minor cleanup items and some on the workflow itself.
I recommend committing the various cluster results created in MHKiT for users. They should have the ipynb so that they can recreate results, but provide the precomputed clustered conditions as .mat files here ensures that this WEC-Sim workflow can be rerun easily without MHKiT.
Otherwise on the set-up files--these seem quite capable but first instinct is to pair them down a lot. They are quite long, which is mostly an issue for future understanding and maintenance by a broader team. Let's walk through the content in each and figure out what we need to keep
There was a problem hiding this comment.
remove file in favor of those in the _Common_Input_Files_ directory
There was a problem hiding this comment.
remove file in favor of those in the _Common_Input_Files_ directory
There was a problem hiding this comment.
remove file in favor of those in the _Common_Input_Files_ directory
There was a problem hiding this comment.
remove file in favor of those in the _Common_Input_Files_ directory
There was a problem hiding this comment.
remove file in favor of those in the _Common_Input_Files_ directory
There was a problem hiding this comment.
I suggest breaking up this notebook into a few section to make it easier to review, document, and rerun. Please also add a section like the last cell of PacWave notebook. This energy comparison between each set of clustered resource and that of the real conditions is what will guide the modeler on the number of clusters to use
There was a problem hiding this comment.
Convert to a function to avoid requiring the clc and clear calls up front.
This workflow seems to run fine, but there are some changes we can make to increase the usability by the typical WEC-Sim user:
I suggest using WEC-Sim's built in batch capabilities ("MCR"). In this way, you can have one input file that takes in pto(1).damping value and a wave condition case file simu.mcrMatFile. Then calling wecSimMCR will run all wave conditions with that damping. That also allows you to break out the batch simulation for a single PTO damping into it's own function.
Then the top level workflow can either iterate through those batch cases using a grid search. Or use a function of the form: average_power = wec_sim_batch_run(pto_damping) with a more complex optimization method.
See one of the MHKiT WEC-Sim examples for how the wave condition file can be formatted to pull directly into WEC-Sim.
There was a problem hiding this comment.
Remove plots or wrap in an if statement that checks whether this is a single simulation or a batch simulation (typically whether the variable 'mcr' is present or not)
| cache_folders = { ... | ||
| 'slprj', ... | ||
| 'work', ... | ||
| 'codegen' ... | ||
| }; |
There was a problem hiding this comment.
will these folder allow the model to rerun more quickly? They should not affect results over batch runs to my knowledge
There was a problem hiding this comment.
see readmes in other applications for an example format. This information is good, there are just a few other fields that we typically add
Summary
This draft PR adds an OSWEC PTO damping optimization application workflow.
The application connects buoy-derived wave resource characterization to WEC-Sim batch simulations in order to estimate an optimal constant passive PTO damping value for the OSWEC case.
The workflow includes:
File Overview
generate_wave_conditions.ipynb.matfiles for MATLAB/WEC-Sim.config_oswec_optimization.mmake_oswec_batch.mrun_oswec_batch.manalyze_oswec_results.mestimate_oswec_damping_bounds.mwave_conditions/.matfiles generated by the Python/MHKiT workflow.runs/damping_bounds/How to Run
Set Up MATLAB Path
Start MATLAB and navigate to the application folder:
cd('path/to/WEC-Sim_Applications/OSWEC_Optimization_Damping')Typical Run Sequence
If not using theoretical bounds:
*For more see the comments in the code.