Skip to content

Commit

Permalink
Minor bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastiaan Mulders committed Dec 6, 2017
1 parent 1f7d186 commit dbd5387
Show file tree
Hide file tree
Showing 23 changed files with 157 additions and 19 deletions.
Binary file added DISCON/DISCON_gwin32.dll
Binary file not shown.
Binary file modified DISCON/DISCON_gwin64.dll
Binary file not shown.
53 changes: 53 additions & 0 deletions Parameter_files/NREL5MW/ControllerParameters.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
2.5132741 ! CornerFreq - Corner frequency (-3dB point) in the first-order low-pass filter, [rad/s]
0 ! LoggingLevel - 0 = write no debug files, 1 = write standard output .dbg-file, 2 = write standard output .dbg-file and complete avrSWAP-array .dbg2-file
0.087266 ! IPC_IntSat - Integrator saturation (maximum signal amplitude contrbution to pitch from IPC), [rad]
8E-10 ! IPC_KI - Integral gain for the individual pitch controller, [-].
0 ! IPC_ControlMode - Turn Individual Pitch Control (IPC) for fatigue load reductions (pitch contribution) on = 1/off = 0
0.3141592 ! IPC_omegaHP - High-pass filter cut-in frequency used to separate yaw-by-IPC contribution from blade load reduction contribution, [rad/s].
0.6283185 ! IPC_omegaLP - Low-pass filter corner frequency for the individual pitch controller, [rad/s].
1.269330365 ! IPC_omegaNotch - Notch filter corner frequency for the individual pitch controller, [rad/s].
0.436332313 ! IPC_phi - Phase offset added to the azimuth angle for the individual pitch controller, [rad].
0.70 ! IPC_zetaHP - High-pass filter damping value, [-].
1.0 ! IPC_zetaLP - Low-pass filter damping factor for the individual pitch controller, [-].
0.5 ! IPC_zetaNotch - Notch filter damping factor for the individual pitch controller, [-].
13 ! PC_GS_n - Amount of gain-scheduling table entries
0 0.0349 0.0698 0.1047 0.1396 0.1745 0.2094 0.2443 0.2793 0.3142 0.3491 0.384 0.4189 ! PC_GS_angles - Gain-schedule table: pitch angles
-0.0105 -0.0104 -0.0102 -0.0099 -0.0095 -0.0091 -0.0086 -0.0081 -0.0076 -0.0071 -0.0066 -0.0061 -0.0056 ! PC_GS_kp - Gain-schedule table: pitch controller kp gains
-0.0028 -0.0028 -0.0027 -0.0027 -0.0026 -0.0024 -0.0023 -0.0022 -0.002 -0.0019 -0.0018 -0.0016 -0.0015 ! PC_GS_ki - Gain-schedule table: pitch controller ki gains
0 0 0 0 0 0 0 0 0 0 0 0 0 ! PC_GS_kd - Gain-schedule table: pitch controller kd gains
0 0 0 0 0 0 0 0 0 0 0 0 0 ! PC_GS_tf - Gain-schedule table: pitch controller tf gains (derivative filter)
1 ! PC_ConstP_n - Amount of controller gains for the constant power contribution to collective pitch control
-4.0E-09 ! PC_ConstP_KP - Proportional gain(s), constant power contribution to collective pitch control
-4.0E-09 ! PC_ConstP_KI - Integral gain(s), constant power contribution to collective pitch control
1.5707 ! PC_MaxPit - Maximum physical pitch limit, [rad].
-0.087266 ! PC_MinPit - Minimum physical pitch limit, [rad].
0.17453 ! PC_MaxRat - Maximum pitch rate (in absolute value) in pitch controller, [rad/s].
-0.17453 ! PC_MinRat - Minimum pitch rate (in absolute value) in pitch controller, [rad/s].
50.26548 ! PC_RefSpd - Desired (reference) HSS speed for pitch controller, [rad/s].
0.0 ! PC_SetPnt - Record 5: Below-rated pitch angle set-point, [rad]
0.034906 ! PC_Switch - Angle above lowest minimum pitch angle for switch [rad]
0 ! VS_ControlMode - Generator torque control mode in above rated conditions, 0 = constant torque / 1 = constant power
26.179938 ! VS_CtInSp - Transitional generator speed (HSS side) between regions 1 and 1 1/2, [rad/s].
212900 ! VS_GenTrqArSatMax - Above rated generator torque PI control saturation, [Nm]
42.411 ! VS_MaxOM - Optimal mode maximum speed, [rad/s].
150000.0 ! VS_MaxRat - Maximum torque rate (in absolute value) in torque controller, [Nm/s].
250000.0 ! VS_MaxTq - Maximum generator torque in Region 3 (HSS side), [Nm].
0.0 ! VS_MinTq - Minimum generator (HSS side), [Nm].
31.415 ! VS_MinOM - Optimal mode minimum speed, [rad/s]
104.1 ! VS_Rgn2K - Generator torque constant in Region 2 (HSS side), N-m/(rad/s)^2
1.0E+07 ! VS_RtPwr - Wind turbine rated power [W]
198943.6 ! VS_RtTq - Rated torque, [Nm].
42.411 ! VS_RtSpd - Rated generator speed [rad/s]
1 ! VS_n - Number of controller gains
-27338.24 ! VS_KP - Proportional gain for generator PI torque controller, used in the transitional 2.5 region, [1/(rad/s) Nm]
-6134.68 ! VS_KI - Integral gain for generator PI torque controller, used in the transitional 2.5 region, [1/rad Nm]
2 ! Y_ControlMode - Yaw control mode: (0 = no yaw control, 1 = yaw rate control, 2 = yaw-by-IPC)
1.745329252 ! Y_ErrThresh - Yaw error threshold. Turbine begins to yaw when it passes this. [rad^2 s]
0.17453 ! Y_IPC_IntSat - Integrator saturation (maximum signal amplitude contrbution to pitch from yaw-by-IPC), [rad]
1 ! Y_IPC_n - Number of controller gains (yaw-by-IPC)
-0.064 ! Y_IPC_KP - Yaw-by-IPC proportional controller gain Kp
-0.0008 ! Y_IPC_KI - Yaw-by-IPC integral controller gain Ki
0.00000 ! Y_MErrSet - Yaw alignment error, setpoint [rad]
1.0 ! Y_omegaLPFast - Corner frequency fast low pass filter, 1.0 [Hz]
0.016667 ! Y_omegaLPSlow - Corner frequency slow low pass filter, 1/60 [Hz]
0.0034906 ! Y_Rate - Yaw rate [rad/s]
8 changes: 4 additions & 4 deletions Source/Controllers.f90
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,16 @@ SUBROUTINE VariableSpeedControl(avrSWAP, CntrPar, LocalVar, objInst)
LocalVar%VS_SpdErrAr = CntrPar%VS_RtSpd - LocalVar%GenSpeedF ! Current speed error - Above-rated PI-control
LocalVar%VS_SpdErrBr = CntrPar%VS_MinOM - LocalVar%GenSpeedF ! Current speed error - Below-rated PI-control
IF (LocalVar%PC_PitComT >= CntrPar%VS_Rgn3MP) THEN ! We are in region 3
LocalVar%GenTrqAr = PIController(LocalVar%VS_SpdErrAr, CntrPar%VS_KP(1), CntrPar%VS_KI(1), CntrPar%VS_Rgn2MaxTq, CntrPar%VS_GenTrqArSatMax, LocalVar%DT, CntrPar%VS_GenTrqArSatMax, .TRUE., 80)
LocalVar%GenTrqBr = PIController(LocalVar%VS_SpdErrBr, CntrPar%VS_KP(1), CntrPar%VS_KI(1), CntrPar%VS_MinTq, CntrPar%VS_Rgn2MinTq, LocalVar%DT, CntrPar%VS_Rgn2MinTq, .TRUE., 81)
LocalVar%GenTrqAr = PIController(LocalVar%VS_SpdErrAr, CntrPar%VS_KP(1), CntrPar%VS_KI(1), CntrPar%VS_Rgn2MaxTq, CntrPar%VS_GenTrqArSatMax, LocalVar%DT, CntrPar%VS_GenTrqArSatMax, .TRUE., objInst%instPI)
LocalVar%GenTrqBr = PIController(LocalVar%VS_SpdErrBr, CntrPar%VS_KP(1), CntrPar%VS_KI(1), CntrPar%VS_MinTq, CntrPar%VS_Rgn2MinTq, LocalVar%DT, CntrPar%VS_Rgn2MinTq, .TRUE., objInst%instPI)
IF (CntrPar%VS_ControlMode == 1) THEN ! Constant power tracking
LocalVar%GenTrq = CntrPar%VS_RtPwr/LocalVar%GenSpeedF
ELSE ! Constant torque tracking
LocalVar%GenTrq = CntrPar%VS_RtTq
END IF
ELSE
LocalVar%GenTrqAr = PIController(LocalVar%VS_SpdErrAr, CntrPar%VS_KP(1), CntrPar%VS_KI(1), CntrPar%VS_Rgn2MaxTq, CntrPar%VS_GenTrqArSatMax, LocalVar%DT, CntrPar%VS_Rgn2MaxTq, .FALSE., 80)
LocalVar%GenTrqBr = PIController(LocalVar%VS_SpdErrBr, CntrPar%VS_KP(1), CntrPar%VS_KI(1), CntrPar%VS_MinTq, CntrPar%VS_Rgn2MinTq, LocalVar%DT, CntrPar%VS_Rgn2MinTq, .FALSE., 81)
LocalVar%GenTrqAr = PIController(LocalVar%VS_SpdErrAr, CntrPar%VS_KP(1), CntrPar%VS_KI(1), CntrPar%VS_Rgn2MaxTq, CntrPar%VS_GenTrqArSatMax, LocalVar%DT, CntrPar%VS_Rgn2MaxTq, .FALSE., objInst%instPI)
LocalVar%GenTrqBr = PIController(LocalVar%VS_SpdErrBr, CntrPar%VS_KP(1), CntrPar%VS_KI(1), CntrPar%VS_MinTq, CntrPar%VS_Rgn2MinTq, LocalVar%DT, CntrPar%VS_Rgn2MinTq, .FALSE., objInst%instPI)
IF (LocalVar%GenTrqAr >= CntrPar%VS_Rgn2MaxTq*1.01) THEN
LocalVar%GenTrq = LocalVar%GenTrqAr
CONTINUE
Expand Down
22 changes: 22 additions & 0 deletions Source/DISCON.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "DISCON", "DISCON.vfproj", "{1EDB6BC1-C5C9-4E4F-8785-31B8143FCBC6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1EDB6BC1-C5C9-4E4F-8785-31B8143FCBC6}.Release|x64.ActiveCfg = Release|x64
{1EDB6BC1-C5C9-4E4F-8785-31B8143FCBC6}.Release|x64.Build.0 = Release|x64
{1EDB6BC1-C5C9-4E4F-8785-31B8143FCBC6}.Release|x86.ActiveCfg = Release|Win32
{1EDB6BC1-C5C9-4E4F-8785-31B8143FCBC6}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Empty file added Source/DISCON.u2d
Empty file.
39 changes: 39 additions & 0 deletions Source/DISCON.vfproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject ProjectType="typeDynamicLibrary" ProjectCreator="Intel Fortran" Keyword="Dll" Version="11.0" ProjectIdGuid="{1EDB6BC1-C5C9-4E4F-8785-31B8143FCBC6}">
<Platforms>
<Platform Name="Win32"/>
<Platform Name="x64"/></Platforms>
<Configurations>
<Configuration Name="Release|Win32" ConfigurationType="typeDynamicLibrary">
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" RuntimeLibrary="rtMultiThreadedDLL"/>
<Tool Name="VFLinkerTool" SuppressStartupBanner="true" SubSystem="subSystemWindows" LinkDLL="true"/>
<Tool Name="VFResourceCompilerTool"/>
<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="Release|x64" ConfigurationType="typeDynamicLibrary">
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" RuntimeLibrary="rtMultiThreadedDLL"/>
<Tool Name="VFLinkerTool" SuppressStartupBanner="true" SubSystem="subSystemWindows" LinkDLL="true"/>
<Tool Name="VFResourceCompilerTool"/>
<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration></Configurations>
<Files>
<Filter Name="Header Files" Filter="fi;fd"/>
<Filter Name="Resource Files" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"/>
<Filter Name="Source Files" Filter="f90;for;f;fpp;ftn;def;odl;idl">
<File RelativePath=".\Constants.f90"/>
<File RelativePath=".\Controllers.f90"/>
<File RelativePath=".\DISCON.f90"/>
<File RelativePath=".\DRC_Types.f90"/>
<File RelativePath=".\Filters.f90"/>
<File RelativePath=".\FunctionToolbox.f90"/>
<File RelativePath=".\ReadSetParameters.f90"/></Filter>
<File RelativePath=".\ReadMe.txt"/></Files>
<Globals/></VisualStudioProject>
26 changes: 13 additions & 13 deletions Source/FunctionToolbox.f90
Original file line number Diff line number Diff line change
Expand Up @@ -45,33 +45,32 @@ REAL FUNCTION PIController(error, kp, ki, minValue, maxValue, DT, I0, reset, ins
!
IMPLICIT NONE

! Inputs
REAL(4), INTENT(IN) :: error
REAL(4), INTENT(IN) :: kp
REAL(4), INTENT(IN) :: ki
REAL(4), INTENT(IN) :: minValue
REAL(4), INTENT(IN) :: maxValue
REAL(4), INTENT(IN) :: DT
INTEGER(4), INTENT(IN) :: inst
REAL(4), INTENT(IN) :: I0
LOGICAL, INTENT(IN) :: reset
! Inputs
REAL(4), INTENT(IN) :: error
REAL(4), INTENT(IN) :: kp
REAL(4), INTENT(IN) :: ki
REAL(4), INTENT(IN) :: minValue
REAL(4), INTENT(IN) :: maxValue
REAL(4), INTENT(IN) :: DT
INTEGER(4), INTENT(INOUT) :: inst
REAL(4), INTENT(IN) :: I0
LOGICAL, INTENT(IN) :: reset

! Local
! Local
INTEGER(4) :: i ! Counter for making arrays
REAL(4) :: PTerm ! Proportional term
REAL(4), DIMENSION(99), SAVE :: ITerm = (/ (real(9999.9), i = 1,99) /) ! Integral term, current.
REAL(4), DIMENSION(99), SAVE :: ITermLast = (/ (real(9999.9), i = 1,99) /) ! Integral term, the last time this controller was called. Supports 99 separate instances.
INTEGER(4), DIMENSION(99), SAVE :: FirstCall = (/ (1, i=1,99) /) ! First call of this function?

! Initialize persistent variables/arrays, and set inital condition for integrator term
! Initialize persistent variables/arrays, and set inital condition for integrator term
IF ((FirstCall(inst) == 1) .OR. reset) THEN
ITerm(inst) = I0
ITermLast(inst) = I0

FirstCall(inst) = 0
PIController = I0
ELSE

PTerm = kp*error
ITerm(inst) = ITerm(inst) + DT*ki*error
ITerm(inst) = saturate(ITerm(inst), minValue, maxValue)
Expand All @@ -80,6 +79,7 @@ REAL FUNCTION PIController(error, kp, ki, minValue, maxValue, DT, I0, reset, ins

ITermLast(inst) = ITerm(inst)
END IF
inst = inst + 1

END FUNCTION PIController
!-------------------------------------------------------------------------------------------------------------------------------
Expand Down
Binary file added Source/Release/BuildLog.htm
Binary file not shown.
Binary file added Source/Release/DISCON.dll
Binary file not shown.
3 changes: 3 additions & 0 deletions Source/Release/DISCON.dll.embed.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
</assembly>
Binary file added Source/Release/DISCON.dll.embed.manifest.rc
Binary file not shown.
Binary file added Source/Release/DISCON.dll.embed.manifest.res
Binary file not shown.
10 changes: 10 additions & 0 deletions Source/Release/DISCON.dll.intermediate.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Binary file added Source/Release/DISCON.exp
Binary file not shown.
2 changes: 0 additions & 2 deletions Source/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# 32-bit or 64-bit?
#BITS = 32
BITS = 64


# Location of source files for the DLL.
# You may need to change these for your DLL.

Expand Down
Binary file added Source/x64/Release/BuildLog.htm
Binary file not shown.
Binary file added Source/x64/Release/DISCON.dll
Binary file not shown.
3 changes: 3 additions & 0 deletions Source/x64/Release/DISCON.dll.embed.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
</assembly>
Binary file added Source/x64/Release/DISCON.dll.embed.manifest.rc
Binary file not shown.
Binary file added Source/x64/Release/DISCON.dll.embed.manifest.res
Binary file not shown.
10 changes: 10 additions & 0 deletions Source/x64/Release/DISCON.dll.intermediate.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Binary file added Source/x64/Release/DISCON.exp
Binary file not shown.

0 comments on commit dbd5387

Please sign in to comment.