Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] ServoDyn inputs for Lidar allocated twice, and a few other minor issues #1620

Merged
merged 3 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions modules/inflowwind/src/Lidar.f90
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ SUBROUTINE Lidar_Init( InitInp, u, p, x, xd, z, OtherState, y, m, Interval, Init
RETURN
ENDIF

CALL AllocAry(p%lidar%MsrPosition , 3, p%lidar%NumBeam, 'Array for measurement coordinates', TmpErrStat, TmpErrMsg )
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

Expand Down Expand Up @@ -362,7 +362,8 @@ SUBROUTINE Lidar_CalcOutput( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMs
MeasurementCurrentStep = INT(t / p%lidar%MeasurementInterval)

IF ( (p%lidar%MeasurementInterval * MeasurementCurrentStep) /= t ) THEN
Output%VelocityUVW(:,1) = 0
!This isn't returned, so don't set it.
! Output%VelocityUVW(:,1) = 0
RETURN
ENDIF

Expand Down
28 changes: 18 additions & 10 deletions modules/servodyn/src/BladedInterface_EX.f90
Original file line number Diff line number Diff line change
Expand Up @@ -375,25 +375,33 @@ end subroutine InitStCCtrl
subroutine InitLidarMeas()
integer :: I,J
if (p%NumBeam == 0) return ! Nothing to set
! Allocate arrays for inputs
if (allocated(InitInp%LidSpeed)) then ! make sure we have the array allocated before setting it
CALL AllocAry(u%LidSpeed, size(InitInp%LidSpeed), 'u%LidSpeed', errStat2, ErrMsg2)
if (Failed()) return
! 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
endif
if (allocated(InitInp%MsrPositionsX)) then ! make sure we have the array allocated before setting it
CALL AllocAry(u%MsrPositionsX, size(InitInp%MsrPositionsX), 'u%MsrPositionsX', errStat2, ErrMsg2)
if (Failed()) return
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
endif
if (allocated(InitInp%MsrPositionsY)) then ! make sure we have the array allocated before setting it
CALL AllocAry(u%MsrPositionsY, size(InitInp%MsrPositionsY), 'u%MsrPositionsY', errStat2, ErrMsg2)
if (Failed()) return
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
endif
if (allocated(InitInp%MsrPositionsZ)) then ! make sure we have the array allocated before setting it
CALL AllocAry(u%MsrPositionsZ, size(InitInp%MsrPositionsZ), 'u%MsrPositionsZ', errStat2, ErrMsg2)
if (Failed()) return
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
endif
! Write summary info to summary file
Expand Down