Simulating PI controller for region 3

Hi,
I am trying to simulate the PI blade pitch controller which is designed for region 3. I used the following block diagram in MATLAB, but it is not working properly!The pitch angle at the output of the PI controller is about 0.3 rad which reduces the energy capture a lot and finally will cause the turbine to have negative generator speed. but if I just input for example constant 0.02 rad pitch angle to the plant(eliminating controller), it is working properly. The wind speed is about 11.4 m/s and the wind turbine is 5MW one. The pictures of simulation are attached.
Thank you so much
Omid


Dear Omid,

I haven’t looked at your model thoroughly, but with my brief glance a noticed a few problems:

*Your speed error entering the PI controller is defined backwards. You have ( RefSpeed - GenSpeed ), but the value should be ( GenSpeed - RefSpeed ).
*There should be no unit conversion on the Kp and Ki gains. You should remove the *3.14/30 in these gains.
*What is Transfer Fcn2?
*I don’t see the integral saturation or the pitch-rate saturation in your model.
*The pitch angle you feedback for the gain schedular is not saturated.

I hope that helps.

Best regards,

Dear Jason,
Thank you so much for your response. I made those modification and now the PI controller gives reasonable results but the response is too slow !
I just added pitch angle and torque saturation, How should I add saturation for the pitch blade rate, torque rate and also integral saturation?
Thank you so much for your help
Omid

Dear Omid,

For the rate saturations, differentiate the signal, saturate, then reintegrate. For the integral saturation, see the logic in the source code for the NREL 5-MW turbine controller.

Best regards,

Dear Jason,
Thank you so much for your response and sorry for my late response. I read and applied those logics, during these 2 weeks I was designing my controller and I could do some simulation in region 2 and 3, but I am not sure about my simulation results in region 3, therefore I want to compare my simulation results(which is from MATLAB Simulink) with some other results to make sure my simulation is correct. One of the possible ideas is comparing MATLAB simulation with the simulation results of FAST (with the controller file of DISCON.f90) (I could not find a paper that the results are clearly given).
To do this comparison, I need to compile FAST.exe again, I installed the trial version of Intel® Parallel Studio XE 2011 for Windows(Includes Intel® C++ Composer XE, Intel® Visual Fortran Composer XE, Intel® VTune™ Amplifier XE, Intel® Inspector XE) and trial version of Microsoft visual studio 2008. I used the file Compile_FAST.bat to compile the source files and get the FAST.exe (in this step, I just wanted to get the FAST.exe without any modification to the source files.). The path in the file Compile_FAST.bat is changed and I have copied this file below:

*Compile_FAST.bat

@ECHO OFF

REM The calling syntax for this script is
REM Compile_FAST [dll]
REM
REM Add the “dll” to the command line to compile FAST for the Bladed-style dll.

REM ----------------------------------------------------------------------------
REM set compiler internal variables
REM ----------------------------------------------------------------------------
REM You can run this bat file from the IVF compiler’s command prompt (and not
REM do anything in this section). If you choose not to run from the IVF command
REM prompt, you must call the compiler’s script to set internal variables.
REM TIP: Right click on the IVF Compiler’s Command Prompt shortcut, click
REM properties, and copy the target (without cmd.exe and/or its switches) here:

CALL “C:\Program Files\Intel\Composer XE 2011 SP1\bin\ipsxe-comp-vars.bat” ia32 vs2008

REM IF “%INTEL_SHARED%”=="" CALL “C:\Program Files\Intel\Composer XE 2011 SP1\bin\ia32\IFORTVARS.bat”

REM ----------------------------------------------------------------------------
REM -------------------- LOCAL VARIABLES ---------------------------------------
REM ----------------------------------------------------------------------------

SET ROOT_NAME=FAST

SET COMPOPTS=/threads /O2 /inline:speed /traceback /Qzero /Qsave /real_size:32 /assume:byterecl
rem SET LINKOPTS=/link /stack:64000000
SET LINKOPTS=/link

REM ----------------------------------------------------------------------------
REM ------------------------- LOCAL PATHS --------------------------------------
REM ----------------------------------------------------------------------------
REM – USERS WILL NEED TO EDIT THESE PATHS TO POINT TO FOLDERS ON THEIR LOCAL –
REM ------- NOTE: do not use quotation marks around the path names!!! ---------
REM ----------------------------------------------------------------------------
REM NWTC_Lib_Loc is the location of the NWTC subroutine library files
REM AeroDyn_Loc is the location of the AeroDyn source files
REM Wind_Loc is the location of the AeroDyn wind inflow source files
REM FAST_LOC is the location of the FAST source files
REM ----------------------------------------------------------------------------

SET NWTC_Lib_Loc=C:\Documents and Settings\Omid\Desktop\Dropbox\compiling test\NWTC_Lib_v1.04.01\Source
SET AeroDyn_Loc=C:\Documents and Settings\Omid\Desktop\Dropbox\compiling test\AD_v13.00.01a-bjj\Source
SET Wind_Loc=C:\Documents and Settings\Omid\Desktop\Dropbox\compiling test\AD_v13.00.01a-bjj\Source\InflowWind\Source
SET FAST_Loc=C:\Documents and Settings\Omid\Desktop\Dropbox\compiling test\FAST_v7.01.00a-bjj\Source

REM SET NWTC_Lib_Loc=C:\Documents and Settings\Omid\Desktop\Dropbox\compiling test\NWTC_Lib_v1.04.01\Source
REM SET AeroDyn_Loc=C:\Documents and Settings\Omid\Desktop\Dropbox\compiling test\AD_v13.00.01a-bjj\Source
REM SET Wind_Loc=C:\Documents and Settings\Omid\Desktop\Dropbox\compiling test\AD_v13.00.01a-bjj\Source\InflowWind\Source
REM SET FAST_Loc=C:\Documents and Settings\Omid\Desktop\Dropbox\compiling test\FAST_v7.01.00a-bjj\Source

REM ----------------------------------------------------------------------------
REM -------------------- LIST OF ALL SOURCE FILES ------------------------------
REM ----------------------------------------------------------------------------

SET NWTC_Files=
SET NWTC_Files=%NWTC_Files% “%NWTC_Lib_Loc%\SingPrec.f90”
SET NWTC_Files=%NWTC_Files% “%NWTC_Lib_Loc%\SysIVF.f90”
SET NWTC_Files=%NWTC_Files% “%NWTC_Lib_Loc%\NWTC_IO.f90”
SET NWTC_Files=%NWTC_Files% “%NWTC_Lib_Loc%\NWTC_Num.f90”
SET NWTC_Files=%NWTC_Files% “%NWTC_Lib_Loc%\NWTC_Aero.f90”
SET NWTC_Files=%NWTC_Files% “%NWTC_Lib_Loc%\NWTC_Library.f90”

SET Wind_Files=
SET Wind_Files=%Wind_Files% “%Wind_Loc%\SharedInflowDefs.f90”
SET Wind_Files=%Wind_Files% “%Wind_Loc%\HHWind.f90”
SET Wind_Files=%Wind_Files% “%Wind_Loc%\FFWind.f90”
SET Wind_Files=%Wind_Files% “%Wind_Loc%\HAWCWind.f90”
SET Wind_Files=%Wind_Files% “%Wind_Loc%\FDWind.f90”
SET Wind_Files=%Wind_Files% “%Wind_Loc%\CTWind.f90”
SET Wind_Files=%Wind_Files% “%Wind_Loc%\UserWind.f90”
SET Wind_Files=%Wind_Files% “%Wind_Loc%\InflowWindMod.f90”

SET AeroDyn_Files=
SET AeroDyn_Files=%AeroDyn_Files% “%AeroDyn_Loc%\SharedTypes.f90”
SET AeroDyn_Files=%AeroDyn_Files% “%AeroDyn_Loc%\AeroMods.f90”
SET AeroDyn_Files=%AeroDyn_Files% “%AeroDyn_Loc%\GenSubs.f90”
SET AeroDyn_Files=%AeroDyn_Files% “%AeroDyn_Loc%\AeroSubs.f90”
SET AeroDyn_Files=%AeroDyn_Files% “%AeroDyn_Loc%\AeroDyn.f90”

SET FAST_Files=
SET FAST_Files=%FAST_Files% “%FAST_LOC%\fftpack.f”
SET FAST_Files=%FAST_Files% “%FAST_LOC%\FFTMod.f90”
SET FAST_Files=%FAST_Files% “%FAST_LOC%\HydroCalc.f90”
SET FAST_Files=%FAST_Files% “%FAST_LOC%\FAST_Mods.f90”
SET FAST_Files=%FAST_Files% “%FAST_LOC%\Noise.f90”
SET FAST_Files=%FAST_Files% “%FAST_LOC%\FAST_IO.f90”
SET FAST_Files=%FAST_Files% “%FAST_LOC%\FAST.f90”
SET FAST_Files=%FAST_Files% “%FAST_LOC%\FAST_Lin.f90”
SET FAST_Files=%FAST_Files% “%FAST_LOC%\FAST2ADAMS.f90”

