Skip to content

Conversation

@akeeste
Copy link
Contributor

@akeeste akeeste commented May 16, 2025

Addresses part of the project card here: https://github.com/orgs/WEC-Sim/projects/12/views/1?pane=issue&itemId=91263089

This PR refactors the body library:

  • breaks out the different body types into multiple .slx files
  • removes the nonhydro body. Use the drag body instead
  • more closely links the flex and rigid body where possible
  • removes the WEC-Sim GUI, while retaining the ability to run from Simulink

To update applications to work with this PR:

  • nonhydro and drag bodies can maintain their input file set-up but need to be replaced with a Drag Body block in the model file.
  • broken library links updated for the OWC orifice model case

TODO

  • update documentation
  • remove flex body GUI
  • get the mask preview ("body(*)") working for drag and flex bodies
  • replace the previous body library with a forwarding table that points to the new library files
  • corresponding applications repo PR Update nonhydro and drag body blocks WEC-Sim_Applications#88
  • mask initialization functions to separate files --> save this for another PR

@akeeste akeeste added the SCM source code mangagement and warnings label May 16, 2025
@kmruehl kmruehl added the Body Class Body Class (bodyClass.m) label May 28, 2025
@kmruehl kmruehl self-requested a review May 28, 2025 14:51
@akeeste
Copy link
Contributor Author

akeeste commented May 28, 2025

Adam TODO before deferring some TODO items to another PR:

  • ensure branch is stable
  • bring in library conflict -- should be a single change from radiation force extrapolation

@akeeste akeeste marked this pull request as ready for review May 28, 2025 22:07
@akeeste
Copy link
Contributor Author

akeeste commented May 28, 2025

@kmruehl this PR is ready for review. I was able to get the few top-level mask initialization functions moved to .m files, but not the rest. I believe all of the applications cases run. The regression tests fail but I don't know their most recent status.

I was not able to update documentation yet to reflect the removal of the nonhydro body

@kmruehl kmruehl self-assigned this May 28, 2025
@kmruehl
Copy link
Collaborator

kmruehl commented May 30, 2025

Thanks @akeeste I'm making a few revisions to the library:

  • updating all library files to 2020b
  • naming all libraries so that they are alphabetically grouped, e.g., lib_body_drag and lib_body_hydro, instead of lib_drag_body and lib_hydro_body
  • resolving the linking between the main library and the bodies library

Copy link
Collaborator

@kmruehl kmruehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akeeste thanks for working on this. I made some minor updates that broke then library. Let's debug when you're back in the office and discuss next steps

@akeeste
Copy link
Contributor Author

akeeste commented Jul 9, 2025

Okay, after discussion between @akeeste and @kmruehl, this PR has changed scope significantly and now does the following:

  • removes the nonhydro body and replaces it with the drag body
    • The flag body.nonHydro can take values of 0, 1, 2, but now values of 1 and 2 both result in a drag body for backwards compatibility
    • bodyClass pre-processing, initializeWecSim and the docs are updated appropriately
  • removes the WEC-Sim GUI from all library files due to the maintenance burden
    • documentation on this is removed
    • the runFromSimTest.m is still presented but heavily simplified
    • the RM3FromSimulink example is removed. It was actually a WEC-Sim GUI example and demonstrating the ability to run from Simulink does not require a separate example case. It will work with any case

The body types are no longer split into multiple files because it does not add value and increases burden on the user

@kmruehl
Copy link
Collaborator

kmruehl commented Jul 9, 2025

@akeeste is this ready for review?

@kmruehl
Copy link
Collaborator

kmruehl commented Jul 9, 2025

I'm still having issues with the Simulink Library rendering. I'm running MATLAB 2024a. Maybe someone else on the team can check to see if they're having the same issue?

image

@kmruehl
Copy link
Collaborator

kmruehl commented Jul 9, 2025

I'm still having issues with the Simulink Library rendering. I'm running MATLAB 2024a. Maybe someone else on the team can check to see if they're having the same issue?

image

I am actually having this issue on this PR, main and dev, so it must be an issue on my end. Furthermore, @jtgrasb confirmed that he does not have this issue viewing the library. I'm going to reinstall MATLAB, and upgrade to 2025a.

@akeeste
Copy link
Contributor Author

akeeste commented Jul 10, 2025

@kmruehl Yes this is ready for review.

I'm not sure what's causing the library appearance issue. On R2024b PTO-Sim renders fine but not the rest. I agree that maybe it's a MATLAB version problem

@kmruehl
Copy link
Collaborator

kmruehl commented Jul 10, 2025

@akeeste that's the same for me with 2024a. PTO-Sim renders properly, but nothing else does.

Everything renders properly for me on 2025a and @jtgrasb confirmed that 2023b renders properly, so it must be an issue with the 2024a and 2024b distributions. I don't think it's worth debugging because the library blocks still work, they just don't render in the library. I'm just mentioning it in this thread for future awareness.

Copy link
Collaborator

@kmruehl kmruehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akeeste thanks for drafting this PR, but I think it needs some work prior to merging. Several of the docs need to be updated, and so does initializeWecSim and bodyClass. Right now I am not able to run the RM3 from Simulink, and the docs for the Body Library updates are confusing.

@kmruehl
Copy link
Collaborator

kmruehl commented Jul 11, 2025

@akeeste I made some very minor updates towards the requested changes. Let's chat about how to get these revisions done and merging the PR. Thanks!

Also, why are the tests failing?

@akeeste
Copy link
Contributor Author

akeeste commented Jul 11, 2025

Thanks @kmruehl I'll make the requested changes. I don't know why the tests are failing. They have not run consistently for a while and the regression were only recently fixed

@akeeste
Copy link
Contributor Author

akeeste commented Jul 11, 2025

It looks like the tests are not running to completion, I'll look into that too

@akeeste
Copy link
Contributor Author

akeeste commented Jul 16, 2025

I'm not sure why there tests are having issues that they weren't before, but I also fixed that. They were failing on the 2nd regression test because the RM3 simulink file from the previous one was still open, leading to conflicts with open models on the path. I force close all simulink models after each regression test

@akeeste akeeste merged commit a18a614 into WEC-Sim:dev Jul 16, 2025
10 checks passed
@akeeste
Copy link
Contributor Author

akeeste commented Jul 16, 2025

Tests finally passing. Merged

@akeeste akeeste deleted the body_refactor branch July 16, 2025 21:02
@kmruehl
Copy link
Collaborator

kmruehl commented Jul 16, 2025

Thanks @akeeste

@akeeste akeeste mentioned this pull request Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Body Class Body Class (bodyClass.m) SCM source code mangagement and warnings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants