diff --git a/modules/aerodyn/src/AeroDyn_Inflow.f90 b/modules/aerodyn/src/AeroDyn_Inflow.f90 index 3f212d78e3..8da6e10758 100644 --- a/modules/aerodyn/src/AeroDyn_Inflow.f90 +++ b/modules/aerodyn/src/AeroDyn_Inflow.f90 @@ -392,6 +392,11 @@ subroutine ADI_InitInflowWind(Root, i_IW, u_AD, o_AD, IW, dt, InitOutData, errSt ! the average values for the entire wind profile must be calculated and stored (we don't know if OLAF ! is used until after AD_Init below). InitInData%BoxExceedAllow = .true. + + !bjj: what about these initialization inputs? + ! InitInData%HubPosition + ! InitInData%RadAvg + CALL InflowWind_Init( InitInData, IW%u, IW%p, & IW%x, IW%xd, IW%z, IW%OtherSt, & IW%y, IW%m, dt, InitOutData, errStat2, errMsg2 ) diff --git a/modules/awae/src/AWAE.f90 b/modules/awae/src/AWAE.f90 index fd80cd6b9a..6dacb52f1f 100644 --- a/modules/awae/src/AWAE.f90 +++ b/modules/awae/src/AWAE.f90 @@ -909,9 +909,7 @@ subroutine AWAE_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO IfW_InitInp%RootName = TRIM(p%OutFileRoot)//'.IfW' IfW_InitInp%FilePassingMethod = 0_IntKi ! Read IfW input file from disk IfW_InitInp%InputFileName = InitInp%InputFileData%InflowFile - IfW_InitInp%lidar%Tmax = 0.0_ReKi - IfW_InitInp%lidar%HubPosition = 0.0_ReKi - IfW_InitInp%lidar%SensorType = SensorType_None + IfW_InitInp%HubPosition = 0.0_ReKi IfW_InitInp%Use4Dext = .false. IfW_InitInp%MHK = MHK_None IfW_InitInp%WtrDpth = 0.0_ReKi diff --git a/modules/inflowwind/src/InflowWind.f90 b/modules/inflowwind/src/InflowWind.f90 index de2d713a3b..58f9d1d4a6 100644 --- a/modules/inflowwind/src/InflowWind.f90 +++ b/modules/inflowwind/src/InflowWind.f90 @@ -186,23 +186,8 @@ SUBROUTINE InflowWind_Init( InitInp, InputGuess, p, ContStates, DiscStates, Cons endif ! initialize sensor data: - p%lidar%SensorType = InputFileData%SensorType - IF (InputFileData%SensorType /= SensorType_None) THEN - p%lidar%NumBeam = InputFileData%NumBeam - p%lidar%RotorApexOffsetPos = InputFileData%RotorApexOffsetPos - p%lidar%LidRadialVel = InputFileData%LidRadialVel - p%lidar%NumPulseGate = InputFileData%NumPulseGate - p%lidar%FocalDistanceX = InputFileData%FocalDistanceX ! these are allocatable. Should allocate then copy - p%lidar%FocalDistanceY = InputFileData%FocalDistanceY - p%lidar%FocalDistanceZ = InputFileData%FocalDistanceZ - p%lidar%MeasurementInterval= InputFileData%MeasurementInterval - p%lidar%PulseSpacing = InputFileData%PulseSpacing - p%lidar%URefLid = InputFileData%URefLid - p%lidar%ConsiderHubMotion = InputFileData%ConsiderHubMotion - - CALL Lidar_Init( InitInp, InputGuess, p, ContStates, DiscStates, ConstrStateGuess, OtherStates, & - y, m, TimeInterval, InitOutData, TmpErrStat, TmpErrMsg ); if (Failed()) return - endif + CALL Lidar_Init( InitInp, InputFileData, InputGuess, p, y, m, TimeInterval, TmpErrStat, TmpErrMsg ) + if (Failed()) return ! If a summary file was requested, open it. IF ( InputFileData%SumPrint ) THEN @@ -216,7 +201,7 @@ SUBROUTINE InflowWind_Init( InitInp, InputGuess, p, ContStates, DiscStates, Cons ! Allocate the array for passing points CALL AllocAry( InputGuess%PositionXYZ, 3, InitInp%NumWindPoints, "Array of positions at which to find wind velocities", TmpErrStat, TmpErrMsg ); if (Failed()) return InputGuess%PositionXYZ = 0.0_ReKi - InputGuess%HubPosition = 0.0_ReKi + InputGuess%HubPosition = InitInp%HubPosition CALL Eye(InputGuess%HubOrientation,TmpErrStat,TmpErrMsg); if (Failed()) return ! Allocate the array for passing velocities out @@ -619,12 +604,10 @@ SUBROUTINE InflowWind_CalcOutput( Time, InputData, p, & ! return sensor values IF (p%lidar%SensorType /= SensorType_None) THEN - CALL Lidar_CalcOutput(Time, InputData, p, & - ContStates, DiscStates, ConstrStates, OtherStates, & - OutputData, m, TmpErrStat, TmpErrMsg ) + CALL Lidar_CalcOutput(Time, InputData, p, OutputData, m, TmpErrStat, TmpErrMsg ) CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName ) - END IF + END IF !----------------------------- diff --git a/modules/inflowwind/src/InflowWind.txt b/modules/inflowwind/src/InflowWind.txt index 924573b8f5..0d8e864446 100644 --- a/modules/inflowwind/src/InflowWind.txt +++ b/modules/inflowwind/src/InflowWind.txt @@ -76,7 +76,7 @@ typedef ^ ^ ReKi PulseSpacin typedef ^ ^ ReKi MeasurementInterval - - - "Time between each measurement" s typedef ^ ^ ReKi URefLid - - - "Reference average wind speed for the lidar" m/s typedef ^ ^ LOGICAL LidRadialVel - - - "TRUE => return radial component, FALSE => return 'x' direction estimate" - -typedef ^ ^ IntKi ConsiderHubMotion - - - "Flag whether or not the hub motion's impact on the Lidar measurement will be considered [0 for no, 1 for yes]" - +typedef ^ ^ IntKi ConsiderHubMotion - - - "whether or not the hub motion's impact on the Lidar measurement will be considered" - typedef ^ ^ Grid3D_InitInputType FF - - - "scaling data" - @@ -92,7 +92,6 @@ typedef ^ ^ IntKi FilePassing typedef ^ ^ FileInfoType PassedFileInfo - - - "If we don't use the input file, pass everything through this [FilePassingMethod = 1]" - typedef ^ ^ InflowWind_InputFile PassedFileData - - - "If we don't use the input file, pass everything through this [FilePassingMethod = 2]" - typedef ^ ^ LOGICAL OutputAccel - .FALSE. - "Flag to output wind acceleration" - -typedef ^ ^ Lidar_InitInputType lidar - - - "InitInput for lidar data" - typedef ^ ^ Grid4D_InitInputType FDext - - - "InitInput for 4D external wind data" - typedef ^ ^ ReKi RadAvg - - - "Radius (from hub) used for averaging wind speed" - typedef ^ ^ IntKi MHK - - - "MHK turbine type switch" - @@ -100,6 +99,7 @@ typedef ^ ^ ReKi WtrDpth typedef ^ ^ ReKi MSL2SWL - - - "Mean sea level to still water level" m typedef ^ ^ LOGICAL BoxExceedAllow - .FALSE. - "Flag to allow Extrapolation winds outside box starting at this index (for OLAF wakes and LidarSim)" - typedef ^ ^ LOGICAL LidarEnabled - .false. - "Enable LiDAR for this instance of InflowWind? (FAST.Farm, ADI, and InflowWind driver/library are not compatible)" - +typedef ^ ^ ReKi HubPosition {3} - - "initial position of the hub (lidar mounted on hub) [0,0,HubHeight]" "m" # Init Output diff --git a/modules/inflowwind/src/InflowWind_Subs.f90 b/modules/inflowwind/src/InflowWind_Subs.f90 index 3041c710a2..0824d2ff08 100644 --- a/modules/inflowwind/src/InflowWind_Subs.f90 +++ b/modules/inflowwind/src/InflowWind_Subs.f90 @@ -504,18 +504,14 @@ SUBROUTINE InflowWind_ParseInputFileInfo( InputFileData, InFileInfo, PriPath, In CALL ParseVar( InFileInfo, CurLine, "NumBeam", InputFileData%NumBeam, TmpErrStat, TmpErrMsg, UnEc ) if (Failed()) return - ! Before proceeding, make sure that NumBeam makes sense - IF ((InputFileData%SensorType == 1) .and. (InputFileData%NumBeam < 1 .OR. InputFileData%NumBeam > 5)) THEN - CALL SetErrStat( ErrID_Fatal, 'NumBeam must be greater than or equal to one and less than 6.', & - ErrStat, ErrMsg, RoutineName ) - RETURN - ELSE - ! Allocate space for the output location arrays: - CALL AllocAry( InputFileData%FocalDistanceX, InputFileData%NumBeam, 'FocalDistanceX', TmpErrStat, TmpErrMsg ); CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName ) - CALL AllocAry( InputFileData%FocalDistanceY, InputFileData%NumBeam, 'FocalDistanceY', TmpErrStat, TmpErrMsg ); CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName ) - CALL AllocAry( InputFileData%FocalDistanceZ, InputFileData%NumBeam, 'FocalDistanceZ', TmpErrStat, TmpErrMsg ); CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName ) - if (Failed()) return - ENDIF + ! Before proceeding, make sure that NumBeam makes sense for array allocation + InputFileData%NumBeam = MAX(InputFileData%NumBeam, 1) + + ! Allocate space for the output location arrays: + CALL AllocAry( InputFileData%FocalDistanceX, InputFileData%NumBeam, 'FocalDistanceX', TmpErrStat, TmpErrMsg ); CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName ) + CALL AllocAry( InputFileData%FocalDistanceY, InputFileData%NumBeam, 'FocalDistanceY', TmpErrStat, TmpErrMsg ); CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName ) + CALL AllocAry( InputFileData%FocalDistanceZ, InputFileData%NumBeam, 'FocalDistanceZ', TmpErrStat, TmpErrMsg ); CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName ) + if (Failed()) return ! Focal Distance X CALL ParseAry( InFileInfo, CurLine, 'FocalDistanceX', InputFileData%FocalDistanceX, InputFileData%NumBeam, TmpErrStat, TmpErrMsg, UnEc ) @@ -647,7 +643,7 @@ SUBROUTINE InflowWind_ValidateInput( InitInp, InputFileData, ErrStat, ErrMsg ) return end if - if (InitInp%lidar%SensorType /= SensorType_None) then + if (InputFileData%SensorType /= SensorType_None) then call SetErrStat(ErrID_Fatal, 'InflowWind can not perform linearization with the lidar module enabled.', ErrStat, ErrMsg, RoutineName) return end if @@ -1177,7 +1173,7 @@ SUBROUTINE SetOutParam(OutList, p, ErrStat, ErrMsg ) ! Passed variables CHARACTER(ChanLen), INTENT(IN) :: OutList(:) !< The list of user-requested outputs - TYPE(InflowWind_ParameterType), INTENT(INOUT) :: p !< The module parameters + TYPE(InflowWind_ParameterType), INTENT(INOUT) :: p !< The module parameters INTEGER(IntKi), INTENT(OUT) :: ErrStat !< The error status code CHARACTER(*), INTENT(OUT) :: ErrMsg !< The error message, if an error occurred @@ -1288,17 +1284,9 @@ SUBROUTINE SetOutParam(OutList, p, ErrStat, ErrMsg ) InvalidOutput(WindAccZ) = .TRUE. end if - if (p%lidar%SensorType /= SensorType_None) then - IF (p%lidar%SensorType == SensorType_SinglePoint) THEN - DO I=p%lidar%NumBeam+1,5 - InvalidOutput( WindMeas(I) ) = .TRUE. - END DO - ELSE - DO I=p%lidar%NumPulseGate+1,5 - InvalidOutput( WindMeas(I) ) = .TRUE. - END DO - END IF - endif + do I=p%lidar%NumMeasurements+1,SIZE(WindMeas) + InvalidOutput( WindMeas(I) ) = .TRUE. + end do ! ................. End of validity checking ................. @@ -1521,16 +1509,10 @@ SUBROUTINE SetAllOuts( p, y, m, ErrStat, ErrMsg ) !FIXME: Add in Wind1Dir etc. -- although those can be derived outside of FAST. - if (p%lidar%SensorType /= SensorType_None) then - IF ( p%lidar%SensorType == SensorType_SinglePoint) THEN - DO I = 1,MIN(5, p%lidar%NumBeam ) - m%AllOuts( WindMeas(I) ) = y%lidar%LidSpeed(I) - END DO - ELSE - DO I = 1,MIN(5, p%lidar%NumPulseGate ) - m%AllOuts( WindMeas(I) ) = y%lidar%LidSpeed(I) - END DO - END IF + if (ALLOCATED(y%lidar%LidSpeed)) then + DO I = 1,MIN(SIZE(WindMeas), SIZE(y%lidar%LidSpeed) ) + m%AllOuts( WindMeas(I) ) = y%lidar%LidSpeed(I) + END DO endif END SUBROUTINE SetAllOuts diff --git a/modules/inflowwind/src/InflowWind_Types.f90 b/modules/inflowwind/src/InflowWind_Types.f90 index 646d366064..f820e6e9bf 100644 --- a/modules/inflowwind/src/InflowWind_Types.f90 +++ b/modules/inflowwind/src/InflowWind_Types.f90 @@ -94,7 +94,7 @@ MODULE InflowWind_Types REAL(ReKi) :: MeasurementInterval = 0.0_ReKi !< Time between each measurement [s] REAL(ReKi) :: URefLid = 0.0_ReKi !< Reference average wind speed for the lidar [m/s] LOGICAL :: LidRadialVel = .false. !< TRUE => return radial component, FALSE => return 'x' direction estimate [-] - INTEGER(IntKi) :: ConsiderHubMotion = 0_IntKi !< Flag whether or not the hub motion's impact on the Lidar measurement will be considered [0 for no, 1 for yes] [-] + INTEGER(IntKi) :: ConsiderHubMotion = 0_IntKi !< whether or not the hub motion's impact on the Lidar measurement will be considered [-] TYPE(Grid3D_InitInputType) :: FF !< scaling data [-] END TYPE InflowWind_InputFile ! ======================= @@ -111,7 +111,6 @@ MODULE InflowWind_Types TYPE(FileInfoType) :: PassedFileInfo !< If we don't use the input file, pass everything through this [FilePassingMethod = 1] [-] TYPE(InflowWind_InputFile) :: PassedFileData !< If we don't use the input file, pass everything through this [FilePassingMethod = 2] [-] LOGICAL :: OutputAccel = .FALSE. !< Flag to output wind acceleration [-] - TYPE(Lidar_InitInputType) :: lidar !< InitInput for lidar data [-] TYPE(Grid4D_InitInputType) :: FDext !< InitInput for 4D external wind data [-] REAL(ReKi) :: RadAvg = 0.0_ReKi !< Radius (from hub) used for averaging wind speed [-] INTEGER(IntKi) :: MHK = 0_IntKi !< MHK turbine type switch [-] @@ -119,6 +118,7 @@ MODULE InflowWind_Types REAL(ReKi) :: MSL2SWL = 0.0_ReKi !< Mean sea level to still water level [m] LOGICAL :: BoxExceedAllow = .FALSE. !< Flag to allow Extrapolation winds outside box starting at this index (for OLAF wakes and LidarSim) [-] LOGICAL :: LidarEnabled = .false. !< Enable LiDAR for this instance of InflowWind? (FAST.Farm, ADI, and InflowWind driver/library are not compatible) [-] + REAL(ReKi) , DIMENSION(1:3) :: HubPosition = 0.0_ReKi !< initial position of the hub (lidar mounted on hub) [0,0,HubHeight] [m] END TYPE InflowWind_InitInputType ! ======================= ! ========= InflowWind_InitOutputType ======= @@ -511,9 +511,6 @@ subroutine InflowWind_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if (ErrStat >= AbortErrLev) return DstInitInputData%OutputAccel = SrcInitInputData%OutputAccel - call Lidar_CopyInitInput(SrcInitInputData%lidar, DstInitInputData%lidar, CtrlCode, ErrStat2, ErrMsg2) - call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - if (ErrStat >= AbortErrLev) return call InflowWind_IO_CopyGrid4D_InitInputType(SrcInitInputData%FDext, DstInitInputData%FDext, CtrlCode, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) if (ErrStat >= AbortErrLev) return @@ -523,6 +520,7 @@ subroutine InflowWind_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode DstInitInputData%MSL2SWL = SrcInitInputData%MSL2SWL DstInitInputData%BoxExceedAllow = SrcInitInputData%BoxExceedAllow DstInitInputData%LidarEnabled = SrcInitInputData%LidarEnabled + DstInitInputData%HubPosition = SrcInitInputData%HubPosition end subroutine subroutine InflowWind_DestroyInitInput(InitInputData, ErrStat, ErrMsg) @@ -538,8 +536,6 @@ subroutine InflowWind_DestroyInitInput(InitInputData, ErrStat, ErrMsg) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) call InflowWind_DestroyInputFile(InitInputData%PassedFileData, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) - call Lidar_DestroyInitInput(InitInputData%lidar, ErrStat2, ErrMsg2) - call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) call InflowWind_IO_DestroyGrid4D_InitInputType(InitInputData%FDext, ErrStat2, ErrMsg2) call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) end subroutine @@ -560,7 +556,6 @@ subroutine InflowWind_PackInitInput(RF, Indata) call NWTC_Library_PackFileInfoType(RF, InData%PassedFileInfo) call InflowWind_PackInputFile(RF, InData%PassedFileData) call RegPack(RF, InData%OutputAccel) - call Lidar_PackInitInput(RF, InData%lidar) call InflowWind_IO_PackGrid4D_InitInputType(RF, InData%FDext) call RegPack(RF, InData%RadAvg) call RegPack(RF, InData%MHK) @@ -568,6 +563,7 @@ subroutine InflowWind_PackInitInput(RF, Indata) call RegPack(RF, InData%MSL2SWL) call RegPack(RF, InData%BoxExceedAllow) call RegPack(RF, InData%LidarEnabled) + call RegPack(RF, InData%HubPosition) if (RegCheckErr(RF, RoutineName)) return end subroutine @@ -587,7 +583,6 @@ subroutine InflowWind_UnPackInitInput(RF, OutData) call NWTC_Library_UnpackFileInfoType(RF, OutData%PassedFileInfo) ! PassedFileInfo call InflowWind_UnpackInputFile(RF, OutData%PassedFileData) ! PassedFileData call RegUnpack(RF, OutData%OutputAccel); if (RegCheckErr(RF, RoutineName)) return - call Lidar_UnpackInitInput(RF, OutData%lidar) ! lidar call InflowWind_IO_UnpackGrid4D_InitInputType(RF, OutData%FDext) ! FDext call RegUnpack(RF, OutData%RadAvg); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%MHK); if (RegCheckErr(RF, RoutineName)) return @@ -595,6 +590,7 @@ subroutine InflowWind_UnPackInitInput(RF, OutData) call RegUnpack(RF, OutData%MSL2SWL); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%BoxExceedAllow); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%LidarEnabled); if (RegCheckErr(RF, RoutineName)) return + call RegUnpack(RF, OutData%HubPosition); if (RegCheckErr(RF, RoutineName)) return end subroutine subroutine InflowWind_CopyInitOutput(SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg) diff --git a/modules/inflowwind/src/Lidar.f90 b/modules/inflowwind/src/Lidar.f90 index ddb5861b0e..f0dd9a1e71 100644 --- a/modules/inflowwind/src/Lidar.f90 +++ b/modules/inflowwind/src/Lidar.f90 @@ -62,15 +62,12 @@ MODULE Lidar !! The parameters are set here and not changed during the simulation. !! The initial states and initial guess for the input are defined. !! note that we're calling this with the InflowWind data types, so that data is INOUT instead of OUT -SUBROUTINE Lidar_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitOut, ErrStat, ErrMsg ) +SUBROUTINE Lidar_Init( InitInp, InputFileData, u, p, y, m, Interval, ErrStat, ErrMsg ) TYPE(InflowWind_InitInputType), INTENT(IN ) :: InitInp !< Input data for initialization routine + TYPE(InflowWind_InputFile), INTENT(INOUT) :: InputFileData !< Data from input file TYPE(InflowWind_InputType), INTENT(INOUT) :: u !< An initial guess for the input; input mesh must be defined TYPE(InflowWind_ParameterType), INTENT(INOUT) :: p !< Parameters - TYPE(InflowWind_ContinuousStateType), INTENT(INOUT) :: x !< Initial continuous states - TYPE(InflowWind_DiscreteStateType), INTENT(INOUT) :: xd !< Initial discrete states - TYPE(InflowWind_ConstraintStateType), INTENT(INOUT) :: z !< Initial guess of the constraint states - TYPE(InflowWind_OtherStateType), INTENT(INOUT) :: OtherState !< Initial other states TYPE(InflowWind_MiscVarType), INTENT(INOUT) :: m !< Misc variables for optimization (not copied in glue code) TYPE(InflowWind_OutputType), INTENT(INOUT) :: y !< Initial system outputs (outputs are not calculated; !! only the output mesh is initialized) @@ -80,16 +77,15 @@ SUBROUTINE Lidar_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init !! Input is the suggested time from the glue code; !! Output is the actual coupling interval that will be used !! by the glue code. - TYPE(InflowWind_InitOutputType), INTENT(INOUT) :: InitOut !< Output for initialization routine INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None ! Temporary variables for error handling - INTEGER(IntKi) :: TmpErrStat !< temporary error message - CHARACTER(ErrMsgLen) :: TmpErrMsg + INTEGER(IntKi) :: TmpErrStat !< temporary error message + CHARACTER(ErrMsgLen) :: TmpErrMsg ! local variables - INTEGER(IntKi) :: IBeam + INTEGER(IntKi) :: IBeam INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None @@ -102,148 +98,111 @@ SUBROUTINE Lidar_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init ErrStat = ErrID_None ErrMsg = "" - ! Check for errors in the InflowWind Input File - - ! Make sure that NumPulseGate makes sense - IF ( (p%lidar%SensorType == 3) .and. (p%lidar%NumPulseGate < 0 .OR. p%lidar%NumPulseGate > 5) ) THEN - CALL SetErrStat( ErrID_Fatal, 'NumPulseGate must be greater than or equal to zero and less than 5.', & - ErrStat, ErrMsg, RoutineName ) - RETURN - ENDIF - - ! Make sure that multiple beams are only used when using single point beams - IF ( p%lidar%NumBeam > 1 .AND. p%lidar%SensorType > 1) THEN - CALL SetErrStat( ErrID_Fatal, 'Multiple beams can only be used with single point lidar', & - ErrStat, ErrMsg, RoutineName ) - RETURN - ENDIF - - CALL AllocAry(p%lidar%MsrPosition , 3, max(1,p%lidar%NumBeam), 'Array for measurement coordinates', TmpErrStat, TmpErrMsg ) - CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName) - IF ( ErrStat>= AbortErrLev ) RETURN - - - IF (p%lidar%SensorType == SensorType_None) THEN + p%lidar%SensorType = InputFileData%SensorType + if (p%lidar%SensorType == SensorType_None) then p%lidar%NumPulseGate = 0 - ELSEIF (p%lidar%SensorType == SensorType_SinglePoint) THEN - p%lidar%NumPulseGate = 1 - ELSE - - ! variables for both pulsed and continuous-wave lidars - + p%lidar%NumBeam = 0 + return + else + p%lidar%NumBeam = InputFileData%NumBeam + p%lidar%RotorApexOffsetPos = InputFileData%RotorApexOffsetPos + p%lidar%LidRadialVel = InputFileData%LidRadialVel + p%lidar%NumPulseGate = InputFileData%NumPulseGate + call move_alloc(InputFileData%FocalDistanceX, p%lidar%FocalDistanceX) + call move_alloc(InputFileData%FocalDistanceY, p%lidar%FocalDistanceY) + call move_alloc(InputFileData%FocalDistanceZ, p%lidar%FocalDistanceZ) + p%lidar%MeasurementInterval= InputFileData%MeasurementInterval + p%lidar%PulseSpacing = InputFileData%PulseSpacing + p%lidar%URefLid = InputFileData%URefLid + p%lidar%ConsiderHubMotion = InputFileData%ConsiderHubMotion + + if (p%lidar%SensorType == SensorType_SinglePoint) then + p%lidar%NumPulseGate = 1 + if ( (p%lidar%NumBeam < 1 .OR. p%lidar%NumBeam > 5) ) then + call SetErrStat( ErrID_Fatal, 'NumBeam must be greater than zero and less than 6.', ErrStat, ErrMsg, RoutineName ) + return + endif - - p%lidar%SpatialRes = 0.5_ReKi*p%lidar%URefLid*Interval - p%lidar%RayRangeSq = (Pi*(BeamRad**2)/LsrWavLen)**2 - + else - - - IF (p%lidar%SensorType == SensorType_ContinuousLidar) THEN + ! Make sure that multiple beams are only used when using single-point beams + if ( p%lidar%NumBeam > 1 ) then + call SetErrStat( ErrID_Fatal, 'Multiple beams can only be used with single point lidar', ErrStat, ErrMsg, RoutineName ) + return + endif + p%lidar%NumBeam = 1 + + ! variables for both pulsed and continuous-wave lidars + p%lidar%SpatialRes = 0.5_ReKi*p%lidar%URefLid*Interval + p%lidar%RayRangeSq = (Pi*(BeamRad**2)/LsrWavLen)**2 - p%lidar%WtFnTrunc = 0.02_ReKi - p%lidar%NumPulseGate = 1 - - ELSEIF (p%lidar%SensorType == SensorType_PulsedLidar) THEN + if (p%lidar%SensorType == SensorType_ContinuousLidar) then + p%lidar%NumPulseGate = 1 + p%lidar%WtFnTrunc = 0.02_ReKi + elseif (p%lidar%SensorType == SensorType_PulsedLidar) then - p%lidar%WtFnTrunc = 0.01_ReKi + ! Make sure that NumPulseGate makes sense + if ( (p%lidar%NumPulseGate < 1 .OR. p%lidar%NumPulseGate > 5) ) then + call SetErrStat( ErrID_Fatal, 'NumPulseGate must be greater than zero and less than 6.', ErrStat, ErrMsg, RoutineName ) + return + endif + p%lidar%WtFnTrunc = 0.01_ReKi + ! values for the WindCube + p%lidar%DeltaR = 30.0_ReKi + ! p%lidar%PulseRangeOne = 50.0 ReKi ! Replaced by the focal distance; bjj: it's used in an IF statement, so initializing below: + p%lidar%PulseRangeOne = 0.0_ReKi - ! values for the WindCube - ! p%lidar%DeltaP = 30.0_ReKi !Replaced by pulse spacing - p%lidar%DeltaR = 30.0_ReKi - ! p%lidar%PulseRangeOne = 50.0 ReKi ! Replaced by the focal distance - - p%lidar%r_p = p%lidar%DeltaR/(2.0_ReKi*SQRT(LOG(2.0_ReKi))) + p%lidar%r_p = p%lidar%DeltaR/(2.0_ReKi*SQRT(LOG(2.0_ReKi))) - ELSE - - CALL SetErrStat(ErrID_Fatal, "Invalid sensor type.", ErrStat, ErrMsg, RoutineName) - RETURN - - END IF - - END IF - - - !............................................................................................ - ! Define initial system states here: - !............................................................................................ + else + call SetErrStat(ErrID_Fatal, "Invalid sensor type.", ErrStat, ErrMsg, RoutineName) + return + end if + end if + end if ! no lidar - !x%lidar%DummyContState = 0.0_ReKi - !xdlidar%%DummyDiscState = 0.0_ReKi - !z%lidar%DummyConstrState = 0.0_ReKi - !OtherState%lidar%DummyOtherState = 0.0_ReKi - ! - !............................................................................................ - ! Define initial guess for the system inputs here: - !............................................................................................ + p%lidar%LidPosition = InitInp%HubPosition + p%lidar%NumMeasurements = MAX(p%lidar%NumBeam,p%lidar%NumPulseGate) !note, this is at least 1 for every case (except SensorType_None, which cannot get to this place) + + CALL AllocAry(p%lidar%MsrPosition , 3, p%lidar%NumBeam, 'Array for measurement coordinates (per beam)', TmpErrStat, TmpErrMsg ) + CALL SetErrStat( TmpErrStat, TmpErrMsg, ErrStat, ErrMsg, RoutineName) + IF ( ErrStat>= AbortErrLev ) RETURN - p%lidar%LidPosition = InitInp%lidar%HubPosition DO IBeam = 1,p%lidar%NumBeam - p%lidar%MsrPosition(:,IBeam) = (/ p%lidar%FocalDistanceX(IBeam), p%lidar%FocalDistanceY(IBeam), p%lidar%FocalDistanceZ(IBeam) /) !bjj: todo FIXME with initial guess of lidar focus. + p%lidar%MsrPosition(:,IBeam) = (/ p%lidar%FocalDistanceX(IBeam), p%lidar%FocalDistanceY(IBeam), p%lidar%FocalDistanceZ(IBeam) /) ! bjj: todo FIXME with initial guess of lidar focus. END DO + + !............................................................................................ + ! Define initial guess for the system inputs here: + !............................................................................................ u%lidar%PulseLidEl = 0.0_ReKi u%lidar%PulseLidAz = 0.0_ReKi - !............................................................................................ - ! Define system output initializations (set up mesh) here: + ! Define system output initializations here: !............................................................................................ - !CALL AllocAry( y%WriteOutput, p%NumOuts, 'WriteOutput', ErrStat2, ErrMsg2 ) - ! CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - ! IF (ErrStat >= AbortErrLev) RETURN - !y%WriteOutput = 0 - - IF (p%lidar%SensorType == SensorType_SinglePoint) THEN - CALL AllocAry( y%lidar%LidSpeed, p%lidar%NumBeam, 'y%lidar%LidSpeed', ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ); + CALL AllocAry( y%lidar%LidSpeed, p%lidar%NumMeasurements, 'y%lidar%LidSpeed', ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ); - !CALL AllocAry( y%LidErr, p%NumPulseGate, 'y%LidErr', ErrStat2, ErrMsg2 ) - ! CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ); - - CALL AllocAry( y%lidar%WtTrunc, p%lidar%NumBeam, 'y%lidar%WtTrunc', ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ); - - CALL AllocAry( y%lidar%MsrPositionsX, p%lidar%NumBeam, 'y%lidar%MsrPositionsX', ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ); - - CALL AllocAry( y%lidar%MsrPositionsY, p%lidar%NumBeam, 'y%lidar%MsrPositionsY', ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ); + CALL AllocAry( y%lidar%WtTrunc, p%lidar%NumMeasurements, 'y%lidar%WtTrunc', ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ); - CALL AllocAry( y%lidar%MsrPositionsZ, p%lidar%NumBeam, 'y%lidar%MsrPositionsZ', ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ); - ELSEIF (p%lidar%NumPulseGate > 0) then ! the Cray Fortran compiler doesn't like allocating size zero - CALL AllocAry( y%lidar%LidSpeed, p%lidar%NumPulseGate, 'y%lidar%LidSpeed', ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ); - - !CALL AllocAry( y%LidErr, p%NumPulseGate, 'y%LidErr', ErrStat2, ErrMsg2 ) - !CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ); - - CALL AllocAry( y%lidar%WtTrunc, p%lidar%NumPulseGate, 'y%lidar%WtTrunc', ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ); + CALL AllocAry( y%lidar%MsrPositionsX, p%lidar%NumMeasurements, 'y%lidar%MsrPositionsX', ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ); - CALL AllocAry( y%lidar%MsrPositionsX, p%lidar%NumPulseGate, 'y%lidar%MsrPositionsX', ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ); + CALL AllocAry( y%lidar%MsrPositionsY, p%lidar%NumMeasurements, 'y%lidar%MsrPositionsY', ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ); - CALL AllocAry( y%lidar%MsrPositionsY, p%lidar%NumPulseGate, 'y%lidar%MsrPositionsY', ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ); - - CALL AllocAry( y%lidar%MsrPositionsZ, p%lidar%NumPulseGate, 'y%lidar%MsrPositionsZ', ErrStat2, ErrMsg2 ) - CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ); - ENDIF - + CALL AllocAry( y%lidar%MsrPositionsZ, p%lidar%NumMeasurements, 'y%lidar%MsrPositionsZ', ErrStat2, ErrMsg2 ) + CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ); IF (ErrStat >= AbortErrLev) RETURN - if (allocated(y%lidar%LidSpeed)) y%lidar%LidSpeed = 0.0 - if (allocated(y%lidar%WtTrunc )) y%lidar%WtTrunc = 0.0 - - !............................................................................................ - ! Define initialization-routine output here: - !............................................................................................ + y%lidar%LidSpeed = 0.0 + y%lidar%WtTrunc = 0.0 RETURN @@ -304,16 +263,12 @@ END SUBROUTINE Lidar_End !> Routine for computing outputs, used in both loose and tight coupling. !! @note this breaks the framework because we're passing the IfW types instead of the Lidar types... this is necessary to get !! appropriate wind speeds for the lidar measurements. -SUBROUTINE Lidar_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg ) +SUBROUTINE Lidar_CalcOutput( t, u, p, y, m, ErrStat, ErrMsg ) !.................................................................................................................................. REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds TYPE(InflowWind_InputType), INTENT(IN ) :: u !< Inputs at t TYPE(InflowWind_ParameterType), INTENT(IN ) :: p !< Parameters - TYPE(InflowWind_ContinuousStateType), INTENT(IN ) :: x !< Continuous states at t - TYPE(InflowWind_DiscreteStateType), INTENT(IN ) :: xd !< Discrete states at t - TYPE(InflowWind_ConstraintStateType), INTENT(IN ) :: z !< Constraint states at t - TYPE(InflowWind_OtherStateType), INTENT(IN ) :: OtherState !< Other/optimization states TYPE(InflowWind_OutputType), INTENT(INOUT) :: y !< Outputs computed at t (Input only so that mesh con- !! nectivity information does not have to be recalculated) TYPE(InflowWind_MiscVarType), INTENT(INOUT) :: m !< Misc variables for optimization (not copied in glue code) @@ -357,37 +312,37 @@ SUBROUTINE Lidar_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMs ErrStat = ErrID_None ErrMsg = "" - + + IF (p%lidar%SensorType == SensorType_None) RETURN + MeasurementCurrentStep = INT(t / p%lidar%MeasurementInterval) IF ( (p%lidar%MeasurementInterval * MeasurementCurrentStep) /= t ) THEN - VelocityUVW(:,1) = 0 + !bjj: note: no error set; no output set. RETURN ENDIF - + LidPosition = p%lidar%LidPosition + p%lidar%RotorApexOffsetPos ! lidar offset-from-rotor-apex position - IF (p%lidar%ConsiderHubMotion == 1) THEN + IF (p%lidar%ConsiderHubMotion /= 0) THEN LidPosition = LidPosition + (/ u%lidar%HubDisplacementX, u%lidar%HubDisplacementY, u%lidar%HubDisplacementZ /) ! rotor apex position (absolute) END IF - IF (p%lidar%SensorType == SensorType_None) RETURN - !............................................................................................................................... ! Compute the outputs !............................................................................................................................... - ! Initialize position to zero in case no all values are set + ! Initialize position to zero in case not all values are set PositionXYZ = 0.0_ReKi + IBeam = 1 IF (p%lidar%SensorType == SensorType_SinglePoint) THEN DO IBeam = 1,p%lidar%NumBeam !get lidar speed at the focal point to see if it is out of bounds - PositionXYZ(:,1) = LidPosition + p%lidar%MsrPosition(:,IBeam) + PositionXYZ(:,1) = LidPosition + p%lidar%MsrPosition(:,IBeam) - call IfW_FlowField_GetVelAcc(p%FlowField, 0, t, PositionXYZ, VelocityUVW, & - AccelUVW, ErrStat2, ErrMsg2, BoxExceedAllow=.true.) + call IfW_FlowField_GetVelAcc(p%FlowField, 0, t, PositionXYZ, VelocityUVW, AccelUVW, ErrStat2, ErrMsg2, BoxExceedAllow=.true.) call SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) y%lidar%LidSpeed(IBeam) = SQRT( DOT_PRODUCT(VelocityUVW(:,1), VelocityUVW(:,1)) ) @@ -395,15 +350,16 @@ SUBROUTINE Lidar_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMs y%lidar%MsrPositionsX(IBeam) = PositionXYZ(1,1) y%lidar%MsrPositionsY(IBeam) = PositionXYZ(2,1) - y%lidar%MsrPositionsZ(IBeam) = PositionXYZ(3,1) + y%lidar%MsrPositionsZ(IBeam) = PositionXYZ(3,1) END DO ELSEIF (p%lidar%SensorType == SensorType_ContinuousLidar) THEN !calculate the focal distance of the lidar as well as the modified focal distance so that the peak of the weighting func !is at the intended focal distance - - Distance = p%lidar%MsrPosition(:,1) - LidPosition + IBeam = 1 + + Distance = p%lidar%MsrPosition(:,IBeam) - LidPosition FocDist = SQRT( DOT_PRODUCT( Distance, Distance ) ) !TwoNorm IF(EqualRealNos(FocDist,0.0_ReKi)) THEN ! Avoid division-by-zero @@ -429,19 +385,17 @@ SUBROUTINE Lidar_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMs LidWtRatio = 1.0_ReKi !LidWt/LidWtMax !get lidar speed at the focal point to see if it is out of bounds - PositionXYZ(:,1) = LidPosition + p%lidar%MsrPosition(:,1) + PositionXYZ(:,1) = LidPosition + p%lidar%MsrPosition(:,IBeam) - y%lidar%MsrPositionsX(1) = LidPosition(1) + p%lidar%MsrPosition(1,1) - y%lidar%MsrPositionsY(1) = LidPosition(2) + p%lidar%MsrPosition(2,1) - y%lidar%MsrPositionsZ(1) = LidPosition(3) + p%lidar%MsrPosition(3,1) + y%lidar%MsrPositionsX(IBeam) = PositionXYZ(1,1) + y%lidar%MsrPositionsY(IBeam) = PositionXYZ(2,1) + y%lidar%MsrPositionsZ(IBeam) = PositionXYZ(3,1) - CALL IfW_FlowField_GetVelAcc(p%FlowField, 0, t, PositionXYZ, VelocityUVW, & - AccelUVW, ErrStat2, ErrMsg2, BoxExceedAllow=.true.) - CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + CALL IfW_FlowField_GetVelAcc(p%FlowField, 0, t, PositionXYZ(:,1:1), VelocityUVW(:,1:1), AccelUVW, ErrStat2, ErrMsg2, BoxExceedAllow=.true.) + CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) !if out of bounds IF (ErrStat >= AbortErrLev) THEN - !y%lidar%LidErr = 1 y%lidar%LidSpeed = -99.0 RETURN !escape function ENDIF @@ -474,7 +428,6 @@ SUBROUTINE Lidar_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMs IF (LidRange > FocDist) THEN IF (NWTC_VerboseLevel == NWTC_Verbose) & CALL SetErrStat( ErrID_Info, "Lidar truncation point is behind the lidar. Truncation ratio is "//trim(num2lstr(LidWtRatio))//'.', ErrStat, ErrMsg, RoutineName) ! set informational message about point being behind lidar - !y%LidErr = 3 y%lidar%WtTrunc = LidWtRatio EXIT ENDIF @@ -490,17 +443,15 @@ SUBROUTINE Lidar_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMs PositionXYZ(1,2) = LidPosition(1) - COS(LidTheta)*COS(LidPhi)*(FocDist - LidRange) PositionXYZ(2,2) = LidPosition(2) + SIN(LidTheta)*COS(LidPhi)*(FocDist - LidRange) - CALL IfW_FlowField_GetVelAcc(p%FlowField, 0, t, PositionXYZ, VelocityUVW, & - AccelUVW, ErrStat2, ErrMsg2, BoxExceedAllow=.true.) + CALL IfW_FlowField_GetVelAcc(p%FlowField, 0, t, PositionXYZ, VelocityUVW, AccelUVW, ErrStat2, ErrMsg2, BoxExceedAllow=.true.) IF (ErrStat2 >= AbortErrLev) THEN !out of bounds IF (NWTC_VerboseLevel == NWTC_Verbose) & CALL SetErrStat( ErrID_Warn, "Lidar speed truncated. Truncation ratio is "//trim(num2lstr(LidWtRatio))//".", ErrStat, ErrMsg, RoutineName ) - !y%LidErr = 2 y%lidar%WtTrunc = LidWtRatio EXIT ENDIF - y%lidar%LidSpeed = y%lidar%LidSpeed + LidWt*DOT_PRODUCT(-1*LidDirUnVec, VelocityUVW(:,1) + VelocityUVW(:,2)) + y%lidar%LidSpeed = y%lidar%LidSpeed + LidWt*DOT_PRODUCT(-1*LidDirUnVec, VelocityUVW(:,1) + VelocityUVW(:,2)) WtFuncSum = WtFuncSum + 2*LidWt END DO @@ -516,40 +467,38 @@ SUBROUTINE Lidar_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMs ENDIF ELSE !p%SensorType == SensorType_PulsedLidar + IBeam = 1 - - + !bjj: note that u%lidar%PulseLidEl and u%lidar%PulseLidAz are not set in the calling code, so they are always 0 LidDirUnVec(1) = -1*COS(u%lidar%PulseLidEl) LidDirUnVec(2) = SIN(u%lidar%PulseLidEl)*SIN(u%lidar%PulseLidAz) LidDirUnVec(3) = SIN(u%lidar%PulseLidEl)*COS(u%lidar%PulseLidAz) - DO IRangeGt = 1,p%lidar%NumPulseGate - !y%lidar%LidErr(IRangeGt) = 0 - - LidPosition(2) = LidPosition(2) + p%lidar%MsrPosition(2,1) - LidPosition(3) = LidPosition(3) + p%lidar%MsrPosition(3,1) + !bjj: do the y- and z- components of PositionXYZ make sense here? It looks like they assume p%lidar%MsrPosition(2:3,IBeam) are zero + + LidPosition(2) = LidPosition(2) + p%lidar%MsrPosition(2,IBeam) + LidPosition(3) = LidPosition(3) + p%lidar%MsrPosition(3,IBeam) - !get lidar speed at the focal point to see if it is out of bounds - PositionXYZ(:,1) = LidPosition + LidDirUnVec*(-p%lidar%MsrPosition(1,1) - (IRangeGt-1)*p%lidar%PulseSpacing) + !get lidar speed at the focal point to see if it is out of bounds; bjj: this equation looks strange to me. Note how the X component is used to modify Y and Z. + PositionXYZ(:,1) = LidPosition + LidDirUnVec*(-p%lidar%MsrPosition(1,IBeam) - (IRangeGt-1)*p%lidar%PulseSpacing) - y%lidar%MsrPositionsX(IRangeGt) = LidPosition(1) + LidDirUnVec(1)*(-p%lidar%MsrPosition(1,1) - (IRangeGt-1)*p%lidar%PulseSpacing) - y%lidar%MsrPositionsY(IRangeGt) = LidPosition(2) + p%lidar%MsrPosition(2,1) - y%lidar%MsrPositionsZ(IRangeGt) = LidPosition(3) + p%lidar%MsrPosition(3,1) + !bjj: I don't think this makes any sense in the Y and Z components. Will modify MsrPositionsY and MsrPositionsZ + y%lidar%MsrPositionsX(IRangeGt) = PositionXYZ(1,1) + y%lidar%MsrPositionsY(IRangeGt) = PositionXYZ(2,1) ! was LidPosition(2) + p%lidar%MsrPosition(2,IBeam), adding p%lidar%MsrPosition(2,IBeam) to the position AGAIN + y%lidar%MsrPositionsZ(IRangeGt) = PositionXYZ(3,1) ! was LidPosition(3) + p%lidar%MsrPosition(3,IBeam) - CALL IfW_FlowField_GetVelAcc(p%FlowField, 0, t, PositionXYZ, VelocityUVW, & - AccelUVW, ErrStat2, ErrMsg2, BoxExceedAllow=.true.) + CALL IfW_FlowField_GetVelAcc(p%FlowField, 0, t, PositionXYZ(:,1:1), VelocityUVW(:,1:1), AccelUVW, ErrStat2, ErrMsg2, BoxExceedAllow=.true.) CALL SetErrStat( ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - LidWt = NWTC_ERF((p%lidar%PulseSpacing/2)/p%lidar%r_p)/p%lidar%PulseSpacing + LidWt = NWTC_ERF((p%lidar%PulseSpacing/2)/p%lidar%r_p)/p%lidar%PulseSpacing LidWtMax = LidWt LidWtRatio = 1.0_ReKi !LidWt/LidWtMax !if out of bounds IF (ErrStat2 >= AbortErrLev) THEN - !y%LidErr(IRangeGt) = 1 y%lidar%LidSpeed(IRangeGt) = -99 RETURN !escape function ENDIF @@ -580,26 +529,23 @@ SUBROUTINE Lidar_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMs IF (NWTC_VerboseLevel == NWTC_Verbose) & CALL SetErrStat( ErrID_Info, "Lidar truncation point at gate "//trim(num2lstr(IRangeGt))//" is behind the lidar. Truncation ratio is "& //trim(num2lstr(LidWtRatio))//'.', ErrStat, ErrMsg, RoutineName) ! set informational message about point being behind lidar - !y%LidErr(IRangeGt) = 3 y%lidar%WtTrunc(IRangeGt) = LidWtRatio EXIT ENDIF !calculate points to scan for current beam point - PositionXYZ(:,1) = LidPosition + LidDirUnVec*(-p%lidar%MsrPosition(1,1) - (IRangeGt-1)*p%lidar%PulseSpacing + LidRange) - PositionXYZ(:,2) = LidPosition + LidDirUnVec*(-p%lidar%MsrPosition(1,1) - (IRangeGt-1)*p%lidar%PulseSpacing - LidRange) - CALL IfW_FlowField_GetVelAcc(p%FlowField, 0, t, PositionXYZ, VelocityUVW, & - AccelUVW, ErrStat2, ErrMsg2, BoxExceedAllow=.true.) + PositionXYZ(:,1) = LidPosition + LidDirUnVec*(-p%lidar%MsrPosition(1,IBeam) - (IRangeGt-1)*p%lidar%PulseSpacing + LidRange) + PositionXYZ(:,2) = LidPosition + LidDirUnVec*(-p%lidar%MsrPosition(1,IBeam) - (IRangeGt-1)*p%lidar%PulseSpacing - LidRange) + CALL IfW_FlowField_GetVelAcc(p%FlowField, 0, t, PositionXYZ, VelocityUVW, AccelUVW, ErrStat2, ErrMsg2, BoxExceedAllow=.true.) IF (ErrStat2 >= AbortErrLev) THEN !out of bounds IF (NWTC_VerboseLevel == NWTC_Verbose) & CALL SetErrStat( ErrID_Warn, "Lidar speed at gate "//trim(num2lstr(IRangeGt))//" truncated. Truncation ratio is "//trim(num2lstr(LidWtRatio))//".", ErrStat, ErrMsg, RoutineName ) - !y%LidErr(IRangeGt) = 2 y%lidar%WtTrunc(IRangeGt) = LidWtRatio EXIT ENDIF - y%lidar%LidSpeed(IRangeGt) = y%lidar%LidSpeed(IRangeGt) + LidWt*DOT_PRODUCT(-1*LidDirUnVec,VelocityUVW(:,1) + VelocityUVW(:,2)) + y%lidar%LidSpeed(IRangeGt) = y%lidar%LidSpeed(IRangeGt) + LidWt*DOT_PRODUCT(-1*LidDirUnVec,VelocityUVW(:,1) + VelocityUVW(:,2)) WtFuncSum = WtFuncSum + 2*LidWt END DO @@ -613,9 +559,9 @@ SUBROUTINE Lidar_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMs y%lidar%LidSpeed(IRangeGt) = -1*y%lidar%LidSpeed(IRangeGt)/(LidDirUnVec(1)*WtFuncSum) ENDIF - END DO + END DO - END IF + END IF END SUBROUTINE Lidar_CalcOutput !---------------------------------------------------------------------------------------------------------------------------------- diff --git a/modules/inflowwind/src/Lidar.txt b/modules/inflowwind/src/Lidar.txt index 8f2defd9dd..7bdc3d63c0 100644 --- a/modules/inflowwind/src/Lidar.txt +++ b/modules/inflowwind/src/Lidar.txt @@ -14,16 +14,6 @@ param Lidar - IntKi SensorType_SinglePoint - 1 - - param ^ - IntKi SensorType_ContinuousLidar - 2 - - param ^ - IntKi SensorType_PulsedLidar - 3 - - -# ..... LIDAR_InitInputType data ....................................................................................................... -typedef ^ Lidar_InitInputType IntKi SensorType - SensorType_None - "SensorType_* parameter" - -typedef ^ Lidar_InitInputType DbKi Tmax - - - "the length of the simulation" "s" -typedef ^ Lidar_InitInputType ReKi RotorApexOffsetPos {3} - - "position of the lidar unit relative to the rotor apex of rotation" "m" -typedef ^ Lidar_InitInputType ReKi HubPosition {3} - - "initial position of the hub (lidar mounted on hub) [0,0,HubHeight]" "m" -typedef ^ Lidar_InitInputType IntKi NumPulseGate - - - "the number of range gates to return wind speeds at" - -typedef ^ Lidar_InitInputType LOGICAL LidRadialVel - - - "TRUE => return radial component, FALSE => return 'x' direction estimate" - - -# ..... LIDAR_InitInputType data ....................................................................................................... -typedef ^ Lidar_InitOutputType ReKi DummyInitOut - # ..... LIDAR_ParameterType data ....................................................................................................... typedef ^ Lidar_ParameterType IntKi NumPulseGate - - - "the number of range gates to return wind speeds at; pulsed lidar only" - @@ -33,7 +23,6 @@ typedef ^ Lidar_ParameterType ReKi SpatialRes - - - "spatial samp typedef ^ Lidar_ParameterType IntKi SensorType - - - "SensorType_* parameter" - typedef ^ Lidar_ParameterType ReKi WtFnTrunc - - - "Percentage of the peak value at which to truncate weighting function" typedef ^ Lidar_ParameterType ReKi PulseRangeOne - - - "the range to the closest range gate" "m" -typedef ^ Lidar_ParameterType ReKi DeltaP - - - "the distance between range gates" "m" typedef ^ Lidar_ParameterType ReKi DeltaR - - - "the FWHM width of the pulse" typedef ^ Lidar_ParameterType ReKi r_p - - - typedef ^ Lidar_ParameterType LOGICAL LidRadialVel - - - "TRUE => return radial component, FALSE => return 'x' direction estimate" - @@ -44,28 +33,15 @@ typedef ^ Lidar_ParameterType IntKi NumBeam - - - "Numb typedef ^ Lidar_ParameterType ReKi FocalDistanceX : - - "LIDAR LOS focal distance co-ordinates in the x direction" "m" typedef ^ Lidar_ParameterType ReKi FocalDistanceY : - - "LIDAR LOS focal distance co-ordinates in the y direction" "m" typedef ^ Lidar_ParameterType ReKi FocalDistanceZ : - - "LIDAR LOS focal distance co-ordinates in the z direction" "m" -typedef ^ Lidar_ParameterType ReKi MsrPosition {:}{:} - - "Position of the desired wind measurement (was XMsrPt, YMsrPt, ZMsrPt)" "m" +typedef ^ Lidar_ParameterType ReKi MsrPosition {:}{:} - - "Position of the desired wind measurement, per beam (was XMsrPt, YMsrPt, ZMsrPt)" "m" typedef ^ Lidar_ParameterType ReKi PulseSpacing - - - "Distance between range gates" "m" typedef ^ Lidar_ParameterType ReKi URefLid - - - "Reference average wind speed for the lidar" "m/s" -typedef ^ Lidar_ParameterType IntKi ConsiderHubMotion - - - "Flag whether to consider the hub motion's impact on the Lidar measurement" - +typedef ^ Lidar_ParameterType IntKi ConsiderHubMotion - - - "Whether to consider the hub motion's impact on the Lidar measurement" - typedef ^ Lidar_ParameterType ReKi MeasurementInterval - - - "Time steps between lidar measurements" "s" typedef ^ Lidar_ParameterType ReKi LidPosition {3} - - "Position of the Lidar unit (was XLidPt, YLidPt, ZLidPt)" "m" +typedef ^ Lidar_ParameterType IntKi NumMeasurements - 0 - "Number of measurements output" - -# ..... States .................................................................................................................... -# Define continuous (differentiable) states here: -typedef ^ ContinuousStateType ReKi DummyContState - - - "Remove this variable if you have continuous states" - -# Define discrete (nondifferentiable) states here: -typedef ^ DiscreteStateType ReKi DummyDiscState - - - "Remove this variable if you have discrete states" - -# Define constraint states here: -typedef ^ ConstraintStateType ReKi DummyConstrState - - - "Remove this variable if you have constraint states" - -# Define "other" states (any data that are not considered actual states) here: -typedef ^ OtherStateType ReKi DummyOtherState - - - - -# ..... Misc/Optimization variables................................................................................................. -# Define any data that are used only for efficiency purposes (these variables are not associated with time): -# e.g. indices for searching in an array, large arrays that are local variables in any routine called multiple times, etc. -typedef ^ MiscVarType ReKi DummyMiscVar - - - "Remove this variable if you have misc variables" - # ..... LIDAR_InputType data ....................................................................................................... @@ -81,4 +57,3 @@ typedef ^ Lidar_OutputType ReKi WtTrunc {:} - - "Contains the frac typedef ^ Lidar_OutputType ReKi MsrPositionsX {:} - - "Lidar X direction measurement points" "m" typedef ^ Lidar_OutputType ReKi MsrPositionsY {:} - - "Lidar Y direction measurement points" "m" typedef ^ Lidar_OutputType ReKi MsrPositionsZ {:} - - "Lidar Z direction measurement points" "m" -#typedef ^ Lidar_OutputType IntKi LidErr {:} - - "Error code; THIS NEEDS TO GET FIXED (no integer outputs)" diff --git a/modules/inflowwind/src/Lidar_Types.f90 b/modules/inflowwind/src/Lidar_Types.f90 index 8277eb6a54..490316f137 100644 --- a/modules/inflowwind/src/Lidar_Types.f90 +++ b/modules/inflowwind/src/Lidar_Types.f90 @@ -37,21 +37,6 @@ MODULE Lidar_Types INTEGER(IntKi), PUBLIC, PARAMETER :: SensorType_SinglePoint = 1 INTEGER(IntKi), PUBLIC, PARAMETER :: SensorType_ContinuousLidar = 2 INTEGER(IntKi), PUBLIC, PARAMETER :: SensorType_PulsedLidar = 3 -! ========= Lidar_InitInputType ======= - TYPE, PUBLIC :: Lidar_InitInputType - INTEGER(IntKi) :: SensorType = SensorType_None !< SensorType_* parameter [-] - REAL(DbKi) :: Tmax = 0.0_R8Ki !< the length of the simulation [s] - REAL(ReKi) , DIMENSION(1:3) :: RotorApexOffsetPos = 0.0_ReKi !< position of the lidar unit relative to the rotor apex of rotation [m] - REAL(ReKi) , DIMENSION(1:3) :: HubPosition = 0.0_ReKi !< initial position of the hub (lidar mounted on hub) [0,0,HubHeight] [m] - INTEGER(IntKi) :: NumPulseGate = 0_IntKi !< the number of range gates to return wind speeds at [-] - LOGICAL :: LidRadialVel = .false. !< TRUE => return radial component, FALSE => return 'x' direction estimate [-] - END TYPE Lidar_InitInputType -! ======================= -! ========= Lidar_InitOutputType ======= - TYPE, PUBLIC :: Lidar_InitOutputType - REAL(ReKi) :: DummyInitOut = 0.0_ReKi - END TYPE Lidar_InitOutputType -! ======================= ! ========= Lidar_ParameterType ======= TYPE, PUBLIC :: Lidar_ParameterType INTEGER(IntKi) :: NumPulseGate = 0_IntKi !< the number of range gates to return wind speeds at; pulsed lidar only [-] @@ -61,7 +46,6 @@ MODULE Lidar_Types INTEGER(IntKi) :: SensorType = 0_IntKi !< SensorType_* parameter [-] REAL(ReKi) :: WtFnTrunc = 0.0_ReKi !< Percentage of the peak value at which to truncate weighting function [-] REAL(ReKi) :: PulseRangeOne = 0.0_ReKi !< the range to the closest range gate [m] - REAL(ReKi) :: DeltaP = 0.0_ReKi !< the distance between range gates [m] REAL(ReKi) :: DeltaR = 0.0_ReKi !< the FWHM width of the pulse [-] REAL(ReKi) :: r_p = 0.0_ReKi LOGICAL :: LidRadialVel = .false. !< TRUE => return radial component, FALSE => return 'x' direction estimate [-] @@ -72,39 +56,15 @@ MODULE Lidar_Types REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: FocalDistanceX !< LIDAR LOS focal distance co-ordinates in the x direction [m] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: FocalDistanceY !< LIDAR LOS focal distance co-ordinates in the y direction [m] REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: FocalDistanceZ !< LIDAR LOS focal distance co-ordinates in the z direction [m] - REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: MsrPosition !< Position of the desired wind measurement (was XMsrPt, YMsrPt, ZMsrPt) [m] + REAL(ReKi) , DIMENSION(:,:), ALLOCATABLE :: MsrPosition !< Position of the desired wind measurement, per beam (was XMsrPt, YMsrPt, ZMsrPt) [m] REAL(ReKi) :: PulseSpacing = 0.0_ReKi !< Distance between range gates [m] REAL(ReKi) :: URefLid = 0.0_ReKi !< Reference average wind speed for the lidar [m/s] - INTEGER(IntKi) :: ConsiderHubMotion = 0_IntKi !< Flag whether to consider the hub motion's impact on the Lidar measurement [-] + INTEGER(IntKi) :: ConsiderHubMotion = 0_IntKi !< Whether to consider the hub motion's impact on the Lidar measurement [-] REAL(ReKi) :: MeasurementInterval = 0.0_ReKi !< Time steps between lidar measurements [s] REAL(ReKi) , DIMENSION(1:3) :: LidPosition = 0.0_ReKi !< Position of the Lidar unit (was XLidPt, YLidPt, ZLidPt) [m] + INTEGER(IntKi) :: NumMeasurements = 0 !< Number of measurements output [-] END TYPE Lidar_ParameterType ! ======================= -! ========= Lidar_ContinuousStateType ======= - TYPE, PUBLIC :: Lidar_ContinuousStateType - REAL(ReKi) :: DummyContState = 0.0_ReKi !< Remove this variable if you have continuous states [-] - END TYPE Lidar_ContinuousStateType -! ======================= -! ========= Lidar_DiscreteStateType ======= - TYPE, PUBLIC :: Lidar_DiscreteStateType - REAL(ReKi) :: DummyDiscState = 0.0_ReKi !< Remove this variable if you have discrete states [-] - END TYPE Lidar_DiscreteStateType -! ======================= -! ========= Lidar_ConstraintStateType ======= - TYPE, PUBLIC :: Lidar_ConstraintStateType - REAL(ReKi) :: DummyConstrState = 0.0_ReKi !< Remove this variable if you have constraint states [-] - END TYPE Lidar_ConstraintStateType -! ======================= -! ========= Lidar_OtherStateType ======= - TYPE, PUBLIC :: Lidar_OtherStateType - REAL(ReKi) :: DummyOtherState = 0.0_ReKi - END TYPE Lidar_OtherStateType -! ======================= -! ========= Lidar_MiscVarType ======= - TYPE, PUBLIC :: Lidar_MiscVarType - REAL(ReKi) :: DummyMiscVar = 0.0_ReKi !< Remove this variable if you have misc variables [-] - END TYPE Lidar_MiscVarType -! ======================= ! ========= Lidar_InputType ======= TYPE, PUBLIC :: Lidar_InputType REAL(ReKi) :: PulseLidEl = 0.0_ReKi !< the angle off of the x axis that the lidar is aimed (0 would be staring directly upwind, pi/2 would be staring perpendicular to the x axis) [-] @@ -125,97 +85,6 @@ MODULE Lidar_Types ! ======================= CONTAINS -subroutine Lidar_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, ErrStat, ErrMsg) - type(Lidar_InitInputType), intent(in) :: SrcInitInputData - type(Lidar_InitInputType), intent(inout) :: DstInitInputData - integer(IntKi), intent(in ) :: CtrlCode - integer(IntKi), intent( out) :: ErrStat - character(*), intent( out) :: ErrMsg - character(*), parameter :: RoutineName = 'Lidar_CopyInitInput' - ErrStat = ErrID_None - ErrMsg = '' - DstInitInputData%SensorType = SrcInitInputData%SensorType - DstInitInputData%Tmax = SrcInitInputData%Tmax - DstInitInputData%RotorApexOffsetPos = SrcInitInputData%RotorApexOffsetPos - DstInitInputData%HubPosition = SrcInitInputData%HubPosition - DstInitInputData%NumPulseGate = SrcInitInputData%NumPulseGate - DstInitInputData%LidRadialVel = SrcInitInputData%LidRadialVel -end subroutine - -subroutine Lidar_DestroyInitInput(InitInputData, ErrStat, ErrMsg) - type(Lidar_InitInputType), intent(inout) :: InitInputData - integer(IntKi), intent( out) :: ErrStat - character(*), intent( out) :: ErrMsg - character(*), parameter :: RoutineName = 'Lidar_DestroyInitInput' - ErrStat = ErrID_None - ErrMsg = '' -end subroutine - -subroutine Lidar_PackInitInput(RF, Indata) - type(RegFile), intent(inout) :: RF - type(Lidar_InitInputType), intent(in) :: InData - character(*), parameter :: RoutineName = 'Lidar_PackInitInput' - if (RF%ErrStat >= AbortErrLev) return - call RegPack(RF, InData%SensorType) - call RegPack(RF, InData%Tmax) - call RegPack(RF, InData%RotorApexOffsetPos) - call RegPack(RF, InData%HubPosition) - call RegPack(RF, InData%NumPulseGate) - call RegPack(RF, InData%LidRadialVel) - if (RegCheckErr(RF, RoutineName)) return -end subroutine - -subroutine Lidar_UnPackInitInput(RF, OutData) - type(RegFile), intent(inout) :: RF - type(Lidar_InitInputType), intent(inout) :: OutData - character(*), parameter :: RoutineName = 'Lidar_UnPackInitInput' - if (RF%ErrStat /= ErrID_None) return - call RegUnpack(RF, OutData%SensorType); if (RegCheckErr(RF, RoutineName)) return - call RegUnpack(RF, OutData%Tmax); if (RegCheckErr(RF, RoutineName)) return - call RegUnpack(RF, OutData%RotorApexOffsetPos); if (RegCheckErr(RF, RoutineName)) return - call RegUnpack(RF, OutData%HubPosition); if (RegCheckErr(RF, RoutineName)) return - call RegUnpack(RF, OutData%NumPulseGate); if (RegCheckErr(RF, RoutineName)) return - call RegUnpack(RF, OutData%LidRadialVel); if (RegCheckErr(RF, RoutineName)) return -end subroutine - -subroutine Lidar_CopyInitOutput(SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg) - type(Lidar_InitOutputType), intent(in) :: SrcInitOutputData - type(Lidar_InitOutputType), intent(inout) :: DstInitOutputData - integer(IntKi), intent(in ) :: CtrlCode - integer(IntKi), intent( out) :: ErrStat - character(*), intent( out) :: ErrMsg - character(*), parameter :: RoutineName = 'Lidar_CopyInitOutput' - ErrStat = ErrID_None - ErrMsg = '' - DstInitOutputData%DummyInitOut = SrcInitOutputData%DummyInitOut -end subroutine - -subroutine Lidar_DestroyInitOutput(InitOutputData, ErrStat, ErrMsg) - type(Lidar_InitOutputType), intent(inout) :: InitOutputData - integer(IntKi), intent( out) :: ErrStat - character(*), intent( out) :: ErrMsg - character(*), parameter :: RoutineName = 'Lidar_DestroyInitOutput' - ErrStat = ErrID_None - ErrMsg = '' -end subroutine - -subroutine Lidar_PackInitOutput(RF, Indata) - type(RegFile), intent(inout) :: RF - type(Lidar_InitOutputType), intent(in) :: InData - character(*), parameter :: RoutineName = 'Lidar_PackInitOutput' - if (RF%ErrStat >= AbortErrLev) return - call RegPack(RF, InData%DummyInitOut) - if (RegCheckErr(RF, RoutineName)) return -end subroutine - -subroutine Lidar_UnPackInitOutput(RF, OutData) - type(RegFile), intent(inout) :: RF - type(Lidar_InitOutputType), intent(inout) :: OutData - character(*), parameter :: RoutineName = 'Lidar_UnPackInitOutput' - if (RF%ErrStat /= ErrID_None) return - call RegUnpack(RF, OutData%DummyInitOut); if (RegCheckErr(RF, RoutineName)) return -end subroutine - subroutine Lidar_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg) type(Lidar_ParameterType), intent(in) :: SrcParamData type(Lidar_ParameterType), intent(inout) :: DstParamData @@ -234,7 +103,6 @@ subroutine Lidar_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg DstParamData%SensorType = SrcParamData%SensorType DstParamData%WtFnTrunc = SrcParamData%WtFnTrunc DstParamData%PulseRangeOne = SrcParamData%PulseRangeOne - DstParamData%DeltaP = SrcParamData%DeltaP DstParamData%DeltaR = SrcParamData%DeltaR DstParamData%r_p = SrcParamData%r_p DstParamData%LidRadialVel = SrcParamData%LidRadialVel @@ -295,6 +163,7 @@ subroutine Lidar_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg DstParamData%ConsiderHubMotion = SrcParamData%ConsiderHubMotion DstParamData%MeasurementInterval = SrcParamData%MeasurementInterval DstParamData%LidPosition = SrcParamData%LidPosition + DstParamData%NumMeasurements = SrcParamData%NumMeasurements end subroutine subroutine Lidar_DestroyParam(ParamData, ErrStat, ErrMsg) @@ -330,7 +199,6 @@ subroutine Lidar_PackParam(RF, Indata) call RegPack(RF, InData%SensorType) call RegPack(RF, InData%WtFnTrunc) call RegPack(RF, InData%PulseRangeOne) - call RegPack(RF, InData%DeltaP) call RegPack(RF, InData%DeltaR) call RegPack(RF, InData%r_p) call RegPack(RF, InData%LidRadialVel) @@ -347,6 +215,7 @@ subroutine Lidar_PackParam(RF, Indata) call RegPack(RF, InData%ConsiderHubMotion) call RegPack(RF, InData%MeasurementInterval) call RegPack(RF, InData%LidPosition) + call RegPack(RF, InData%NumMeasurements) if (RegCheckErr(RF, RoutineName)) return end subroutine @@ -365,7 +234,6 @@ subroutine Lidar_UnPackParam(RF, OutData) call RegUnpack(RF, OutData%SensorType); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%WtFnTrunc); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%PulseRangeOne); if (RegCheckErr(RF, RoutineName)) return - call RegUnpack(RF, OutData%DeltaP); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%DeltaR); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%r_p); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%LidRadialVel); if (RegCheckErr(RF, RoutineName)) return @@ -382,196 +250,7 @@ subroutine Lidar_UnPackParam(RF, OutData) call RegUnpack(RF, OutData%ConsiderHubMotion); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%MeasurementInterval); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%LidPosition); if (RegCheckErr(RF, RoutineName)) return -end subroutine - -subroutine Lidar_CopyContState(SrcContStateData, DstContStateData, CtrlCode, ErrStat, ErrMsg) - type(Lidar_ContinuousStateType), intent(in) :: SrcContStateData - type(Lidar_ContinuousStateType), intent(inout) :: DstContStateData - integer(IntKi), intent(in ) :: CtrlCode - integer(IntKi), intent( out) :: ErrStat - character(*), intent( out) :: ErrMsg - character(*), parameter :: RoutineName = 'Lidar_CopyContState' - ErrStat = ErrID_None - ErrMsg = '' - DstContStateData%DummyContState = SrcContStateData%DummyContState -end subroutine - -subroutine Lidar_DestroyContState(ContStateData, ErrStat, ErrMsg) - type(Lidar_ContinuousStateType), intent(inout) :: ContStateData - integer(IntKi), intent( out) :: ErrStat - character(*), intent( out) :: ErrMsg - character(*), parameter :: RoutineName = 'Lidar_DestroyContState' - ErrStat = ErrID_None - ErrMsg = '' -end subroutine - -subroutine Lidar_PackContState(RF, Indata) - type(RegFile), intent(inout) :: RF - type(Lidar_ContinuousStateType), intent(in) :: InData - character(*), parameter :: RoutineName = 'Lidar_PackContState' - if (RF%ErrStat >= AbortErrLev) return - call RegPack(RF, InData%DummyContState) - if (RegCheckErr(RF, RoutineName)) return -end subroutine - -subroutine Lidar_UnPackContState(RF, OutData) - type(RegFile), intent(inout) :: RF - type(Lidar_ContinuousStateType), intent(inout) :: OutData - character(*), parameter :: RoutineName = 'Lidar_UnPackContState' - if (RF%ErrStat /= ErrID_None) return - call RegUnpack(RF, OutData%DummyContState); if (RegCheckErr(RF, RoutineName)) return -end subroutine - -subroutine Lidar_CopyDiscState(SrcDiscStateData, DstDiscStateData, CtrlCode, ErrStat, ErrMsg) - type(Lidar_DiscreteStateType), intent(in) :: SrcDiscStateData - type(Lidar_DiscreteStateType), intent(inout) :: DstDiscStateData - integer(IntKi), intent(in ) :: CtrlCode - integer(IntKi), intent( out) :: ErrStat - character(*), intent( out) :: ErrMsg - character(*), parameter :: RoutineName = 'Lidar_CopyDiscState' - ErrStat = ErrID_None - ErrMsg = '' - DstDiscStateData%DummyDiscState = SrcDiscStateData%DummyDiscState -end subroutine - -subroutine Lidar_DestroyDiscState(DiscStateData, ErrStat, ErrMsg) - type(Lidar_DiscreteStateType), intent(inout) :: DiscStateData - integer(IntKi), intent( out) :: ErrStat - character(*), intent( out) :: ErrMsg - character(*), parameter :: RoutineName = 'Lidar_DestroyDiscState' - ErrStat = ErrID_None - ErrMsg = '' -end subroutine - -subroutine Lidar_PackDiscState(RF, Indata) - type(RegFile), intent(inout) :: RF - type(Lidar_DiscreteStateType), intent(in) :: InData - character(*), parameter :: RoutineName = 'Lidar_PackDiscState' - if (RF%ErrStat >= AbortErrLev) return - call RegPack(RF, InData%DummyDiscState) - if (RegCheckErr(RF, RoutineName)) return -end subroutine - -subroutine Lidar_UnPackDiscState(RF, OutData) - type(RegFile), intent(inout) :: RF - type(Lidar_DiscreteStateType), intent(inout) :: OutData - character(*), parameter :: RoutineName = 'Lidar_UnPackDiscState' - if (RF%ErrStat /= ErrID_None) return - call RegUnpack(RF, OutData%DummyDiscState); if (RegCheckErr(RF, RoutineName)) return -end subroutine - -subroutine Lidar_CopyConstrState(SrcConstrStateData, DstConstrStateData, CtrlCode, ErrStat, ErrMsg) - type(Lidar_ConstraintStateType), intent(in) :: SrcConstrStateData - type(Lidar_ConstraintStateType), intent(inout) :: DstConstrStateData - integer(IntKi), intent(in ) :: CtrlCode - integer(IntKi), intent( out) :: ErrStat - character(*), intent( out) :: ErrMsg - character(*), parameter :: RoutineName = 'Lidar_CopyConstrState' - ErrStat = ErrID_None - ErrMsg = '' - DstConstrStateData%DummyConstrState = SrcConstrStateData%DummyConstrState -end subroutine - -subroutine Lidar_DestroyConstrState(ConstrStateData, ErrStat, ErrMsg) - type(Lidar_ConstraintStateType), intent(inout) :: ConstrStateData - integer(IntKi), intent( out) :: ErrStat - character(*), intent( out) :: ErrMsg - character(*), parameter :: RoutineName = 'Lidar_DestroyConstrState' - ErrStat = ErrID_None - ErrMsg = '' -end subroutine - -subroutine Lidar_PackConstrState(RF, Indata) - type(RegFile), intent(inout) :: RF - type(Lidar_ConstraintStateType), intent(in) :: InData - character(*), parameter :: RoutineName = 'Lidar_PackConstrState' - if (RF%ErrStat >= AbortErrLev) return - call RegPack(RF, InData%DummyConstrState) - if (RegCheckErr(RF, RoutineName)) return -end subroutine - -subroutine Lidar_UnPackConstrState(RF, OutData) - type(RegFile), intent(inout) :: RF - type(Lidar_ConstraintStateType), intent(inout) :: OutData - character(*), parameter :: RoutineName = 'Lidar_UnPackConstrState' - if (RF%ErrStat /= ErrID_None) return - call RegUnpack(RF, OutData%DummyConstrState); if (RegCheckErr(RF, RoutineName)) return -end subroutine - -subroutine Lidar_CopyOtherState(SrcOtherStateData, DstOtherStateData, CtrlCode, ErrStat, ErrMsg) - type(Lidar_OtherStateType), intent(in) :: SrcOtherStateData - type(Lidar_OtherStateType), intent(inout) :: DstOtherStateData - integer(IntKi), intent(in ) :: CtrlCode - integer(IntKi), intent( out) :: ErrStat - character(*), intent( out) :: ErrMsg - character(*), parameter :: RoutineName = 'Lidar_CopyOtherState' - ErrStat = ErrID_None - ErrMsg = '' - DstOtherStateData%DummyOtherState = SrcOtherStateData%DummyOtherState -end subroutine - -subroutine Lidar_DestroyOtherState(OtherStateData, ErrStat, ErrMsg) - type(Lidar_OtherStateType), intent(inout) :: OtherStateData - integer(IntKi), intent( out) :: ErrStat - character(*), intent( out) :: ErrMsg - character(*), parameter :: RoutineName = 'Lidar_DestroyOtherState' - ErrStat = ErrID_None - ErrMsg = '' -end subroutine - -subroutine Lidar_PackOtherState(RF, Indata) - type(RegFile), intent(inout) :: RF - type(Lidar_OtherStateType), intent(in) :: InData - character(*), parameter :: RoutineName = 'Lidar_PackOtherState' - if (RF%ErrStat >= AbortErrLev) return - call RegPack(RF, InData%DummyOtherState) - if (RegCheckErr(RF, RoutineName)) return -end subroutine - -subroutine Lidar_UnPackOtherState(RF, OutData) - type(RegFile), intent(inout) :: RF - type(Lidar_OtherStateType), intent(inout) :: OutData - character(*), parameter :: RoutineName = 'Lidar_UnPackOtherState' - if (RF%ErrStat /= ErrID_None) return - call RegUnpack(RF, OutData%DummyOtherState); if (RegCheckErr(RF, RoutineName)) return -end subroutine - -subroutine Lidar_CopyMisc(SrcMiscData, DstMiscData, CtrlCode, ErrStat, ErrMsg) - type(Lidar_MiscVarType), intent(in) :: SrcMiscData - type(Lidar_MiscVarType), intent(inout) :: DstMiscData - integer(IntKi), intent(in ) :: CtrlCode - integer(IntKi), intent( out) :: ErrStat - character(*), intent( out) :: ErrMsg - character(*), parameter :: RoutineName = 'Lidar_CopyMisc' - ErrStat = ErrID_None - ErrMsg = '' - DstMiscData%DummyMiscVar = SrcMiscData%DummyMiscVar -end subroutine - -subroutine Lidar_DestroyMisc(MiscData, ErrStat, ErrMsg) - type(Lidar_MiscVarType), intent(inout) :: MiscData - integer(IntKi), intent( out) :: ErrStat - character(*), intent( out) :: ErrMsg - character(*), parameter :: RoutineName = 'Lidar_DestroyMisc' - ErrStat = ErrID_None - ErrMsg = '' -end subroutine - -subroutine Lidar_PackMisc(RF, Indata) - type(RegFile), intent(inout) :: RF - type(Lidar_MiscVarType), intent(in) :: InData - character(*), parameter :: RoutineName = 'Lidar_PackMisc' - if (RF%ErrStat >= AbortErrLev) return - call RegPack(RF, InData%DummyMiscVar) - if (RegCheckErr(RF, RoutineName)) return -end subroutine - -subroutine Lidar_UnPackMisc(RF, OutData) - type(RegFile), intent(inout) :: RF - type(Lidar_MiscVarType), intent(inout) :: OutData - character(*), parameter :: RoutineName = 'Lidar_UnPackMisc' - if (RF%ErrStat /= ErrID_None) return - call RegUnpack(RF, OutData%DummyMiscVar); if (RegCheckErr(RF, RoutineName)) return + call RegUnpack(RF, OutData%NumMeasurements); if (RegCheckErr(RF, RoutineName)) return end subroutine subroutine Lidar_CopyInput(SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg) diff --git a/modules/openfast-library/src/FAST_Library.f90 b/modules/openfast-library/src/FAST_Library.f90 index 685a2adc03..e3ff240d7f 100644 --- a/modules/openfast-library/src/FAST_Library.f90 +++ b/modules/openfast-library/src/FAST_Library.f90 @@ -400,10 +400,6 @@ subroutine FAST_SetExternalInputs(iTurb, NumInputs_c, InputAry, m_FAST) m_FAST%ExternInput%CableDeltaL = InputAry(12:31) m_FAST%ExternInput%CableDeltaLdot = InputAry(32:51) - IF ( NumInputs_c > NumFixedInputs ) THEN ! NumFixedInputs is the fixed number of inputs - IF ( NumInputs_c == NumFixedInputs + 3 ) & - m_FAST%ExternInput%LidarFocus = InputAry(52:54) - END IF end subroutine FAST_SetExternalInputs !================================================================================================================================== diff --git a/modules/openfast-library/src/FAST_Registry.txt b/modules/openfast-library/src/FAST_Registry.txt index 7d1caaafc1..ddec6be1fb 100644 --- a/modules/openfast-library/src/FAST_Registry.txt +++ b/modules/openfast-library/src/FAST_Registry.txt @@ -801,7 +801,6 @@ typedef ^ FAST_ExternInputType ReKi YawRateCom - - - "yaw rate command from Simu typedef ^ FAST_ExternInputType ReKi BlPitchCom 3 - 2pi "blade pitch commands from Simulink/Labview" "rad" typedef ^ FAST_ExternInputType ReKi BlAirfoilCom 3 - - "blade airfoil commands from Simulink/Labview" "-" typedef ^ FAST_ExternInputType ReKi HSSBrFrac - - - "Fraction of full braking torque: 0 (off) <= HSSBrFrac <= 1 (full) from Simulink or LabVIEW" -typedef ^ FAST_ExternInputType ReKi LidarFocus 3 - - "lidar focus (relative to lidar location)" m typedef ^ FAST_ExternInputType ReKi CableDeltaL {20} - - "Cable control DeltaL" m typedef ^ FAST_ExternInputType ReKi CableDeltaLdot {20} - - "Cable control DeltaLdot" m/s diff --git a/modules/openfast-library/src/FAST_Subs.f90 b/modules/openfast-library/src/FAST_Subs.f90 index 9d9ec54e55..c15e2ff892 100644 --- a/modules/openfast-library/src/FAST_Subs.f90 +++ b/modules/openfast-library/src/FAST_Subs.f90 @@ -493,15 +493,14 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, SED, BD, S ! lidar Init%InData_IfW%LidarEnabled = .true. ! allowed with OF, but not FF - Init%InData_IfW%lidar%Tmax = p_FAST%TMax if (p_FAST%CompElast == Module_SED) then - Init%InData_IfW%lidar%HubPosition = SED%y%HubPtMotion%Position(:,1) + Init%InData_IfW%HubPosition = SED%y%HubPtMotion%Position(:,1) Init%InData_IfW%RadAvg = Init%OutData_SED%BladeLength elseif ( p_FAST%CompElast == Module_ED ) then - Init%InData_IfW%lidar%HubPosition = ED%y%HubPtMotion%Position(:,1) + Init%InData_IfW%HubPosition = ED%y%HubPtMotion%Position(:,1) Init%InData_IfW%RadAvg = Init%OutData_ED%BladeLength elseif ( p_FAST%CompElast == Module_BD ) then - Init%InData_IfW%lidar%HubPosition = ED%y%HubPtMotion%Position(:,1) + Init%InData_IfW%HubPosition = ED%y%HubPtMotion%Position(:,1) Init%InData_IfW%RadAvg = TwoNorm(BD%y(1)%BldMotion%Position(:,1) - BD%y(1)%BldMotion%Position(:,BD%y(1)%BldMotion%Nnodes)) end if @@ -1507,31 +1506,14 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, SED, BD, S - IF ( p_FAST%CompInflow == Module_IfW ) THEN !assign the number of gates to ServD - if (allocated(IfW%y%lidar%LidSpeed)) then ! make sure we have the array allocated before setting it - CALL AllocAry(Init%InData_SrvD%LidSpeed, size(IfW%y%lidar%LidSpeed), 'Init%InData_SrvD%LidSpeed', errStat2, ErrMsg2) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - Init%InData_SrvD%LidSpeed = IfW%y%lidar%LidSpeed - endif - if (allocated(IfW%y%lidar%MsrPositionsX)) then ! make sure we have the array allocated before setting it - CALL AllocAry(Init%InData_SrvD%MsrPositionsX, size(IfW%y%lidar%MsrPositionsX), 'Init%InData_SrvD%MsrPositionsX', errStat2, ErrMsg2) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - Init%InData_SrvD%MsrPositionsX = IfW%y%lidar%MsrPositionsX - endif - if (allocated(IfW%y%lidar%MsrPositionsY)) then ! make sure we have the array allocated before setting it - CALL AllocAry(Init%InData_SrvD%MsrPositionsY, size(IfW%y%lidar%MsrPositionsY), 'Init%InData_SrvD%MsrPositionsY', errStat2, ErrMsg2) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - Init%InData_SrvD%MsrPositionsY = IfW%y%lidar%MsrPositionsY - endif - if (allocated(IfW%y%lidar%MsrPositionsZ)) then ! make sure we have the array allocated before setting it - CALL AllocAry(Init%InData_SrvD%MsrPositionsZ, size(IfW%y%lidar%MsrPositionsZ), 'Init%InData_SrvD%MsrPositionsZ', errStat2, ErrMsg2) - CALL SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName) - Init%InData_SrvD%MsrPositionsZ = IfW%y%lidar%MsrPositionsZ - endif + IF ( p_FAST%CompInflow == Module_IfW ) THEN ! assign the number of gates to ServD Init%InData_SrvD%SensorType = IfW%p%lidar%SensorType Init%InData_SrvD%NumBeam = IfW%p%lidar%NumBeam Init%InData_SrvD%NumPulseGate = IfW%p%lidar%NumPulseGate - Init%InData_SrvD%PulseSpacing = IfW%p%lidar%PulseSpacing + else + Init%InData_SrvD%SensorType = 0 + Init%InData_SrvD%NumBeam = 0 + Init%InData_SrvD%NumPulseGate = 0 END IF diff --git a/modules/openfast-library/src/FAST_Types.f90 b/modules/openfast-library/src/FAST_Types.f90 index 5de2f68fc6..06061ca975 100644 --- a/modules/openfast-library/src/FAST_Types.f90 +++ b/modules/openfast-library/src/FAST_Types.f90 @@ -807,7 +807,6 @@ MODULE FAST_Types REAL(ReKi) , DIMENSION(1:3) :: BlPitchCom = 0.0_ReKi !< blade pitch commands from Simulink/Labview [rad] REAL(ReKi) , DIMENSION(1:3) :: BlAirfoilCom = 0.0_ReKi !< blade airfoil commands from Simulink/Labview [-] REAL(ReKi) :: HSSBrFrac = 0.0_ReKi !< Fraction of full braking torque: 0 (off) <= HSSBrFrac <= 1 (full) from Simulink or LabVIEW [-] - REAL(ReKi) , DIMENSION(1:3) :: LidarFocus = 0.0_ReKi !< lidar focus (relative to lidar location) [m] REAL(ReKi) , DIMENSION(1:20) :: CableDeltaL = 0.0_ReKi !< Cable control DeltaL [m] REAL(ReKi) , DIMENSION(1:20) :: CableDeltaLdot = 0.0_ReKi !< Cable control DeltaLdot [m/s] END TYPE FAST_ExternInputType @@ -14636,7 +14635,6 @@ subroutine FAST_CopyExternInputType(SrcExternInputTypeData, DstExternInputTypeDa DstExternInputTypeData%BlPitchCom = SrcExternInputTypeData%BlPitchCom DstExternInputTypeData%BlAirfoilCom = SrcExternInputTypeData%BlAirfoilCom DstExternInputTypeData%HSSBrFrac = SrcExternInputTypeData%HSSBrFrac - DstExternInputTypeData%LidarFocus = SrcExternInputTypeData%LidarFocus DstExternInputTypeData%CableDeltaL = SrcExternInputTypeData%CableDeltaL DstExternInputTypeData%CableDeltaLdot = SrcExternInputTypeData%CableDeltaLdot end subroutine @@ -14662,7 +14660,6 @@ subroutine FAST_PackExternInputType(RF, Indata) call RegPack(RF, InData%BlPitchCom) call RegPack(RF, InData%BlAirfoilCom) call RegPack(RF, InData%HSSBrFrac) - call RegPack(RF, InData%LidarFocus) call RegPack(RF, InData%CableDeltaL) call RegPack(RF, InData%CableDeltaLdot) if (RegCheckErr(RF, RoutineName)) return @@ -14680,7 +14677,6 @@ subroutine FAST_UnPackExternInputType(RF, OutData) call RegUnpack(RF, OutData%BlPitchCom); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%BlAirfoilCom); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%HSSBrFrac); if (RegCheckErr(RF, RoutineName)) return - call RegUnpack(RF, OutData%LidarFocus); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%CableDeltaL); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%CableDeltaLdot); if (RegCheckErr(RF, RoutineName)) return end subroutine diff --git a/modules/servodyn/src/BladedInterface.f90 b/modules/servodyn/src/BladedInterface.f90 index f58b9106b8..97172488e1 100644 --- a/modules/servodyn/src/BladedInterface.f90 +++ b/modules/servodyn/src/BladedInterface.f90 @@ -815,7 +815,10 @@ SUBROUTINE BladedInterface_End(u, p, m, xd, ErrStat, ErrMsg) INTEGER(IntKi) :: ErrStat2 ! The error status code CHARACTER(ErrMsgLen) :: ErrMsg2 ! The error message, if an error occurred - ! call DLL final time, but skip if we've never called it + ErrStat = ErrID_None + ErrMsg = "" + + ! call DLL final time, but skip if we've never called it if (allocated(m%dll_data%avrSWAP)) then IF ( m%dll_data%SimStatus /= GH_DISCON_STATUS_INITIALISING ) THEN m%dll_data%SimStatus = GH_DISCON_STATUS_FINALISING @@ -825,10 +828,7 @@ SUBROUTINE BladedInterface_End(u, p, m, xd, ErrStat, ErrMsg) end if CALL FreeDynamicLib( p%DLL_Trgt, ErrStat2, ErrMsg2 ) ! this doesn't do anything #ifdef STATIC_DLL_LOAD because p%DLL_Trgt is 0 (NULL) - IF (ErrStat2 /= ErrID_None) THEN - ErrStat = MAX(ErrStat, ErrStat2) - ErrMsg = TRIM(ErrMsg)//NewLine//TRIM(ErrMsg2) - END IF + call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'BladedInterface_End') END SUBROUTINE BladedInterface_End !================================================================================================================================== diff --git a/modules/servodyn/src/BladedInterface_EX.f90 b/modules/servodyn/src/BladedInterface_EX.f90 index 37e77d0978..45fde31595 100644 --- a/modules/servodyn/src/BladedInterface_EX.f90 +++ b/modules/servodyn/src/BladedInterface_EX.f90 @@ -374,66 +374,40 @@ end subroutine InitStCCtrl subroutine InitLidarMeas() integer :: I,J - if (p%NumBeam == 0) return ! Nothing to set + integer :: nPts + + nPts = p%NumBeam * p%NumPulseGate + + if (nPts == 0) return ! Nothing to set ! Allocate arrays for inputs -- these may have been set in ServoDyn already - if (allocated(InitInp%LidSpeed)) then ! make sure we have the array allocated before setting it - if (.not. allocated(u%LidSpeed)) then - CALL AllocAry(u%LidSpeed, size(InitInp%LidSpeed), 'u%LidSpeed', errStat2, ErrMsg2) - if (Failed()) return - endif - u%LidSpeed = InitInp%LidSpeed + if (.not. allocated(u%LidSpeed)) then + CALL AllocAry(u%LidSpeed, nPts, 'u%LidSpeed', errStat2, ErrMsg2); if (Failed()) return endif - if (allocated(InitInp%MsrPositionsX)) then ! make sure we have the array allocated before setting it - if (.not. allocated(u%MsrPositionsX)) then - CALL AllocAry(u%MsrPositionsX, size(InitInp%MsrPositionsX), 'u%MsrPositionsX', errStat2, ErrMsg2) - if (Failed()) return - endif - u%MsrPositionsX = InitInp%MsrPositionsX + if (.not. allocated(u%MsrPositionsX)) then + CALL AllocAry(u%MsrPositionsX, nPts, 'u%MsrPositionsX', errStat2, ErrMsg2); if (Failed()) return endif - if (allocated(InitInp%MsrPositionsY)) then ! make sure we have the array allocated before setting it - if (.not. allocated(u%MsrPositionsY)) then - CALL AllocAry(u%MsrPositionsY, size(InitInp%MsrPositionsY), 'u%MsrPositionsY', errStat2, ErrMsg2) - if (Failed()) return - endif - u%MsrPositionsY = InitInp%MsrPositionsY + if (.not. allocated(u%MsrPositionsY)) then + CALL AllocAry(u%MsrPositionsY, nPts, 'u%MsrPositionsY', errStat2, ErrMsg2); if (Failed()) return endif - if (allocated(InitInp%MsrPositionsZ)) then ! make sure we have the array allocated before setting it - if (.not. allocated(u%MsrPositionsZ)) then - CALL AllocAry(u%MsrPositionsZ, size(InitInp%MsrPositionsZ), 'u%MsrPositionsZ', errStat2, ErrMsg2) - if (Failed()) return - endif - u%MsrPositionsZ = InitInp%MsrPositionsZ + if (.not. allocated(u%MsrPositionsZ)) then + CALL AllocAry(u%MsrPositionsZ, nPts, 'u%MsrPositionsZ', errStat2, ErrMsg2) + if (Failed()) return endif ! Write summary info to summary file if (UnSum > 0) then - if (p%SensorType > 0) then ! Set these here rather than overwrite every loop step in SensorType 1 or 3 + if (p%SensorType > 0) then J=LidarMsr_StartIdx call WrSumInfoRcvd( J+0, '','Lidar input: Sensor Type') call WrSumInfoRcvd( J+1, '','Lidar input: Number of Beams') call WrSumInfoRcvd( J+2, '','Lidar input: Number of Pulse Gates') call WrSumInfoRcvd( J+3, '','Lidar input: Reference average wind speed for the lidar') - endif - if (p%SensorType == 1) THEN - do I=1,min(p%NumBeam,(LidarMsr_MaxChan-4)/4) ! Don't overstep the end for the lidar measure group - J=LidarMsr_StartIdx + 4 + (I-1) - call WrSumInfoRcvd( J+0, '','Lidar input: Measured Wind Speeds ('//trim(Num2LStr(I))//')') - call WrSumInfoRcvd( J+p%NumBeam*1, '','Lidar input: Measurement Points X ('//trim(Num2LStr(I))//')') - call WrSumInfoRcvd( J+p%NumBeam*2, '','Lidar input: Measurement Points Y ('//trim(Num2LStr(I))//')') - call WrSumInfoRcvd( J+p%NumBeam*3, '','Lidar input: Measurement Points Z ('//trim(Num2LStr(I))//')') - enddo - elseif (p%SensorType == 2) THEN - J=LidarMsr_StartIdx - call WrSumInfoRcvd( J+4, '','Lidar input: Measured Wind Speeds') - call WrSumInfoRcvd( J+5, '','Lidar input: Measurement Points X') - call WrSumInfoRcvd( J+6, '','Lidar input: Measurement Points Y') - call WrSumInfoRcvd( J+7, '','Lidar input: Measurement Points Z') - elseif (p%SensorType == 3) THEN - do I=1,min(p%NumPulseGate,(LidarMsr_MaxChan-4)/4) ! Don't overstep the end for the lidar measure group + + do I=1,min(nPts,(LidarMsr_MaxChan-4)/4) ! Don't overstep the end for the lidar measure group J=LidarMsr_StartIdx + 4 + (I-1) - call WrSumInfoRcvd( J+0, '','Lidar input: Measured Wind Speeds ('//trim(Num2LStr(I))//')') - call WrSumInfoRcvd( J+p%NumPulseGate*1, '','Lidar input: Measurement Points X ('//trim(Num2LStr(I))//')') - call WrSumInfoRcvd( J+p%NumPulseGate*2, '','Lidar input: Measurement Points Y ('//trim(Num2LStr(I))//')') - call WrSumInfoRcvd( J+p%NumPulseGate*3, '','Lidar input: Measurement Points Z ('//trim(Num2LStr(I))//')') + call WrSumInfoRcvd( J+0, '','Lidar input: Measured Wind Speeds ('//trim(Num2LStr(I))//')') + call WrSumInfoRcvd( J+nPts*1, '','Lidar input: Measurement Points X ('//trim(Num2LStr(I))//')') + call WrSumInfoRcvd( J+nPts*2, '','Lidar input: Measurement Points Y ('//trim(Num2LStr(I))//')') + call WrSumInfoRcvd( J+nPts*3, '','Lidar input: Measurement Points Z ('//trim(Num2LStr(I))//')') enddo endif endif @@ -552,36 +526,24 @@ end subroutine SetEXavrSWAP_Sensors !> Set the Lidar related sensor inputs !! avrSWAP(2001:2500) subroutine SetEXavrSWAP_LidarSensors() + integer(IntKi) :: nPts + ! in case something got set wrong, don't try to write beyond array if (size(dll_data%avrswap) < (LidarMsr_StartIdx + LidarMsr_MaxChan - 1) ) return - if (p%NumBeam == 0) return ! Nothing to set - if (p%SensorType > 0) then ! Set these here rather than overwrite every loop step in SensorType 1 or 3 + if (p%SensorType > 0) then dll_data%avrswap(LidarMsr_StartIdx) = real(p%SensorType,SiKi) ! Sensor Type dll_data%avrswap(LidarMsr_StartIdx+1) = real(p%NumBeam,SiKi) ! Number of Beams dll_data%avrswap(LidarMsr_StartIdx+2) = real(p%NumPulseGate,SiKi) ! Number of Pulse Gates - dll_data%avrswap(LidarMsr_StartIdx+3) = p%URefLid ! Reference average wind speed for the lidar - endif - if (p%SensorType == 1) THEN - do I=1,min(p%NumBeam,(LidarMsr_MaxChan-4)/4) ! Don't overstep the end for the lidar measure group - J=LidarMsr_StartIdx + 4 + (I-1) - dll_data%avrswap(J) = u%LidSpeed(I) ! Lidar Measured Wind Speeds - dll_data%avrswap(J+p%NumBeam) = u%MsrPositionsX(I) ! Lidar Measurement Points X - dll_data%avrswap(J+(p%NumBeam*2)) = u%MsrPositionsY(I) ! Lidar Measurement Points Y - dll_data%avrswap(J+(p%NumBeam*3)) = u%MsrPositionsZ(I) ! Lidar Measurement Points Z - enddo - elseif (p%SensorType == 2) THEN - dll_data%avrswap(LidarMsr_StartIdx+4) = u%LidSpeed(1) ! Lidar Measured Wind Speeds - dll_data%avrswap(LidarMsr_StartIdx+5) = u%MsrPositionsX(1) ! Lidar Measurement Points X - dll_data%avrswap(LidarMsr_StartIdx+6) = u%MsrPositionsY(1) ! Lidar Measurement Points Y - dll_data%avrswap(LidarMsr_StartIdx+7) = u%MsrPositionsZ(1) ! Lidar Measurement Points Z - elseif (p%SensorType == 3) THEN - do I=1,min(p%NumPulseGate,(LidarMsr_MaxChan-4)/4) ! Don't overstep the end for the lidar measure group + dll_data%avrswap(LidarMsr_StartIdx+3) = 0.0_SiKi ! Reference average wind speed for the lidar (this was never set, plus it doesn't really make sense that the controller would need it) + + nPts = SIZE(u%MsrPositionsX) + do I=1,min(nPts,(LidarMsr_MaxChan-4)/4) ! Don't overstep the end for the lidar measure group J=LidarMsr_StartIdx + 4 + (I-1) - dll_data%avrswap(J) = u%LidSpeed(I) ! Lidar Measured Wind Speeds - dll_data%avrswap(J+p%NumPulseGate) = u%MsrPositionsX(I) ! Lidar Measurement Points X - dll_data%avrswap(J+(p%NumPulseGate*2)) = u%MsrPositionsY(I) ! Lidar Measurement Points Y - dll_data%avrswap(J+(p%NumPulseGate*3)) = u%MsrPositionsZ(I) ! Lidar Measurement Points Z + dll_data%avrswap(J) = u%LidSpeed(I) ! Lidar Measured Wind Speeds + dll_data%avrswap(J+nPts) = u%MsrPositionsX(I) ! Lidar Measurement Points X + dll_data%avrswap(J+(nPts*2)) = u%MsrPositionsY(I) ! Lidar Measurement Points Y + dll_data%avrswap(J+(nPts*3)) = u%MsrPositionsZ(I) ! Lidar Measurement Points Z enddo endif end subroutine SetEXavrSWAP_LidarSensors diff --git a/modules/servodyn/src/ServoDyn.f90 b/modules/servodyn/src/ServoDyn.f90 index 5b1e74ae94..c03b489997 100644 --- a/modules/servodyn/src/ServoDyn.f90 +++ b/modules/servodyn/src/ServoDyn.f90 @@ -134,14 +134,13 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO INTEGER(IntKi) :: i ! loop counter INTEGER(IntKi) :: j ! loop counter INTEGER(IntKi) :: K ! loop counter + INTEGER(IntKi) :: nPts ! number of linear wind-speed points INTEGER(IntKi) :: UnSum ! Summary file unit INTEGER(IntKi) :: ErrStat2 ! temporary Error status of the operation CHARACTER(ErrMsgLen) :: ErrMsg2 ! temporary Error message if ErrStat /= ErrID_None character(*), parameter :: RoutineName = 'SrvD_Init' - - ! Initialize variables ErrStat = ErrID_None @@ -322,6 +321,19 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO if (Failed()) return; + nPts = InitInp%NumBeam * InitInp%NumPulseGate + if (nPts > 0 .and. p%UseBladedInterface) then + CALL AllocAry( u%LidSpeed, nPts, 'u%LidSpeed', ErrStat2, ErrMsg2 ); if (Failed()) return; + CALL AllocAry( u%MsrPositionsX, nPts, 'u%MsrPositionsX', ErrStat2, ErrMsg2 ); if (Failed()) return; + CALL AllocAry( u%MsrPositionsY, nPts, 'u%MsrPositionsY', ErrStat2, ErrMsg2 ); if (Failed()) return; + CALL AllocAry( u%MsrPositionsZ, nPts, 'u%MsrPositionsZ', ErrStat2, ErrMsg2 ); if (Failed()) return; + + u%LidSpeed = 0.0_SiKi + u%MsrPositionsX = 0.0_ReKi + u%MsrPositionsY = 0.0_ReKi + u%MsrPositionsZ = 0.0_ReKi + end if + u%BlPitch = p%BlPitchInit(1:p%NumBl) u%Yaw = p%YawNeut @@ -362,22 +374,7 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO u%RotPwr = 0. u%HorWindV = 0. u%YawAngle = 0. - if (allocated(InitInp%LidSpeed)) then ! Must allocate - allocate(u%LidSpeed(size(InitInp%LidSpeed))) - u%LidSpeed = 0. - endif - if (allocated(InitInp%MsrPositionsX)) then - allocate(u%MsrPositionsX(size(InitInp%MsrPositionsX))) - u%MsrPositionsX = 0. - endif - if (allocated(InitInp%MsrPositionsY)) then - allocate(u%MsrPositionsY(size(InitInp%MsrPositionsY))) - u%MsrPositionsY = 0. - endif - if (allocated(InitInp%MsrPositionsZ)) then - allocate(u%MsrPositionsZ(size(InitInp%MsrPositionsZ))) - u%MsrPositionsZ = 0. - endif + m%dll_data%ElecPwr_prev = 0. m%dll_data%GenTrq_prev = 0. @@ -474,8 +471,6 @@ SUBROUTINE SrvD_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, InitO p%SensorType = InitInp%SensorType p%NumBeam = InitInp%NumBeam p%NumPulseGate = InitInp%NumPulseGate - p%PulseSpacing = InitInp%PulseSpacing - p%URefLid = InitInp%URefLid CALL BladedInterface_Init(u, p, m, xd, y, InputFileData, InitInp, StC_CtrlChanInitInfo, UnSum, ErrStat2, ErrMsg2 ) if (Failed()) return; diff --git a/modules/servodyn/src/ServoDyn_Registry.txt b/modules/servodyn/src/ServoDyn_Registry.txt index 0a6d8e7efe..8160192355 100644 --- a/modules/servodyn/src/ServoDyn_Registry.txt +++ b/modules/servodyn/src/ServoDyn_Registry.txt @@ -52,15 +52,9 @@ typedef ^ InitInputType CHARACTER(64) CableControlRequestor {:} - - "Array with typedef ^ InitInputType IntKi InterpOrder - - - "Interpolation order from glue code -- required to set m%u_xStC sizes" - #ADD in the TMD submodule input file passing here #initial inputs of lidar parameters -typedef ^ InitInputType ReKi LidSpeed {:} - - "Number of Lidar measurement distances" - -typedef ^ InitInputType ReKi MsrPositionsX {:} - - "Lidar X direction measurement points" m -typedef ^ InitInputType ReKi MsrPositionsY {:} - - "Lidar Y direction measurement points" m -typedef ^ InitInputType ReKi MsrPositionsZ {:} - - "Lidar Z direction measurement points" m typedef ^ InitInputType IntKi SensorType - - - "Lidar sensor type" - typedef ^ InitInputType IntKi NumBeam - - - "Number of beams" - typedef ^ InitInputType IntKi NumPulseGate - - - "Number of pulse gates" - -typedef ^ InitInputType ReKi PulseSpacing - - - "Distance between range gates" - -typedef ^ InitInputType ReKi URefLid - - - "Reference average wind speed for the lidar" m/s # Define outputs from the initialization routine here: typedef ^ InitOutputType CHARACTER(ChanLen) WriteOutputHdr {:} - - "Names of the output-to-file channels" - @@ -236,8 +230,6 @@ typedef ^ BladedDLLType ReKi MsrPositionsZ {:} - - "Lidar Z direction meas typedef ^ BladedDLLType IntKi SensorType - - - "Lidar sensor type" - typedef ^ BladedDLLType IntKi NumBeam - - - "Number of beams" - typedef ^ BladedDLLType IntKi NumPulseGate - - - "Number of pulse gates" - -typedef ^ BladedDLLType IntKi PulseSpacing - - - "Distance between range gates" - -typedef ^ BladedDLLType IntKi URefLid - - - "Reference average wind speed for the lidar" m/s ## these are PARAMETERS sent to the DLL (THEIR VALUES SHOULD NOT CHANGE DURING SIMULATION): typedef ^ BladedDLLType DbKi DLL_DT - - - "interval for calling DLL (integer multiple number of DT)" s typedef ^ BladedDLLType CHARACTER(1024) DLL_InFile - - - "Name of input file used in DLL" - @@ -485,8 +477,6 @@ typedef ^ ParameterType Integer Jac_Idx_SStC_y {:}{:} - - "the start and typedef ^ ParameterType IntKi SensorType - - - "Lidar sensor type" - typedef ^ ParameterType IntKi NumBeam - - - "Number of beams" - typedef ^ ParameterType IntKi NumPulseGate - - - "Number of pulse gates" - -typedef ^ ParameterType ReKi PulseSpacing - - - "Distance between range gates" m -typedef ^ ParameterType ReKi URefLid - - - "Reference average wind speed for the lidar" m/s diff --git a/modules/servodyn/src/ServoDyn_Types.f90 b/modules/servodyn/src/ServoDyn_Types.f90 index eb53b248ae..da5d45358c 100644 --- a/modules/servodyn/src/ServoDyn_Types.f90 +++ b/modules/servodyn/src/ServoDyn_Types.f90 @@ -69,15 +69,9 @@ MODULE ServoDyn_Types INTEGER(IntKi) :: NumCableControl = 0_IntKi !< Number of cable control channels requested [-] CHARACTER(64) , DIMENSION(:), ALLOCATABLE :: CableControlRequestor !< Array with text info about which module requested the cable control channel (size of NumCableControl). This is just for diagnostics. [-] INTEGER(IntKi) :: InterpOrder = 0_IntKi !< Interpolation order from glue code -- required to set m%u_xStC sizes [-] - REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: LidSpeed !< Number of Lidar measurement distances [-] - REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: MsrPositionsX !< Lidar X direction measurement points [m] - REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: MsrPositionsY !< Lidar Y direction measurement points [m] - REAL(ReKi) , DIMENSION(:), ALLOCATABLE :: MsrPositionsZ !< Lidar Z direction measurement points [m] INTEGER(IntKi) :: SensorType = 0_IntKi !< Lidar sensor type [-] INTEGER(IntKi) :: NumBeam = 0_IntKi !< Number of beams [-] INTEGER(IntKi) :: NumPulseGate = 0_IntKi !< Number of pulse gates [-] - REAL(ReKi) :: PulseSpacing = 0.0_ReKi !< Distance between range gates [-] - REAL(ReKi) :: URefLid = 0.0_ReKi !< Reference average wind speed for the lidar [m/s] END TYPE SrvD_InitInputType ! ======================= ! ========= SrvD_InitOutputType ======= @@ -249,8 +243,6 @@ MODULE ServoDyn_Types INTEGER(IntKi) :: SensorType = 0_IntKi !< Lidar sensor type [-] INTEGER(IntKi) :: NumBeam = 0_IntKi !< Number of beams [-] INTEGER(IntKi) :: NumPulseGate = 0_IntKi !< Number of pulse gates [-] - INTEGER(IntKi) :: PulseSpacing = 0_IntKi !< Distance between range gates [-] - INTEGER(IntKi) :: URefLid = 0_IntKi !< Reference average wind speed for the lidar [m/s] REAL(DbKi) :: DLL_DT = 0.0_R8Ki !< interval for calling DLL (integer multiple number of DT) [s] CHARACTER(1024) :: DLL_InFile !< Name of input file used in DLL [-] CHARACTER(1024) :: RootName !< RootName for writing output files [-] @@ -491,8 +483,6 @@ MODULE ServoDyn_Types INTEGER(IntKi) :: SensorType = 0_IntKi !< Lidar sensor type [-] INTEGER(IntKi) :: NumBeam = 0_IntKi !< Number of beams [-] INTEGER(IntKi) :: NumPulseGate = 0_IntKi !< Number of pulse gates [-] - REAL(ReKi) :: PulseSpacing = 0.0_ReKi !< Distance between range gates [m] - REAL(ReKi) :: URefLid = 0.0_ReKi !< Reference average wind speed for the lidar [m/s] END TYPE SrvD_ParameterType ! ======================= ! ========= SrvD_InputType ======= @@ -682,59 +672,9 @@ subroutine SrvD_CopyInitInput(SrcInitInputData, DstInitInputData, CtrlCode, ErrS DstInitInputData%CableControlRequestor = SrcInitInputData%CableControlRequestor end if DstInitInputData%InterpOrder = SrcInitInputData%InterpOrder - if (allocated(SrcInitInputData%LidSpeed)) then - LB(1:1) = lbound(SrcInitInputData%LidSpeed) - UB(1:1) = ubound(SrcInitInputData%LidSpeed) - if (.not. allocated(DstInitInputData%LidSpeed)) then - allocate(DstInitInputData%LidSpeed(LB(1):UB(1)), stat=ErrStat2) - if (ErrStat2 /= 0) then - call SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%LidSpeed.', ErrStat, ErrMsg, RoutineName) - return - end if - end if - DstInitInputData%LidSpeed = SrcInitInputData%LidSpeed - end if - if (allocated(SrcInitInputData%MsrPositionsX)) then - LB(1:1) = lbound(SrcInitInputData%MsrPositionsX) - UB(1:1) = ubound(SrcInitInputData%MsrPositionsX) - if (.not. allocated(DstInitInputData%MsrPositionsX)) then - allocate(DstInitInputData%MsrPositionsX(LB(1):UB(1)), stat=ErrStat2) - if (ErrStat2 /= 0) then - call SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%MsrPositionsX.', ErrStat, ErrMsg, RoutineName) - return - end if - end if - DstInitInputData%MsrPositionsX = SrcInitInputData%MsrPositionsX - end if - if (allocated(SrcInitInputData%MsrPositionsY)) then - LB(1:1) = lbound(SrcInitInputData%MsrPositionsY) - UB(1:1) = ubound(SrcInitInputData%MsrPositionsY) - if (.not. allocated(DstInitInputData%MsrPositionsY)) then - allocate(DstInitInputData%MsrPositionsY(LB(1):UB(1)), stat=ErrStat2) - if (ErrStat2 /= 0) then - call SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%MsrPositionsY.', ErrStat, ErrMsg, RoutineName) - return - end if - end if - DstInitInputData%MsrPositionsY = SrcInitInputData%MsrPositionsY - end if - if (allocated(SrcInitInputData%MsrPositionsZ)) then - LB(1:1) = lbound(SrcInitInputData%MsrPositionsZ) - UB(1:1) = ubound(SrcInitInputData%MsrPositionsZ) - if (.not. allocated(DstInitInputData%MsrPositionsZ)) then - allocate(DstInitInputData%MsrPositionsZ(LB(1):UB(1)), stat=ErrStat2) - if (ErrStat2 /= 0) then - call SetErrStat(ErrID_Fatal, 'Error allocating DstInitInputData%MsrPositionsZ.', ErrStat, ErrMsg, RoutineName) - return - end if - end if - DstInitInputData%MsrPositionsZ = SrcInitInputData%MsrPositionsZ - end if DstInitInputData%SensorType = SrcInitInputData%SensorType DstInitInputData%NumBeam = SrcInitInputData%NumBeam DstInitInputData%NumPulseGate = SrcInitInputData%NumPulseGate - DstInitInputData%PulseSpacing = SrcInitInputData%PulseSpacing - DstInitInputData%URefLid = SrcInitInputData%URefLid end subroutine subroutine SrvD_DestroyInitInput(InitInputData, ErrStat, ErrMsg) @@ -766,18 +706,6 @@ subroutine SrvD_DestroyInitInput(InitInputData, ErrStat, ErrMsg) if (allocated(InitInputData%CableControlRequestor)) then deallocate(InitInputData%CableControlRequestor) end if - if (allocated(InitInputData%LidSpeed)) then - deallocate(InitInputData%LidSpeed) - end if - if (allocated(InitInputData%MsrPositionsX)) then - deallocate(InitInputData%MsrPositionsX) - end if - if (allocated(InitInputData%MsrPositionsY)) then - deallocate(InitInputData%MsrPositionsY) - end if - if (allocated(InitInputData%MsrPositionsZ)) then - deallocate(InitInputData%MsrPositionsZ) - end if end subroutine subroutine SrvD_PackInitInput(RF, Indata) @@ -818,15 +746,9 @@ subroutine SrvD_PackInitInput(RF, Indata) call RegPack(RF, InData%NumCableControl) call RegPackAlloc(RF, InData%CableControlRequestor) call RegPack(RF, InData%InterpOrder) - call RegPackAlloc(RF, InData%LidSpeed) - call RegPackAlloc(RF, InData%MsrPositionsX) - call RegPackAlloc(RF, InData%MsrPositionsY) - call RegPackAlloc(RF, InData%MsrPositionsZ) call RegPack(RF, InData%SensorType) call RegPack(RF, InData%NumBeam) call RegPack(RF, InData%NumPulseGate) - call RegPack(RF, InData%PulseSpacing) - call RegPack(RF, InData%URefLid) if (RegCheckErr(RF, RoutineName)) return end subroutine @@ -871,15 +793,9 @@ subroutine SrvD_UnPackInitInput(RF, OutData) call RegUnpack(RF, OutData%NumCableControl); if (RegCheckErr(RF, RoutineName)) return call RegUnpackAlloc(RF, OutData%CableControlRequestor); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%InterpOrder); if (RegCheckErr(RF, RoutineName)) return - call RegUnpackAlloc(RF, OutData%LidSpeed); if (RegCheckErr(RF, RoutineName)) return - call RegUnpackAlloc(RF, OutData%MsrPositionsX); if (RegCheckErr(RF, RoutineName)) return - call RegUnpackAlloc(RF, OutData%MsrPositionsY); if (RegCheckErr(RF, RoutineName)) return - call RegUnpackAlloc(RF, OutData%MsrPositionsZ); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%SensorType); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%NumBeam); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%NumPulseGate); if (RegCheckErr(RF, RoutineName)) return - call RegUnpack(RF, OutData%PulseSpacing); if (RegCheckErr(RF, RoutineName)) return - call RegUnpack(RF, OutData%URefLid); if (RegCheckErr(RF, RoutineName)) return end subroutine subroutine SrvD_CopyInitOutput(SrcInitOutputData, DstInitOutputData, CtrlCode, ErrStat, ErrMsg) @@ -1671,8 +1587,6 @@ subroutine SrvD_CopyBladedDLLType(SrcBladedDLLTypeData, DstBladedDLLTypeData, Ct DstBladedDLLTypeData%SensorType = SrcBladedDLLTypeData%SensorType DstBladedDLLTypeData%NumBeam = SrcBladedDLLTypeData%NumBeam DstBladedDLLTypeData%NumPulseGate = SrcBladedDLLTypeData%NumPulseGate - DstBladedDLLTypeData%PulseSpacing = SrcBladedDLLTypeData%PulseSpacing - DstBladedDLLTypeData%URefLid = SrcBladedDLLTypeData%URefLid DstBladedDLLTypeData%DLL_DT = SrcBladedDLLTypeData%DLL_DT DstBladedDLLTypeData%DLL_InFile = SrcBladedDLLTypeData%DLL_InFile DstBladedDLLTypeData%RootName = SrcBladedDLLTypeData%RootName @@ -2049,8 +1963,6 @@ subroutine SrvD_PackBladedDLLType(RF, Indata) call RegPack(RF, InData%SensorType) call RegPack(RF, InData%NumBeam) call RegPack(RF, InData%NumPulseGate) - call RegPack(RF, InData%PulseSpacing) - call RegPack(RF, InData%URefLid) call RegPack(RF, InData%DLL_DT) call RegPack(RF, InData%DLL_InFile) call RegPack(RF, InData%RootName) @@ -2167,8 +2079,6 @@ subroutine SrvD_UnPackBladedDLLType(RF, OutData) call RegUnpack(RF, OutData%SensorType); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%NumBeam); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%NumPulseGate); if (RegCheckErr(RF, RoutineName)) return - call RegUnpack(RF, OutData%PulseSpacing); if (RegCheckErr(RF, RoutineName)) return - call RegUnpack(RF, OutData%URefLid); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%DLL_DT); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%DLL_InFile); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%RootName); if (RegCheckErr(RF, RoutineName)) return @@ -4861,8 +4771,6 @@ subroutine SrvD_CopyParam(SrcParamData, DstParamData, CtrlCode, ErrStat, ErrMsg) DstParamData%SensorType = SrcParamData%SensorType DstParamData%NumBeam = SrcParamData%NumBeam DstParamData%NumPulseGate = SrcParamData%NumPulseGate - DstParamData%PulseSpacing = SrcParamData%PulseSpacing - DstParamData%URefLid = SrcParamData%URefLid end subroutine subroutine SrvD_DestroyParam(ParamData, ErrStat, ErrMsg) @@ -5159,8 +5067,6 @@ subroutine SrvD_PackParam(RF, Indata) call RegPack(RF, InData%SensorType) call RegPack(RF, InData%NumBeam) call RegPack(RF, InData%NumPulseGate) - call RegPack(RF, InData%PulseSpacing) - call RegPack(RF, InData%URefLid) if (RegCheckErr(RF, RoutineName)) return end subroutine @@ -5354,8 +5260,6 @@ subroutine SrvD_UnPackParam(RF, OutData) call RegUnpack(RF, OutData%SensorType); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%NumBeam); if (RegCheckErr(RF, RoutineName)) return call RegUnpack(RF, OutData%NumPulseGate); if (RegCheckErr(RF, RoutineName)) return - call RegUnpack(RF, OutData%PulseSpacing); if (RegCheckErr(RF, RoutineName)) return - call RegUnpack(RF, OutData%URefLid); if (RegCheckErr(RF, RoutineName)) return end subroutine subroutine SrvD_CopyInput(SrcInputData, DstInputData, CtrlCode, ErrStat, ErrMsg)