-
Notifications
You must be signed in to change notification settings - Fork 530
C binding interface improvements #2735
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
Merged
Merged
Changes from 46 commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
1e93431
Connect WaveTankInit to SS and MD Init
rafmudaf d8c596c
Connect WaveTankInit to ADI Init
rafmudaf fcaba4f
Fix C-based ErrMsg handling
rafmudaf 7b12023
Add type specifier to floating point constants
rafmudaf db2deb4
Add WaveTankEnd routine
rafmudaf 41bb2c9
Call ADI Preinit and SetRotor
rafmudaf ed6ea91
Add MHK flag to ADI C interface
rafmudaf a712957
Add C and Fortran string error handling functions
rafmudaf bcd05d8
Add F to C string converter to fix ADI Init
rafmudaf e005c21
Update and clean up code comments
rafmudaf d9550a6
Move initial conditions to ADI C Preinit
rafmudaf 0fc7257
Merge remote-tracking branch 'ryan/MD_SS_coupling' into dev-cbind-wav…
rafmudaf 969fd43
Set SS WaveField data pointer onto MD
rafmudaf 1b1290b
Add subroutines for debugging LabVIEW connection
rafmudaf 9626245
Fix placement of implicit none
rafmudaf e404bbb
Add basic header file
rafmudaf 03676bd
Export output sizes and allocate memory in driver
rafmudaf a98bd54
Extend CalcOutput routine
rafmudaf fbff4b2
Use floating MHK reg test files for dev testing
rafmudaf 07fd9b1
Merge branch 'dev-cbind' into dev-cbind-wavetank
rafmudaf b1f97ef
Fix Python lib APIs
rafmudaf 68871fd
Connect ADI SetRotorMotion, UpdateStates, CalcOutput
rafmudaf 25e2717
Hard code IfW OutputAccel flag
rafmudaf c3d6e0f
Add check for initialized WaveField pointer
rafmudaf aa23bf4
Merge branch 'dev' into dev-cbind-wavetank
rafmudaf 765de60
Add WaveTank module config file
rafmudaf bbd25a4
Extend C ErrMes length to 8196
rafmudaf 87d25b7
Align Aerodyn Inflow C error handling
rafmudaf a647964
Remove implicit none’s to fix linting
rafmudaf 34db52c
Merge branch 'dev-cbind' into dev-cbind-wavetank
rafmudaf a63de9f
ADI_c: set `OutputAccel` flag for IfW with MHK (#27)
andrew-platt b6e48df
Remove data that aren’t used
rafmudaf 611c9b2
Add MHK flag to ADI C Preinit Python interface
rafmudaf cf50376
Streamline parts of the WaveTank module API
rafmudaf 174436a
Get ADI rotor loads
rafmudaf e5f3af4
Bug fix when passing structure positions
rafmudaf f7df5e5
Update WaveTank model closer to RM1
rafmudaf 44e86f0
Merge branch 'dev-cbind' into dev-cbind-wavetank
rafmudaf c98d7a4
Revert WaveTank module changes
rafmudaf fad6876
Add context to MHK flag comments
rafmudaf 1c8ac55
Set C error message len to Fortran len + 1
rafmudaf 84a3ca8
Remove unused function stub
rafmudaf 42a180c
Add unit tests for NWTC C Bindings module
rafmudaf 45f5305
Merge branch 'dev-cbind' into dev-cbind-wavetank
rafmudaf c7ba782
Use Fortran string for routine name in C errors
rafmudaf de37045
Add NWTC C Binding module to Visual Studio project
rafmudaf 769887c
Merge remote-tracking branch 'OpenFAST/dev' into dev-cbind-wavetank
andrew-platt 8d59c13
ADI cbind: remove stale/incomplete ADI_C_ReInit
andrew-platt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,40 +1,38 @@ | ||
|
|
||
|
|
||
| from OpynFAST.seastate import SeaStateLib | ||
| from pyOpenFAST.seastate import SeaStateLib | ||
| import matplotlib.pyplot as plt | ||
| import numpy as np | ||
|
|
||
| project_root = '/Users/rmudafor/Development/openfast' | ||
| library_path = project_root + '/build/modules/seastate/libseastate_c_binding.dylib' | ||
|
|
||
| if __name__=="__main__": | ||
|
|
||
| dt = 1.0 | ||
| time_steps = 10 | ||
|
|
||
| seastatelib = SeaStateLib( | ||
| library_path, | ||
| "NRELOffshrBsline5MW_OC4DeepCwindSemi_SeaState_WaveMod5.dat" | ||
| ) | ||
|
|
||
| seastatelib.init( | ||
| time_interval=dt, | ||
| n_steps=time_steps, | ||
| ) | ||
|
|
||
| seastate_outputs = np.zeros((time_steps, seastatelib.num_outs)) | ||
| for i in range(time_steps): | ||
| seastatelib.calc_output(i) | ||
| seastate_outputs[i] = seastatelib.output_values | ||
| print(i, [f"{value:3.4f} - " for value in seastate_outputs[i]]) | ||
| seastatelib.end() | ||
|
|
||
| # Plot the results | ||
| # plt.figure(figsize=(10, 6)) | ||
| # plt.plot(seastate_outputs[:, 0]) | ||
| # plt.plot(seastate_outputs[:, 1]) | ||
| # plt.xlabel('Time Step') | ||
| # plt.ylabel('Value') | ||
| # plt.title('Sea State Outputs') | ||
| # plt.legend() | ||
| # plt.show() | ||
| dt = 1.0 | ||
| time_steps = 10 | ||
|
|
||
| seastatelib = SeaStateLib( | ||
| library_path, | ||
| "NRELOffshrBsline5MW_OC4DeepCwindSemi_SeaState_WaveMod5.dat" | ||
| ) | ||
|
|
||
| seastatelib.init( | ||
| time_interval=dt, | ||
| n_steps=time_steps, | ||
| ) | ||
|
|
||
| seastate_outputs = np.zeros((time_steps, seastatelib.num_outs)) | ||
| for i in range(time_steps): | ||
| seastatelib.calc_output(i) | ||
| seastate_outputs[i] = seastatelib.output_values | ||
| print(i, [f"{value:3.4f} - " for value in seastate_outputs[i]]) | ||
| seastatelib.end() | ||
|
|
||
| # Plot the results | ||
| # plt.figure(figsize=(10, 6)) | ||
| # plt.plot(seastate_outputs[:, 0]) | ||
| # plt.plot(seastate_outputs[:, 1]) | ||
| # plt.xlabel('Time Step') | ||
| # plt.ylabel('Value') | ||
| # plt.title('Sea State Outputs') | ||
| # plt.legend() | ||
| # plt.show() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.