IF /I “%1”==“DLL” GOTO dllFiles

SET FAST_Files=%FAST_Files% “%FAST_LOC%\PitchCntrl_ACH.f90”
SET FAST_Files=%FAST_Files% “%FAST_LOC%\UserSubs.f90”
SET FAST_Files=%FAST_Files% “%FAST_LOC%\UserVSCont_KP.f90”

GOTO endFASTfiles

:dllFiles
SET FAST_Files=%FAST_Files% “%FAST_LOC%\BladedDLLInterface.f90”
SET FAST_Files=%FAST_Files% “%FAST_LOC%\UserSubs_forBladedDLL.f90”
SET FAST_Files=%FAST_Files% “%FAST_LOC%\UserVSCont_KP_forBladedDLL.f90”

REM NOTE: UserSubs_forBladedDLL.f90 is a copy of UserSubs.f90 with SUBROUTINES UserHSSBr() and UserYawCont() commented out
REM UserVSCont_KP_forBladedDLL.f90 is a copy of UserVSCont_KP.f90 with SUBROUTINE UserVSCont() commented out

SET ROOT_NAME=%ROOT_NAME%_DLL

:endFASTfiles
SET FAST_Files=%FAST_Files% “%FAST_LOC%\AeroCalc.f90”
SET FAST_Files=%FAST_Files% “%FAST_LOC%\SetVersion.f90”
SET FAST_Files=%FAST_Files% “%FAST_LOC%\FAST_Prog.f90”

:ivf
REM ----------------------------------------------------------------------------
REM ---------------- COMPILE WITH INTEL VISUAL FORTRAN -------------------------
REM ----------------------------------------------------------------------------

REM compile

ECHO.
ECHO Compiling FAST, AeroDyn, and NWTC_Library routines to create %ROOT_NAME%.exe:

ifort %COMPOPTS% %NWTC_Files% %Wind_Files% %AeroDyn_Files% %FAST_Files% %LINKOPTS% /out:%ROOT_NAME%.exe

:end
REM ----------------------------------------------------------------------------
REM ------------------------- CLEAR MEMORY -------------------------------------
REM ------------- and delete all .mod and .obj files ---------------------------
REM ----------------------------------------------------------------------------
ECHO a

DEL *.mod
DEL *.obj

SET ROOT_NAME=
SET COPTS=

SET NWTC_Files=
SET Wind_Files=
SET AeroDyn_Files=
SET FAST_Files=
SET A2AD_Files=
SET Fixed_Files=

SET NWTC_Lib_Loc=
SET Wind_Loc=
SET AeroDyn_Loc=
SET A2AD_Loc=
SET FAST_Loc=

SET COMPOPTS=
SET LINKOPTS=


But by running this file, I get the error that file *.obj and *.mod can not be found. Thank you so much for your help, I really appreciate it.

Dear Omid,

The error about not finding *.mod and *.obj files comes because the script is trying to delete them. They are intermediate files that are generated when ifort.exe runs. It looks like the script got to the compile step, but never produced the executable (I am assuming there was none generated?). That indicates to me that your script is not calling the compiler (ifort.exe) properly.

I have not seen the “New instance of Visual Studio 2008” error you show. You can try to remove the line that says CALL "C:\Program Files\Intel\Composer XE 2011 SP1\bin\ipsxe-comp-vars.bat" ia32 vs2008 and run the script from your compiler’s command prompt instead (look under something like Start > All Programs > Intel compiler name > 32-bit command prompt name). I’d recommend looking at the compiler’s help documents for topics like running from the command line or using ifort.exe.

Hi Bonnie,
Thanks for your response.
I changed those but I got the similar error and *.mod and *.obj is not even generated. I uninstalled my previous version of visual studio and Fortran and currently I am using Microsoft visual studio 2010 and Intel parallel studio XE 2011, I also downloaded FAST_v7.01.00a-bjj,AD_v13.00.01a-bjj,NWTC_Lib_v1.04.01 from NREL website, Are they the right program that I need for compiling?
Thank you so much
Omid

Hi Omid,

You should be able to use the programs you have mentioned. I have posted some compiling instructions here: http://forums.nrel.gov/t/instructions-for-compiling-fast/514/1. Hopefully reading them will help you solve the problem.

Thank you so much for your complete instructions, now I can compile it.