Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
a9a3e1a
HydroDyn C-Binding: Added a new subroutine HydroDyn_C_CalcOutput_and_…
luwang00 Mar 5, 2025
1ab52e5
MD: Comments showing MD+SS coupling framework TODO's
RyanDavies19 Mar 5, 2025
5511904
HydroDyn C-Binding: Update hydrodyn_library.py for the new added-mass…
luwang00 Mar 6, 2025
7a643a6
Merge remote-tracking branch 'upstream/dev' into MD_SS_coupling
RyanDavies19 Mar 10, 2025
9cc0f0e
Saving preliminary implementation of the major refactor
faisal-bhuiyan Mar 14, 2025
1d1cbcf
Refactor the ADI c-bindings Python library
faisal-bhuiyan Mar 17, 2025
1d9e234
Merge branch 'dev' into refactor_adi_python_interface
faisal-bhuiyan Mar 18, 2025
ffe7f52
Make adi_setrotormotion() use MotionData struct as opposed to the old…
faisal-bhuiyan Mar 18, 2025
1657552
Overall improvements to the script -- remove debugging print statemen…
faisal-bhuiyan Mar 19, 2025
00f7e85
Added SS coupling structure. Verified backwards compatibility
RyanDavies19 Mar 25, 2025
399225c
Updated line error handling and finished capitalization in MD_misc
RyanDavies19 Mar 25, 2025
1658562
Add logging to MD_misc file
RyanDavies19 Mar 25, 2025
c7a6912
Merge remote-tracking branch 'upstream/dev-cbind' into MD_SS_coupling
RyanDavies19 Mar 25, 2025
497d57b
Update r-test pointer for CI testing
andrew-platt Mar 26, 2025
5053f64
SeaState pointer passing set up in MoorDyn. Changes the MoorDyn C API.
RyanDavies19 Mar 26, 2025
79bdf79
Merge pull request #2680 from faisal-bhuiyan/refactor_adi_python_inte…
andrew-platt Mar 27, 2025
fca21fd
Update r-test pointer
andrew-platt Mar 27, 2025
0f16aac
MoorDyn reading and using the WaveField pointer
RyanDavies19 Mar 28, 2025
194bd88
Revert MoorDyn_C_Binding changes
RyanDavies19 Mar 28, 2025
996ad67
FAST.Farm fixes for WaveField pointer. Resolved seg fault when aborti…
RyanDavies19 Mar 31, 2025
1437ea6
Revert moordyn_library.py changes
RyanDavies19 Mar 31, 2025
26de72d
Improved erroring handling in MD setupWaterKin and seg fault fix
RyanDavies19 Mar 31, 2025
a395952
Consolidate Python interfaces into an installable package
rafmudaf Mar 28, 2025
ab8ef23
Add prototype Python interface base class
rafmudaf Mar 26, 2025
b17960a
OpynFAST path fixes
rafmudaf Mar 31, 2025
b6ed2ac
Add install step to CI
rafmudaf Mar 31, 2025
3d18f42
Use OpynFAST in module test drivers
rafmudaf Mar 31, 2025
463d1a6
Move into case directory for HydroDyn cases
rafmudaf Apr 1, 2025
8575295
Simply Python library module names
rafmudaf Apr 1, 2025
238009b
Add C Binding utility module to NWTC Library
rafmudaf Mar 28, 2025
38ce5ad
Add SeaState C Binding interface + Python library
rafmudaf Apr 1, 2025
c6d5d5e
Add WaveTank testing module API + python driver
rafmudaf Mar 28, 2025
b31592d
Support file paths in MoorDyn C Init
rafmudaf Mar 28, 2025
b08573d
Pass back outputs and improve error handling
rafmudaf Apr 1, 2025
34ed197
Add a customizable init for driver codes
rafmudaf Apr 1, 2025
b41602b
Add a test case
rafmudaf Apr 1, 2025
461f177
Fix typo
rafmudaf Apr 1, 2025
c460b19
Use NWTC C Binding module in SeaState C Binding
rafmudaf Apr 2, 2025
0ff779d
Bug fix - Update MD Init python reg test API
rafmudaf Apr 2, 2025
ddc932a
Bit of clean up
rafmudaf Apr 2, 2025
3de7ef4
hd_cbind: add time passing to checks
andrew-platt Apr 2, 2025
f9a4e88
hd_cbind: missed a function call in last commit
andrew-platt Apr 2, 2025
5901769
Add type specifiers to floating point constants
rafmudaf Apr 3, 2025
5379ca0
Merge pull request #2663 from luwang00/f/HD_C_AM
andrew-platt Apr 10, 2025
ad9ec2d
Fix API in fastlib test script
rafmudaf Apr 11, 2025
a65efdc
Fix type in error comparison
rafmudaf Apr 11, 2025
9fabe3f
Rename OpynFAST to pyOpenFAST
rafmudaf Apr 11, 2025
97cf9c6
Merge remote-tracking branch 'openfast/dev-cbind' into python_upgrades
rafmudaf Apr 11, 2025
ec32088
Merge remote-tracking branch 'OpenFAST/dev' into dev-cbind
andrew-platt Apr 16, 2025
ca56fb4
Merge remote-tracking branch 'upstream/dev-cbind' into MD_SS_coupling
RyanDavies19 Apr 16, 2025
b115641
Merge remote-tracking branch 'OpenFAST/dev-cbind' into python_upgrades
andrew-platt Apr 16, 2025
e46b9ad
Merge pull request #2719 from rafmudaf/python_upgrades
andrew-platt Apr 17, 2025
57a8445
Added currents coupling with SeaState
RyanDavies19 Apr 17, 2025
9a31c3b
Merge remote-tracking branch 'openfast/dev-cbind' into dev-cbind
rafmudaf Apr 17, 2025
b6c808d
Update MD Init API for reg test
rafmudaf Apr 17, 2025
22848f9
Merge pull request #2720 from rafmudaf/dev-cbind
andrew-platt Apr 17, 2025
22294b7
Lot of error handling improvements, fixed small bugs in WaveKin coupl…
RyanDavies19 Apr 18, 2025
39994b1
Add error checks for SS compatibility
RyanDavies19 Apr 18, 2025
22aa71c
Merge remote-tracking branch 'upstream/dev-cbind' into MD_SS_coupling
RyanDavies19 Apr 21, 2025
ed4f9ec
Merge branch 'dev' into dev-cbind
rafmudaf Apr 23, 2025
c0b16bd
Remove old TODO comment
RyanDavies19 Apr 24, 2025
3659a4c
Update MoorDyn error message lengths
RyanDavies19 Apr 24, 2025
16c6203
Added failed0 logic for allocation checks
RyanDavies19 Apr 25, 2025
b7d6599
Fixes some missed capitalizations and routine name in MD_Misc
RyanDavies19 Apr 25, 2025
cda308f
Rename nAttachedC to nAttachedP for MD bodies, Minor allocation bugfi…
RyanDavies19 Apr 25, 2025
619cba7
MD Rod Nan checking if Wordy
RyanDavies19 Apr 25, 2025
1b5d08b
Update r-test pointer and test case list for MD
andrew-platt Apr 28, 2025
8425c28
Merge pull request #2705 from RyanDavies19/MD_SS_coupling
andrew-platt Apr 28, 2025
9b1e240
Add HydroDyn input files handle
wenchaoyu Apr 4, 2025
3d20f95
HD-c: revise order of HD_Init_C args to match ADI_C_Init
andrew-platt Apr 28, 2025
cfb5aae
Merge pull request #2787 from andrew-platt/f/HD_C_SS_fileHandle
andrew-platt Apr 29, 2025
6068421
Fix Intel compiler error for comment after string literal
rafmudaf Apr 30, 2025
fa1cb96
Merge pull request #2790 from rafmudaf/dev-cbind
andrew-platt Apr 30, 2025
6dc4ee5
Enable custom current profile if SeaState currents disabled
RyanDavies19 May 2, 2025
00b6f7f
Added wave directional spreading to moorDyn for WaveKinMod = 2
RyanDavies19 May 2, 2025
394dc22
Fix console printing for current profile warning
RyanDavies19 May 2, 2025
c63dbfb
Merge pull request #2794 from RyanDavies19/MD_wave_spreading
andrew-platt May 5, 2025
5d6feb3
MD cbind: correct description on number of mesh points allowed
andrew-platt Apr 30, 2025
2dbf91d
MD cbind: clarify mesh mapping
andrew-platt May 1, 2025
65c6ff3
Merge pull request #2791 from andrew-platt/b/MD_C_meshpointdocs
andrew-platt May 6, 2025
94eb412
Merge remote-tracking branch 'OpenFAST/dev' into dev-cbind
andrew-platt Jun 13, 2025
bd0d00d
Manual apply PR 2816 from 4.0.5 to MoorDyn_Misc
andrew-platt Jun 16, 2025
d02f50c
Update r-test pointer
andrew-platt Jun 16, 2025
72adfa7
Bad merge of MoorDyn_Misc.f90
andrew-platt Jun 16, 2025
582aa52
MD: fix bad merge, try 2
andrew-platt Jun 16, 2025
dfceeff
Merge pull request #2862 from OpenFAST/m/dev_to_devcbind_after405
andrew-platt Jun 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/automated-dev-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install glue-codes/python/. # Installs the interface library
sudo apt-get update -y
sudo apt-get install -y libopenblas-dev libopenblas-openmp-dev libhdf5-dev libnetcdf-dev libopenmpi-dev libyaml-cpp-dev
- name: Setup workspace
Expand Down Expand Up @@ -136,6 +137,7 @@ jobs:
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install glue-codes/python/. # Installs the interface library
sudo apt-get update -y
sudo apt-get install -y libopenblas-dev libopenblas-openmp-dev
- name: Setup workspace
Expand Down Expand Up @@ -258,6 +260,7 @@ jobs:
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install glue-codes/python/. # Installs the interface library
sudo apt-get update -y
sudo apt-get install -y libopenblas-dev libopenblas-openmp-dev
sudo apt-get install -y libhdf5-dev libnetcdf-dev libopenmpi-dev libyaml-cpp-dev
Expand Down Expand Up @@ -316,6 +319,7 @@ jobs:
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install glue-codes/python/. # Installs the interface library
sudo apt-get update -y
sudo apt-get install -y libopenblas-dev libopenblas-openmp-dev
sudo apt-get install -y libhdf5-dev libnetcdf-dev libopenmpi-dev libyaml-cpp-dev
Expand Down Expand Up @@ -366,6 +370,7 @@ jobs:
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install glue-codes/python/. # Installs the interface library
sudo apt-get update -y
sudo apt-get install -y libopenblas-dev libopenblas-openmp-dev
sudo apt-get install -y libhdf5-dev libnetcdf-dev libopenmpi-dev libyaml-cpp-dev
Expand Down Expand Up @@ -415,6 +420,7 @@ jobs:
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install glue-codes/python/. # Installs the interface library
sudo apt-get update -y
sudo apt-get install -y libopenblas-dev libopenblas-openmp-dev
sudo apt-get install -y libhdf5-dev libnetcdf-dev libopenmpi-dev libyaml-cpp-dev
Expand Down Expand Up @@ -466,6 +472,7 @@ jobs:
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install glue-codes/python/. # Installs the interface library
sudo apt-get update -y
sudo apt-get install -y libopenblas-dev libopenblas-openmp-dev
sudo apt-get install -y libhdf5-dev libnetcdf-dev libopenmpi-dev libyaml-cpp-dev
Expand Down Expand Up @@ -513,6 +520,7 @@ jobs:
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install glue-codes/python/. # Installs the interface library
sudo apt-get update -y
sudo apt-get install -y libopenblas-dev libopenblas-openmp-dev
sudo apt-get install -y libhdf5-dev libnetcdf-dev libopenmpi-dev libyaml-cpp-dev
Expand Down Expand Up @@ -561,6 +569,7 @@ jobs:
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install glue-codes/python/. # Installs the interface library
sudo apt-get update -y
sudo apt-get install -y libopenblas-dev libopenblas-openmp-dev
sudo apt-get install -y libhdf5-dev libnetcdf-dev libopenmpi-dev libyaml-cpp-dev
Expand Down Expand Up @@ -608,6 +617,7 @@ jobs:
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install glue-codes/python/. # Installs the interface library
sudo apt-get update -y
sudo apt-get install -y libopenblas-dev libopenblas-openmp-dev
sudo apt-get install -y libhdf5-dev libnetcdf-dev libopenmpi-dev libyaml-cpp-dev
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
*.app
__pycache__/*
*.pyc
*.egg-info

# Build specific files
build*/
Expand Down
1 change: 1 addition & 0 deletions glue-codes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

