-
Notifications
You must be signed in to change notification settings - Fork 465
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
FAST Library: add access to hub position and velocity #1057
FAST Library: add access to hub position and velocity #1057
Conversation
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.
This looks great. It should work just fine for the AMR-Wind API. I'll defer to @ndevelder to confirm if the variables are sufficient for their calculations.
@ndevelder just checking in again before I merge this - everything good here for your use in AMR Wind? |
Hi @rafmudaf! We're finally getting around to implementing this. One thing we found was a spelling inconsistency in "HubPosition" in the .h file. I'll try to keep updating here as we test. |
Thanks for pointing this out @ndevelder, I've fixed it |
It is defined as ReKi so its precision will change with compile settings
bcbb7f1
to
9a2d685
Compare
049d4d2
to
e2ccd27
Compare
I've added a unit test for this in the last commit as well as a method to get the hub position through the Python interface. However, the test is currently running in the automated system because it litters the repository with extra files. For GH Actions, this is not a problem, but during day to day development and running tests it will get cumbersome. It is located in python test_openfast_library.py ../../../reg_tests/r-test/glue-codes/openfast/5MW_OC4Jckt_ExtPtfm/5MW_OC4Jckt_ExtPtfm.fst It simply initializes the NREL 5MW turbine model and compares the position, rotational velocity and orientation from the initial conditions. def test_hub_position(library_path, input_file):
openfastlib = openfast_library.FastLibAPI(library_path, input_file)
openfastlib.fast_init()
absolute_position, rotational_velocity, orientation_dcm = openfastlib.get_hub_position()
# Initial hub position is at -5, 0, 90.55
np.testing.assert_allclose(
absolute_position,
np.array([-5.0, 0.0, 90.55]),
rtol=1e-5,
atol=1e-8,
verbose=True
)
# This case is initially still
# Velocities should be 0 and the DCM should be identity
np.testing.assert_array_equal( rotational_velocity, np.zeros(3) )
np.testing.assert_array_equal( np.reshape( orientation_dcm[:], (3,3) ), np.eye(3) ) |
And lastly, I've added the same to the C++-based FastLibAPI. This is not the one used to integrate with external CFD codes. It is a close copy of the Python interface, and it is mostly for testing the FAST_Library header file. |
Feature or improvement description
Adds a subroutine to access the hub position, velocity, and orientation DCM through the FAST Library for use in AMR Wind.
cc @psakievich @ndevelder @andrew-platt
Related issue, if one exists
None
Impacted areas of the software
Added a subroutine to FAST Library