-
Notifications
You must be signed in to change notification settings - Fork 455
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
Add a Python glue-code interface #962
Conversation
162dba6
to
179e474
Compare
Include a more explicit C string length variable
abort_error_level should be greater than 0 so that error_status of 0 doesn’t cause a false error
Rather than aborting the process completely
This is not a Python problem, but its a human eyes problem.
First call FAST_End to deallocate internal arrays and then call FAST_DeallocateTurbines to free up the Turbine array
Removes the requirement to pass TMax and InitInpAry since passing TMax overrides the input file value. This commit preserves this functionality, but makes it optional. The system TMax is also now returned so that calling-codes can determine how many time steps to loop over. NOTE: this may break any codes using FAST_Library.h as that header does not support the optional arguments to FAST_Sizes
This is currently used during the linearization simulations with CalcSteady enabled. After do NLinTimes steps, the simluation should simply end. This is currently already handled in FAST_Prog, and this commits adds the same behavior in FAST_Library
# Conflicts: # glue-codes/python/OpenFAST.py
Storing the error status on the class was causing it to be overwritting when doing the deinitialization routines. The error would be caught, but it would then report back Error 0: <empty string>.
This was checking for an error in the openfastlib but `fatal_error` is a function not an attribute so the if-statement was evaluating to True. In any case, the errors should be handled in the library.
Adds more of the exising OpenFAST regression tests. Only the tests that have dt and dt_out matching are compatible. The FAST_Library outputs values at each call to FAST_Update, but the output files from FAST_Prog are written at dt_out intervals. The Python interface would have to parse dt_out and export files similarly to match the existing regression test baselines.
c2dbbcf
to
b4536d8
Compare
@bjonkman I've tried to fully describe the changes to FAST Library in the initial post, and I'm curious if you have any feedback here. I also made the corresponding changes to the Simulink interface, but I did not test those changes. |
@gbarter This is finally tested and I think ready to go. Do you, @dzalkind, or @ptrbortolotti have any other suggestions on the Python interface? |
I compared the python interface from the commit you linked and my latest. It looks like the only differences are my changes. @dzalkind would it help for us to look at the differences together? |
Regarding the question in the initial post TMax, the functionality here is sufficient. TMax is specific in the input file and is read into In the pull request, the |
I've added an error in the case where |
Feature or improvement description
This pull request adds a Python interface to the OpenFAST glue code. It also includes a Python driver to test the interface. There are also changes to the FAST Library interface in
FAST_Update
andFAST_Sizes
.The change in
FAST_Update
is to support ending the simulation early similar to #930. However, the Python interface raises an error based on the error level from OpenFAST and ending early is not an error. To be more explicit with this feature, I added a variableEndSimulationEarly
that the calling code can check and do what it needs to do while also handling errors.The change to
FAST_Sizes
removes the requirement to use theExternInitData
structure and allows for retrieving the system-levelTMax
. Currently, the value ofTMax
given inFAST_Sizes
overwrites the value provided in the input file. Here's a trace of the function calls from FAST_Sizes untilFAST_init
:This pull request makes both
TMax
andExternInitData
optional in order to preserve that functionality while also allows a calling code to directly use the input file.I've also added a new driver code written in C++ that replaces the older driver code written in C (
FAST_Prog.c
). In reality, all C-based driver codes are currently only used for testing. The functionality in the older C driver is already tested more extensively through the C++ API. The FAST_Library routines not dealing with the C++ API were not previously tested in the automated suite, so the new C++ driver tests those. Additionally, it adds test coverage forFAST_Library.h
.Impacted areas of the software
FAST_Library.f90
FAST_Library.h
FAST_SFunc.c
The rest are new files
Additional supporting information
Here are the API changes
FAST_Sizes
Changes:
tmax_c
output argumentTMax
andInitInpAry
required arguments and add same optional argumentsFAST_Update
Add
EndSimulationEarly
output to become becomeTest results, if applicable
See the new actions "Interface Tests"
TODO
A couple of points that might be required to address are