add_subdirectory(openfast)
add_subdirectory(labview)

if(BUILD_OPENFAST_CPP_API)
add_subdirectory(openfast-cpp)
Expand Down
3 changes: 3 additions & 0 deletions glue-codes/fast-farm/src/FAST_Farm_Subs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,9 @@ SUBROUTINE Farm_InitMD( farm, ErrStat, ErrMsg )
ALLOCATE( farm%MD%Input( 2 ), farm%MD%InputTimes( 2 ), STAT = ErrStat2 )
if (Failed0("MD%Input and MD%InputTimes.")) return;

! Assign the SS pointer of the first SS instance (turbine 1) to MD. Because MD in FF mode will only pull frequency info, instance of SS doesn't matter (error will be thrown by MD if user asks for SS grid).
MD_InitInp%WaveField => farm%FWrap(1)%m%Turbine%SeaSt%p%WaveField ! this is the same wave field as Init%OutData_SeaSt%WaveField in FAST_subs.f90 (as set by line 278 in SeaSt_Init). Cant use Init%OutData_SeaSt%WaveField because Init is a local variable to FAST_InitializeAll

! initialize MoorDyn
CALL MD_Init( MD_InitInp, farm%MD%Input(1), farm%MD%p, farm%MD%x, farm%MD%xd, farm%MD%z, &
farm%MD%OtherSt, farm%MD%y, farm%MD%m, farm%p%DT_mooring, MD_InitOut, ErrStat2, ErrMsg2 )
Expand Down
29 changes: 29 additions & 0 deletions glue-codes/labview/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# Copyright 2025 National Renewable Energy Laboratory
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

