Skip to content

Commit

Permalink
WSE Cp bugfix, add debug var
Browse files Browse the repository at this point in the history
  • Loading branch information
dzalkind committed Jul 9, 2020
1 parent 9df6cd8 commit 4611014
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/ControllerBlocks.f90
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ SUBROUTINE WindSpeedEstimator(LocalVar, CntrPar, objInst, PerfData, DebugVar)

! TEST INTERP2D
lambda = LocalVar%RotSpeed * CntrPar%WE_BladeRadius/v_h
DebugVar%WE_Pitch = LocalVar%BlPitch(1)
Cp_op = interp2d(PerfData%Beta_vec,PerfData%TSR_vec,PerfData%Cp_mat, LocalVar%BlPitch(1)*R2D, lambda )
Cp_op = max(0.0,Cp_op)

Expand Down
15 changes: 9 additions & 6 deletions src/Functions.f90
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ REAL FUNCTION interp2d(xData, yData, zData, xq, yq)
fQ(1,2) = zData(i,jj)
fQ(2,2) = zData(ii,jj)
! Interpolate
fxy1 = (xData(jj) - xq)/(xData(jj) - xData(j))*fQ(1,1) + (xq - xData(j))/(xData(jj) - xData(j))*fQ(2,1)
fxy2 = (xData(jj) - xq)/(xData(jj) - xData(j))*fQ(1,2) + (xq - xData(j))/(xData(jj) - xData(j))*fQ(2,1)
fxy1 = (xData(jj) - xq)/(xData(jj) - xData(j))*fQ(1,1) + (xq - xData(j))/(xData(jj) - xData(j))*fQ(1,2)
fxy2 = (xData(jj) - xq)/(xData(jj) - xData(j))*fQ(2,1) + (xq - xData(j))/(xData(jj) - xData(j))*fQ(2,2)
fxy = (yData(ii) - yq)/(yData(ii) - yData(i))*fxy1 + (yq - yData(i))/(yData(ii) - yData(i))*fxy2

interp2d = fxy(1)
Expand Down Expand Up @@ -472,7 +472,7 @@ SUBROUTINE Debug(LocalVar, CntrPar, DebugVar, avrSWAP, RootName, size_avcOUTNAME

! Set up Debug Strings and Data
! Note that Debug strings have 10 character limit
nDebugOuts = 8
nDebugOuts = 9
ALLOCATE(DebugOutData(nDebugOuts))
! Header Unit Variable
DebugOutStr1 = 'IMU_FA_AccF'; DebugOutUni1 = '(m/s)'; DebugOutData(1) = LocalVar%NacIMU_FA_AccF
Expand All @@ -483,13 +483,16 @@ SUBROUTINE Debug(LocalVar, CntrPar, DebugVar, avrSWAP, RootName, size_avcOUTNAME
DebugOutStr6 = 'WE_Cp'; DebugOutUni6 = '(-)'; DebugOutData(6) = DebugVar%WE_Cp
DebugOutStr7 = 'PC_MinPit'; DebugOutUni7 = '(rad)'; DebugOutData(7) = LocalVar%PC_MinPit
DebugOutStr8 = 'SS_dOmF'; DebugOutUni8 = '(rad/s)'; DebugOutData(8) = LocalVar%SS_DelOmegaF
DebugOutStr9 = 'WE_Pitch'; DebugOutUni8 = '(rad)'; DebugOutData(9) = DebugVar%WE_Pitch

Allocate(DebugOutStrings(nDebugOuts))
Allocate(DebugOutUnits(nDebugOuts))
DebugOutStrings = [CHARACTER(10) :: DebugOutStr1, DebugOutStr2, DebugOutStr3, DebugOutStr4, &
DebugOutStr5, DebugOutStr6, DebugOutStr7, DebugOutStr8]
DebugOutStr5, DebugOutStr6, DebugOutStr7, DebugOutStr8, &
DebugOutStr9]
DebugOutUnits = [CHARACTER(10) :: DebugOutUni1, DebugOutUni2, DebugOutUni3, DebugOutUni4, &
DebugOutUni5, DebugOutUni6, DebugOutUni7, DebugOutUni8]
DebugOutUni5, DebugOutUni6, DebugOutUni7, DebugOutUni8, &
DebugOutUni9]

! Initialize debug file
IF (LocalVar%iStatus == 0) THEN ! .TRUE. if we're on the first call to the DLL
Expand Down Expand Up @@ -521,7 +524,7 @@ SUBROUTINE Debug(LocalVar, CntrPar, DebugVar, avrSWAP, RootName, size_avcOUTNAME

! Want debug on first timestep
IF (CntrPar%LoggingLevel > 0) THEN
WRITE (UnDb,FmtDat) LocalVar%Time, LocalVar%NacIMU_FA_AccF, LocalVar%WE_Vw, LocalVar%NacIMU_FA_Acc, LocalVar%FA_Acc, LocalVar%Fl_PitCom, DebugVar%WE_Cp, LocalVar%PC_MinPit, LocalVar%SS_DelOmegaF
WRITE (UnDb,FmtDat) LocalVar%Time, DebugOutData
END IF

IF (MODULO(LocalVar%Time, 10.0) == 0.0) THEN
Expand Down
1 change: 1 addition & 0 deletions src/ROSCO_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ MODULE ROSCO_Types

TYPE, PUBLIC :: DebugVariables
REAL(4) :: WE_Cp ! Cp that WSE uses to determine aerodynamic torque, for debug purposes [-]
REAL(4) :: WE_Pitch ! Cp that WSE uses to determine aerodynamic torque, for debug purposes [-]
END TYPE DebugVariables

END MODULE ROSCO_Types

0 comments on commit 4611014

Please sign in to comment.