From cafbf80a8349f4ec7833ce263aed8918c07f29b7 Mon Sep 17 00:00:00 2001 From: andrew-platt Date: Wed, 18 Dec 2024 14:48:49 -0700 Subject: [PATCH] Disable LiDAR in IfW at FAST.Farm level --- modules/inflowwind/src/InflowWind.f90 | 7 ++++++- modules/inflowwind/src/InflowWind.txt | 1 + modules/inflowwind/src/InflowWind_Subs.f90 | 5 +++++ modules/inflowwind/src/InflowWind_Types.f90 | 7 +++++++ modules/openfast-library/src/FAST_Subs.f90 | 1 + 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/modules/inflowwind/src/InflowWind.f90 b/modules/inflowwind/src/InflowWind.f90 index 103ddb948b..9195a4dc1f 100644 --- a/modules/inflowwind/src/InflowWind.f90 +++ b/modules/inflowwind/src/InflowWind.f90 @@ -224,7 +224,12 @@ SUBROUTINE InflowWind_Init( InitInp, InputGuess, p, ContStates, DiscStates, Cons p%lidar%PulseSpacing = InputFileData%PulseSpacing p%lidar%URefLid = InputFileData%URefLid p%lidar%ConsiderHubMotion = InputFileData%ConsiderHubMotion - + + ! Disable Lidar if not allowed (FAST.Farm doesn't allow this) + if (InitInp%LidarDisable) then + p%lidar%SensorType = SensorType_None + endif + CALL Lidar_Init( InitInp, InputGuess, p, ContStates, DiscStates, ConstrStateGuess, OtherStates, & y, m, TimeInterval, InitOutData, TmpErrStat, TmpErrMsg ) diff --git a/modules/inflowwind/src/InflowWind.txt b/modules/inflowwind/src/InflowWind.txt index 3ab0940982..5fbe8e6c0e 100644 --- a/modules/inflowwind/src/InflowWind.txt +++ b/modules/inflowwind/src/InflowWind.txt @@ -101,6 +101,7 @@ typedef ^ ^ ReKi WtrDpth typedef ^ ^ ReKi MSL2SWL - - - "Mean sea level to still water level" m typedef ^ ^ IntKi BoxExceedAllowIdx - -1 - "Extrapolate winds outside box starting at this index (for OLAF wakes and LidarSim)" - typedef ^ ^ LOGICAL BoxExceedAllowF - .FALSE. - "Flag to allow Extrapolation winds outside box starting at this index (for OLAF wakes and LidarSim)" - +typedef ^ ^ LOGICAL LidarDisable - .true. - "Disable LiDAR for this instance of InflowWind? (FAST.Farm not compatible)" - # Init Output diff --git a/modules/inflowwind/src/InflowWind_Subs.f90 b/modules/inflowwind/src/InflowWind_Subs.f90 index 305ff5c990..ea77721729 100644 --- a/modules/inflowwind/src/InflowWind_Subs.f90 +++ b/modules/inflowwind/src/InflowWind_Subs.f90 @@ -744,6 +744,11 @@ SUBROUTINE InflowWind_ValidateInput( InitInp, InputFileData, ErrStat, ErrMsg ) CALL CTTS_ValidateInput() ENDIF + if (InitInp%LidarDisable) then + if (InitInp%lidar%SensorType /= SensorType_None) then + call SetErrStat(ErrID_Warn, 'LiDAR cannot be used with this instance of InflowWind (not usable with FAST.Farm). Disabling LiDAR.', ErrStat, ErrMsg, RoutineName) + end if + endif RETURN diff --git a/modules/inflowwind/src/InflowWind_Types.f90 b/modules/inflowwind/src/InflowWind_Types.f90 index 605bfe2228..8ac1bfc93f 100644 --- a/modules/inflowwind/src/InflowWind_Types.f90 +++ b/modules/inflowwind/src/InflowWind_Types.f90 @@ -119,6 +119,7 @@ MODULE InflowWind_Types REAL(ReKi) :: MSL2SWL !< Mean sea level to still water level [m] INTEGER(IntKi) :: BoxExceedAllowIdx = -1 !< Extrapolate winds outside box starting at this index (for OLAF wakes and LidarSim) [-] LOGICAL :: BoxExceedAllowF = .FALSE. !< Flag to allow Extrapolation winds outside box starting at this index (for OLAF wakes and LidarSim) [-] + LOGICAL :: LidarDisable = .true. !< Disable LiDAR for this instance of InflowWind? (FAST.Farm not compatible) [-] END TYPE InflowWind_InitInputType ! ======================= ! ========= InflowWind_InitOutputType ======= @@ -1110,6 +1111,7 @@ SUBROUTINE InflowWind_CopyInitInput( SrcInitInputData, DstInitInputData, CtrlCod DstInitInputData%MSL2SWL = SrcInitInputData%MSL2SWL DstInitInputData%BoxExceedAllowIdx = SrcInitInputData%BoxExceedAllowIdx DstInitInputData%BoxExceedAllowF = SrcInitInputData%BoxExceedAllowF + DstInitInputData%LidarDisable = SrcInitInputData%LidarDisable END SUBROUTINE InflowWind_CopyInitInput SUBROUTINE InflowWind_DestroyInitInput( InitInputData, ErrStat, ErrMsg, DEALLOCATEpointers ) @@ -1263,6 +1265,7 @@ SUBROUTINE InflowWind_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat Re_BufSz = Re_BufSz + 1 ! MSL2SWL Int_BufSz = Int_BufSz + 1 ! BoxExceedAllowIdx Int_BufSz = Int_BufSz + 1 ! BoxExceedAllowF + Int_BufSz = Int_BufSz + 1 ! LidarDisable IF ( Re_BufSz .GT. 0 ) THEN ALLOCATE( ReKiBuf( Re_BufSz ), STAT=ErrStat2 ) IF (ErrStat2 /= 0) THEN @@ -1438,6 +1441,8 @@ SUBROUTINE InflowWind_PackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat Int_Xferred = Int_Xferred + 1 IntKiBuf(Int_Xferred) = TRANSFER(InData%BoxExceedAllowF, IntKiBuf(1)) Int_Xferred = Int_Xferred + 1 + IntKiBuf(Int_Xferred) = TRANSFER(InData%LidarDisable, IntKiBuf(1)) + Int_Xferred = Int_Xferred + 1 END SUBROUTINE InflowWind_PackInitInput SUBROUTINE InflowWind_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, ErrMsg ) @@ -1662,6 +1667,8 @@ SUBROUTINE InflowWind_UnPackInitInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrS Int_Xferred = Int_Xferred + 1 OutData%BoxExceedAllowF = TRANSFER(IntKiBuf(Int_Xferred), OutData%BoxExceedAllowF) Int_Xferred = Int_Xferred + 1 + OutData%LidarDisable = TRANSFER(IntKiBuf(Int_Xferred), OutData%LidarDisable) + Int_Xferred = Int_Xferred + 1 END SUBROUTINE InflowWind_UnPackInitInput SUBROUTINE InflowWind_CopyInitOutput( SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg ) diff --git a/modules/openfast-library/src/FAST_Subs.f90 b/modules/openfast-library/src/FAST_Subs.f90 index 9e0af8c935..09f532a022 100644 --- a/modules/openfast-library/src/FAST_Subs.f90 +++ b/modules/openfast-library/src/FAST_Subs.f90 @@ -583,6 +583,7 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, END IF ! lidar + Init%InData_IfW%LidarDisable = .false. ! allowed with OF, but not FF Init%InData_IfW%lidar%Tmax = p_FAST%TMax Init%InData_IfW%lidar%HubPosition = ED%y%HubPtMotion%Position(:,1)