add_library(wavetanktestinglib SHARED
src/WaveTank.f90
)
target_link_libraries(wavetanktestinglib aerodyn_inflow_c_binding moordyn_c_binding seastate_c_binding nwtclibs versioninfolib)
if(APPLE OR UNIX)
target_compile_definitions(wavetanktestinglib PRIVATE IMPLICIT_DLLEXPORT)
endif()

install(TARGETS wavetanktestinglib
EXPORT "${CMAKE_PROJECT_NAME}Libraries"
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
228 changes: 228 additions & 0 deletions glue-codes/labview/src/WaveTank.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@

MODULE WaveTankTesting

USE ISO_C_BINDING
USE NWTC_Library
! USE Precision
USE MoorDyn_C
USE SeaState_C_Binding
USE NWTC_C_Binding, ONLY: IntfStrLen, SetErr

IMPLICIT NONE
SAVE

PUBLIC :: WaveTank_Init

REAL(C_DOUBLE) :: dt_c = 0.01_C_DOUBLE ! 100 hertz
REAL(C_FLOAT) :: g_c = 9.8065_C_FLOAT
REAL(C_FLOAT) :: rho_c = 1025.0_C_FLOAT
REAL(C_FLOAT) :: depth_c = 200.0_C_FLOAT
REAL(C_FLOAT), DIMENSION(6) :: ptfminit_c = 0.0_C_FLOAT
INTEGER(C_INT) :: interporder_c = 2 ! 1: linear (uses two time steps) or 2: quadratic (uses three time steps)

INTEGER(C_INT) :: N_CAMERA_POINTS

INTEGER(C_INT) :: load_period = 20 ! seconds

CONTAINS

SUBROUTINE SetErrStat_C(ErrStatLocal, ErrMessLocal, ErrStatGlobal, ErrMessGlobal, RoutineName)

INTEGER(C_INT), INTENT(IN ) :: ErrStatLocal ! Error status of the operation
CHARACTER(*, KIND=C_CHAR), INTENT(IN ) :: ErrMessLocal ! Error message if ErrStat /= ErrID_None
INTEGER(C_INT), INTENT(INOUT) :: ErrStatGlobal ! Error status of the operation
CHARACTER(KIND=C_CHAR), INTENT(INOUT) :: ErrMessGlobal ! Error message if ErrStat /= ErrID_None
CHARACTER(*), INTENT(IN ) :: RoutineName ! Name of the routine error occurred in

IF ( ErrStatLocal == ErrID_None ) RETURN

IF (ErrStatGlobal /= ErrID_None) ErrMessGlobal = TRIM(ErrMessGlobal)//new_line('a')
ErrMessGlobal = TRIM(ErrMessGlobal)//TRIM(RoutineName)//':'//TRIM(ErrMessLocal)
ErrStatGlobal = MAX(ErrStatGlobal,ErrStatLocal)

END SUBROUTINE

SUBROUTINE WaveTank_Init( &
MD_InputFile_c, &
SS_InputFile_c, &
AD_InputFile_c, &
IfW_InputFile_c, &
n_camera_points_c, &
ErrStat_c, &
ErrMsg_c &
) BIND (C, NAME='WaveTank_Init')
#ifndef IMPLICIT_DLLEXPORT
!DEC$ ATTRIBUTES DLLEXPORT :: WaveTank_Init
!GCC$ ATTRIBUTES DLLEXPORT :: WaveTank_Init
#endif

IMPLICIT NONE

CHARACTER(KIND=C_CHAR), INTENT(IN ), TARGET :: MD_InputFile_c(IntfStrLen)
CHARACTER(KIND=C_CHAR), INTENT(IN ), TARGET :: SS_InputFile_c(IntfStrLen)
CHARACTER(KIND=C_CHAR), INTENT(IN ), TARGET :: AD_InputFile_c(IntfStrLen)
CHARACTER(KIND=C_CHAR), INTENT(IN ), TARGET :: IfW_InputFile_c(IntfStrLen)
INTEGER(C_INT), INTENT(IN ) :: n_camera_points_c
INTEGER(C_INT), INTENT( OUT) :: ErrStat_C
CHARACTER(KIND=C_CHAR), INTENT( OUT) :: ErrMsg_C(ErrMsgLen_C)

! Local variables
integer(c_int) :: numchannels_c
character(kind=c_char) :: outputchannelnames_c(100000)
character(kind=c_char) :: outputchannelunits_c(100000)
integer(c_int) :: input_file_passed = 0 ! We're passing paths to input files rather than input strings for all modules
! character(kind=c_char), pointer :: filestring_c(IntfStrLen) ! Point to input file path input argument

print *, MD_InputFile_c
print *, SS_InputFile_c
print *, AD_InputFile_c
print *, IfW_InputFile_c

N_CAMERA_POINTS = n_camera_points_c

! filestring_c => MD_InputFile_c
! call MD_C_Init( &
! input_file_passed, &
! filestring_c, &
! IntfStrLen, &
! dt_c, &
! g_c, &
! rho_c, &
! depth_c, &
! ptfminit_c, &
! interporder_c, &
! numchannels_c, &
! outputchannelnames_c, &
! outputchannelunits_c, &
! ErrStat_C, ErrMsg_C &
! )

! call ADI_C_Init( &
! ADinputFilePassed, & ! integer(c_int), intent(in ) :: ADinputFilePassed !< Write VTK outputs [0: none, 1: init only, 2: animation]
! ADinputFileString_C, & ! type(c_ptr), intent(in ) :: ADinputFileString_C !< Input file as a single string with lines deliniated by C_NULL_CHAR
! ADinputFileStringLength_C, & ! integer(c_int), intent(in ) :: ADinputFileStringLength_C !< lenght of the input file string
! IfWinputFilePassed, & ! integer(c_int), intent(in ) :: IfWinputFilePassed !< Write VTK outputs [0: none, 1: init only, 2: animation]
! IfWinputFileString_C, & ! type(c_ptr), intent(in ) :: IfWinputFileString_C !< Input file as a single string with lines deliniated by C_NULL_CHAR
! IfWinputFileStringLength_C, & ! integer(c_int), intent(in ) :: IfWinputFileStringLength_C !< lenght of the input file string
! OutRootName_C, & ! character(kind=c_char), intent(in ) :: OutRootName_C(IntfStrLen) !< Root name to use for echo files and other
! OutVTKDir_C, & ! character(kind=c_char), intent(in ) :: OutVTKDir_C(IntfStrLen) !< Directory to put all vtk output
! gravity_C, & ! real(c_float), intent(in ) :: gravity_C !< Gravitational acceleration (m/s^2)
! defFldDens_C, & ! real(c_float), intent(in ) :: defFldDens_C !< Air density (kg/m^3)
! defKinVisc_C, & ! real(c_float), intent(in ) :: defKinVisc_C !< Kinematic viscosity of working fluid (m^2/s)
! defSpdSound_C, & ! real(c_float), intent(in ) :: defSpdSound_C !< Speed of sound in working fluid (m/s)
! defPatm_C, & ! real(c_float), intent(in ) :: defPatm_C !< Atmospheric pressure (Pa) [used only for an MHK turbine cavitation check]
! defPvap_C, & ! real(c_float), intent(in ) :: defPvap_C !< Vapour pressure of working fluid (Pa) [used only for an MHK turbine cavitation check]
! WtrDpth_C, & ! real(c_float), intent(in ) :: WtrDpth_C !< Water depth (m)
! MSL2SWL_C, & ! real(c_float), intent(in ) :: MSL2SWL_C !< Offset between still-water level and mean sea level (m) [positive upward]
! InterpOrder_C, & ! integer(c_int), intent(in ) :: InterpOrder_C !< Interpolation order to use (must be 1 or 2)
! DT_C, & ! real(c_double), intent(in ) :: DT_C !< Timestep used with AD for stepping forward from t to t+dt. Must be constant.
! TMax_C, & ! real(c_double), intent(in ) :: TMax_C !< Maximum time for simulation
! storeHHVel, & ! integer(c_int), intent(in ) :: storeHHVel !< Store hub height time series from IfW
! WrVTK_in, & ! integer(c_int), intent(in ) :: WrVTK_in !< Write VTK outputs [0: none, 1: init only, 2: animation]
! WrVTK_inType, & ! integer(c_int), intent(in ) :: WrVTK_inType !< Write VTK outputs as [1: surface, 2: lines, 3: both]
! WrVTK_inDT, & ! real(c_double), intent(in ) :: WrVTK_inDT !< Timestep between VTK writes
! VTKNacDim_in, & ! real(c_float), intent(in ) :: VTKNacDim_in(6) !< Nacelle dimension passed in for VTK surface rendering [0,y0,z0,Lx,Ly,Lz] (m)
! VTKHubRad_in, & ! real(c_float), intent(in ) :: VTKHubrad_in !< Hub radius for VTK surface rendering
! wrOuts_C, &
! DT_Outs_C, &
! NumChannels_C, &
! OutputChannelNames_C, &
! OutputChannelUnits_C, &
! ErrStat_C, ErrMsg_C &
! )


! ! Input file info
! integer(c_int), intent(in ) :: ADinputFilePassed !< Write VTK outputs [0: none, 1: init only, 2: animation]
! type(c_ptr), intent(in ) :: ADinputFileString_C !< Input file as a single string with lines deliniated by C_NULL_CHAR
! integer(c_int), intent(in ) :: ADinputFileStringLength_C !< lenght of the input file string
! integer(c_int), intent(in ) :: IfWinputFilePassed !< Write VTK outputs [0: none, 1: init only, 2: animation]
! type(c_ptr), intent(in ) :: IfWinputFileString_C !< Input file as a single string with lines deliniated by C_NULL_CHAR
! integer(c_int), intent(in ) :: IfWinputFileStringLength_C !< lenght of the input file string
! character(kind=c_char), intent(in ) :: OutRootName_C(IntfStrLen) !< Root name to use for echo files and other
! character(kind=c_char), intent(in ) :: OutVTKDir_C(IntfStrLen) !< Directory to put all vtk output
! ! Environmental
! real(c_float), intent(in ) :: gravity_C !< Gravitational acceleration (m/s^2)
! real(c_float), intent(in ) :: defFldDens_C !< Air density (kg/m^3)
! real(c_float), intent(in ) :: defKinVisc_C !< Kinematic viscosity of working fluid (m^2/s)
! real(c_float), intent(in ) :: defSpdSound_C !< Speed of sound in working fluid (m/s)
! real(c_float), intent(in ) :: defPatm_C !< Atmospheric pressure (Pa) [used only for an MHK turbine cavitation check]
! real(c_float), intent(in ) :: defPvap_C !< Vapour pressure of working fluid (Pa) [used only for an MHK turbine cavitation check]
! real(c_float), intent(in ) :: WtrDpth_C !< Water depth (m)
! real(c_float), intent(in ) :: MSL2SWL_C !< Offset between still-water level and mean sea level (m) [positive upward]
! ! Interpolation
! integer(c_int), intent(in ) :: InterpOrder_C !< Interpolation order to use (must be 1 or 2)
! ! Time
! real(c_double), intent(in ) :: DT_C !< Timestep used with AD for stepping forward from t to t+dt. Must be constant.
! real(c_double), intent(in ) :: TMax_C !< Maximum time for simulation
! ! Flags
! integer(c_int), intent(in ) :: storeHHVel !< Store hub height time series from IfW
! ! VTK
! integer(c_int), intent(in ) :: WrVTK_in !< Write VTK outputs [0: none, 1: init only, 2: animation]
! integer(c_int), intent(in ) :: WrVTK_inType !< Write VTK outputs as [1: surface, 2: lines, 3: both]
! real(c_double), intent(in ) :: WrVTK_inDT !< Timestep between VTK writes
! real(c_float), intent(in ) :: VTKNacDim_in(6) !< Nacelle dimension passed in for VTK surface rendering [0,y0,z0,Lx,Ly,Lz] (m)
! real(c_float), intent(in ) :: VTKHubrad_in !< Hub radius for VTK surface rendering
! integer(c_int), intent(in ) :: wrOuts_C !< Write ADI output file
! real(c_double), intent(in ) :: DT_Outs_C !< Timestep to write output file from ADI
! ! Output
! integer(c_int), intent( out) :: NumChannels_C !< Number of output channels requested from the input file
! character(kind=c_char), intent( out) :: OutputChannelNames_C(ChanLen*MaxADIOutputs+1) !< NOTE: if MaxADIOutputs is sufficiently large, we may overrun the buffer on the Python side.
! character(kind=c_char), intent( out) :: OutputChannelUnits_C(ChanLen*MaxADIOutputs+1)
! integer(c_int), intent( out) :: ErrStat_C !< Error status
! character(kind=c_char), intent( out) :: ErrMsg_C(ErrMsgLen_C) !< Error message (C_NULL_CHAR terminated)

! Set compiler flag for Labview
! Cmpl4LV = .TRUE.

END SUBROUTINE WaveTank_Init

! delta_time, &
SUBROUTINE WaveTank_CalcOutput( &
frame_number, &
positions_x, &
positions_y, &
positions_z, &
rotation_matrix, &
loads, &
ErrStat_c, &
ErrMsg_c &
) BIND (C, NAME='WaveTank_CalcOutput')
#ifndef IMPLICIT_DLLEXPORT
!DEC$ ATTRIBUTES DLLEXPORT :: WaveTank_CalcOutput
!GCC$ ATTRIBUTES DLLEXPORT :: WaveTank_CalcOutput
#endif

IMPLICIT NONE

! INTEGER(C_INT) :: delta_time
INTEGER(C_INT) :: frame_number
REAL(C_FLOAT), INTENT(IN ) :: positions_x(N_CAMERA_POINTS)
REAL(C_FLOAT), INTENT(IN ) :: positions_y(N_CAMERA_POINTS)
REAL(C_FLOAT), INTENT(IN ) :: positions_z(N_CAMERA_POINTS)
REAL(C_FLOAT), INTENT(IN ) :: rotation_matrix(9)
REAL(C_FLOAT), INTENT( OUT) :: loads(N_CAMERA_POINTS)
INTEGER(C_INT), INTENT( OUT) :: ErrStat_C
CHARACTER(KIND=C_CHAR), INTENT( OUT) :: ErrMsg_C(ErrMsgLen_C)

INTEGER :: i

IF ( MOD(frame_number / load_period, 2) == 0 ) THEN
loads = -1.0
ELSE
loads = 1.0
ENDIF

END SUBROUTINE

SUBROUTINE WaveTank_End() bind (C, NAME="WaveTank_End")


IMPLICIT NONE




END SUBROUTINE

end module WaveTankTesting
Loading