WEC-Sim / WEC-Sim

Wave Energy Converter Simulator (WEC-Sim), an open-source code for simulating wave energy converters.
https://wec-sim.github.io/WEC-Sim
Apache License 2.0
145 stars 161 forks source link

[Feature request]How can I add Jammed hinge into the Numerical model (WECCCOMP_Nonlinear_Model_Predictive) #1073

Closed Doudou-Li closed 1 year ago

Doudou-Li commented 1 year ago

Note: italicized text below is include as an example and should be updated before submission. If you feel any section is not applicable to your request, please replace with 'N/A' rather than delete a section.

Is your feature request related to a problem? Please describe.

Yes, I am trying to add Jammed hinge into the Numerical model (WECCCOMP_Nonlinear_Model_Predictive). About the description of Jammed hinge, it can be found in a report ''Fault behavior of a wave energy converter: a benchmark model development'', written by Erica Michelle Lindbeck, Office of Science, Science Undergraduate Laboratory Internship Program.

image Here is the link https://github.com/WEC-Sim/WEC-Sim_Applications/tree/master/WECCCOMP/WECCCOMP_Fault_Implementation/report

First, I started to copy three constraints A, B and C from the WECCCOMP Fault implementation and pasted them into Numerical model (WECCCOMP_Nonlinear_Model_Predictive).

image

However, I got a problem when I run the WEC-Sim simulation as below:

image I don't know how to solve the above problem 'Index exceeds the number of array elements (1)'. I thought might be a version change problem.

Then I tried to replace the old simulink blocks 'Rotational PTO Actuation Torque' to the new version blocks in the three constraints.

image

When I run the simulation again, there had some new errors as following:

**Block diagram 'WaveStar_NMPC' contains 1 algebraic loop(s). To see more details about the loops use the command Simulink.BlockDiagram.getAlgebraicLoops('WaveStar_NMPC') or the command line Simulink debugger by typing sldebug('WaveStar_NMPC') in the MATLAB command window. To eliminate this message, set Algebraic loop to "none". Component: Simulink | Category: Block diagram warning Found algebraic loop containing: WaveStar_NMPC/C_Revolute1/Rotational PTO Actuation Torque/Assignment2 (algebraic variable) WaveStar_NMPC/C_Revolute1/MATLAB Function WaveStar_NMPC/Global Reference Frame/Solver Configuration/EVAL_KEY/INPUT_7_1_1 WaveStar_NMPC/B_Revolute/Rotational PTO Actuation Torque/Assignment2 WaveStar_NMPC/B_Revolute/MATLAB Function WaveStar_NMPC/Global Reference Frame/Solver Configuration/EVAL_KEY/INPUT_6_1_1 WaveStar_NMPC/A_Revolute/Rotational PTO Actuation Torque/Assignment2 WaveStar_NMPC/A_Revolute/MATLAB Function WaveStar_NMPC/Global Reference Frame/Solver Configuration/EVAL_KEY/INPUT_1_1_1 WaveStar_NMPC/Global Reference Frame/Solver Configuration/EVAL_KEY/OUTPUT_1_1 (algebraic variable) This algebraic loop may be resolved when the subsystem option 'Minimize algebraic loop occurrences' is selected on some or all of the atomic and enabled subsystems in this algebraic loop Component: Simulink | Category: Model Elapsed time is 9.043214 seconds.

Post-processing and saving... Duplicate data logging variable name, 'pto1_out' specified in both 'WaveStar_NMPC/Linear Motor/output' and 'WaveStar_NMPC/A_Revolute/Rotational PTO Actuation Torque/To Workspace' Component: Simulink | Category: Block error Error evaluating 'StopFcn' callback of Frames block (mask) 'WaveStar_NMPC/Global Reference Frame'. Callback string is 'run('stopWecSim')' Caused by: Unable to resolve the name clock_out.time.**

Could you please help me to solve the above problems?

Describe the solution you'd like

My aim is to do some tests for the robustness analysis of my designed MPC method. That is why I want to add some extra terms to bring some uncertainties or disturbances into the WEC-Sim numerical model.

What I expect is to analyse the MPC method clearly from its advantages and disadvantages.

I was thought to do some Monte-Carlo simulations in WEC-Sim. But I found this is also hard and may not possible to do.

Could you please help me to do robust analysis tests based on your WEC-Sim numerical model (WECCCOMP_Nonlinear_Model_Predictive)? I think I cannot do that analysis using WECCCOMP_Fault_Implementation cos the simulation step is too small and it is not suitable for MPC design.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Personal project context If this request is related to your project, please describe what you are attempting to do in your project so the WEC-Sim development team knows your end goal.

Additional context Add any other context or screenshots about the feature request here.

nathanmtom commented 1 year ago

@Doudou-Li Thank you for submitting your issue and I will do my best to try and help you.

I believe there are several asks/questions in this issue request, but I'll start with trying to resolve why you cannot implement a jammed hinge in the existing model.

Please follow-up if you are able to resolve your issue or have further questions.

Cheers, Nathan

Doudou-Li commented 1 year ago

Hi Nathan,

I have changed the definition of joints in the wecSimInputFile.m file and found that I can run simulation successfully. I will start to check the multiple conditions run (MRC) feature again and see if it can satisfy the requirements of sensitive and robust analysis. Thanks for your great help.

BR DD