-
Notifications
You must be signed in to change notification settings - Fork 184
initial commit largeXYDispOption #877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
DO NOT MERGE YET. See issue #876 |
|
I have also tried using persistent variables in the same way as the radiation convolution integral. Again, this is giving an error, even though it appears to operate the exact same way as the convolution integral block. MATLAB Function3 uses constructs that are invalid when the block specifies or inherits a continuous sample time. Invalid constructs include using global variables, writing to initialized persistent variables, calling exported functions, or using coder.extrinsic. For help on persistent variables, see the documentation. |
|
Because of the unresolved issues in the items above, and their apparent dependency on MATLAB/Simulink version, I have removed the threshold for re-calculation. If the largeXYDisplacement option is enabled, it will calculate a phase correction at every time step. This is a single additional matrix multiplication: for irregular waves, a few timing tests with the RM3 example showed no significant difference in run time with and without this option enabled. This is not ideal, but removes the need for feedback loops or persistent variables in the MATLAB function. Still need to address failed tests and add documentation. |
|
All checks now passing. Need docs, but otherwise ready for merge! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just reviewed this and looks good. I also tested it with the mean drift application and there is clear difference between the case without the displacement calc and with the displacement calc, which can be seen when plotting/saving the visualization. The displacement calc accounts for the x translation and the body motion appears to be much more in phase with the waves as it translates. Docs look fine too. Except for the 2 small comments, looks ready to merge to me.
This is the initial pull request for the wave excitation correction for large XY displacement project. The wave excitation force is calculated with respect to a body's instantaneous X,Y position, not just the force at 0,0. It is appropriate to model bodies for which large lateral displacements are expected, particularly where wave phase between multiple bodies is important.
Files Changed:
bodyClass: added 1 new structure "largeXYDisplacement" with 2 fields: "option" (1 or 0 boolean to turn on/off) and "threshold" (float, in m: how far the body can translate before an excitation phase correction will be recalculated).
body block wave excitation: added phase arguments to regular waves. Added matlab function block calling calcPhaseDisp to all body/wave excitation calculation methods except no wave and user defined elevation, and the displacement input to all methods for which it did not already exist. The sum of phase from waves.phase and the displacement phase correction is passed to the excitation force calculation.
Files Added:
functions/simulink/ model/calcDispPhase.m: the excitation phase calculating function (see comments for I/O description)
To test: the RM3 example works, just add the following where appropriate in the input file