Source Documentation

dtu_we_controller

Description

Main module of the Basic DTU Wind Energy Controller. Interface for HAWC2.

Quick access

Variables:ctrlstatus, time_old, dump_array
Routines:init_regulation_advanced(), update_regulation(), init_regulation()

Needed modules

Variables

  • dtu_we_controller/dump_array (50) [real]
  • dtu_we_controller/ctrlstatus [integer]
  • dtu_we_controller/time_old [real]

Subroutines and functions

subroutine dtu_we_controller/init_regulation(array1, array2)

DEC$ IF .NOT. DEFINED(__MAKEFILE__) DEC$ ATTRIBUTES DLLEXPORT :: init_regulation DEC$ END IF

Parameters:
  • array1 (100) [real,inout]
  • array2 (1) [real,inout]
Called from:

init_regulation_advanced()

subroutine dtu_we_controller/init_regulation_advanced(array1, array2)

DEC$ IF .NOT. DEFINED(__MAKEFILE__) DEC$ ATTRIBUTES DLLEXPORT::init_regulation_advanced DEC$ END IF

Parameters:
  • array1 (100) [real,inout]
  • array2 (1) [real,inout]
Call to:

init_regulation()

subroutine dtu_we_controller/update_regulation(array1, array2)
Controller interface.
  • sets DLL inputs/outputs.
  • sets controller timers.
  • calls the safety system monitor (higher level).

DEC$ IF .NOT. DEFINED(__MAKEFILE__) DEC$ ATTRIBUTES DLLEXPORT :: update_regulation DEC$ END IF

Parameters:
  • array1 (100) [real,inout]
  • array2 (100) [real,inout]
Call to:

safety_system(), turbine_controller()

turbine_controller_mod

Description

Module containing the main subroutines for the wind turbine regulation.

Quick access

Variables:const_power, gearratio, generator_cutin, partialloadcontrolmode, stoptype, addedpitchrate, deltat, err0, errdot0, excl_flag, genspeed_at_stop, genspeedrefmax, genspeedrefmin, gentorque_at_stop, gentorquemax, gentorquerated, gentorqueref0, gentorquerefold, kopt, kopt_dot, perated, pitchcolref0, pitchcolrefold, pitchstopang, pitnonlin1, r, rel_limit, timerexcl, timergencutin, timershutdown, timershutdown2, timerstartup, tsr_opt, ttfa_pwr_lower, ttfa_pwr_upper, vcutout, vstorm, stepno, w_region, cutinvar, cutoutvar, dt_damper, dt_mode_filt, monivar, omega2ordervar, pid_gen_var, pid_pit_var, pitchfirstordervar, pitchgsvar, pwr_dt_mode_filt, switchfirstordervar, switchvar, ttfa_damper, ttfa_pwrfirstordervar, wspfirstordervar
Routines:shut_down(), start_up(), turbine_controller(), monitoring(), torquecontroller(), normal_operation(), drivetraindamper(), pitchcontroller(), rotorspeedexcl(), towerdamper()

Needed modules

  • dtu_we_controller_fcns: Module with general function that are specific of the DTU Wind Energy Controller. Types are also defined in this module.

Variables

  • turbine_controller_mod/pid_pit_var [tpid2var,save]
  • turbine_controller_mod/kopt_dot [real]
  • turbine_controller_mod/genspeedrefmin [real]
  • turbine_controller_mod/gearratio [integer]
  • turbine_controller_mod/perated [real]
  • turbine_controller_mod/ttfa_pwr_lower [real]
  • turbine_controller_mod/dt_mode_filt [tnotch2order,save]
  • turbine_controller_mod/errdot0 [real]
  • turbine_controller_mod/pitchcolrefold [real]
  • turbine_controller_mod/partialloadcontrolmode [integer]
  • turbine_controller_mod/ttfa_damper [tdamper,save]
  • turbine_controller_mod/gentorquerated [real]
  • turbine_controller_mod/deltat [real]
  • turbine_controller_mod/timerexcl [real]
  • turbine_controller_mod/timerstartup [real]
  • turbine_controller_mod/pid_gen_var [tpidvar,save]
  • turbine_controller_mod/addedpitchrate [real]
  • turbine_controller_mod/timershutdown2 [real]
  • turbine_controller_mod/stepno [integer]
  • turbine_controller_mod/switchfirstordervar [tfirstordervar,save]
  • turbine_controller_mod/gentorqueref0 [real]
  • turbine_controller_mod/pitchstopang [real]
  • turbine_controller_mod/gentorquerefold [real]
  • turbine_controller_mod/w_region [integer]
  • turbine_controller_mod/monivar [tsafetysystem,save]
  • turbine_controller_mod/genspeedrefmax [real]
  • turbine_controller_mod/wspfirstordervar [tfirstordervar,save]
  • turbine_controller_mod/excl_flag [real]
  • turbine_controller_mod/generator_cutin [logical]
  • turbine_controller_mod/const_power [logical]
  • turbine_controller_mod/timergencutin [real]
  • turbine_controller_mod/ttfa_pwrfirstordervar [tfirstordervar,save]
  • turbine_controller_mod/pitnonlin1 [real]
  • turbine_controller_mod/cutoutvar [tcutout,save]
  • turbine_controller_mod/stoptype [integer]
  • turbine_controller_mod/pitchcolref0 [real]
  • turbine_controller_mod/dt_damper [tdamper,save]
  • turbine_controller_mod/err0 [real]
  • turbine_controller_mod/kopt [real]
  • turbine_controller_mod/vcutout [real]
  • turbine_controller_mod/timershutdown [real]
  • turbine_controller_mod/pwr_dt_mode_filt [tnotch2order,save]
  • turbine_controller_mod/genspeed_at_stop [real]
  • turbine_controller_mod/switchvar [tswitch,save]
  • turbine_controller_mod/omega2ordervar [tlowpass2order,save]
  • turbine_controller_mod/gentorque_at_stop [real]
  • turbine_controller_mod/tsr_opt [real]
  • turbine_controller_mod/pitchgsvar [tpitchgsvar,save]
  • turbine_controller_mod/r [real]
  • turbine_controller_mod/cutinvar [tcutin,save]
  • turbine_controller_mod/gentorquemax [real]
  • turbine_controller_mod/rel_limit [real]
  • turbine_controller_mod/pitchfirstordervar [tfirstordervar,save]
  • turbine_controller_mod/ttfa_pwr_upper [real]
  • turbine_controller_mod/vstorm [real]

Subroutines and functions

subroutine turbine_controller_mod/turbine_controller(ctrlstatus, gridflag, genspeed, pitchvect, wsp, pe, ttaccvect, gentorqueref, pitchcolref, dump_array)
Parameters:
  • ctrlstatus [integer,inout] :: Integer indicating the status of the controller. ! (0: Normal operation, <0: Start-up., >0: Shutdown)
  • gridflag [integer,inout] :: Integer indicating the status of the grid.
  • genspeed [real,in] :: Measured generator speed [rad/s].
  • pitchvect (3) [real,in] :: Measured pitch angles [rad].
  • wsp [real,in] :: Measured wind speed [m/s].
  • pe [real,in] :: Measured electrical power [W].
  • ttaccvect (2) [real,in] :: Measured tower top acceleration. Longitudinal and ! lateral components [m/s**2].
  • gentorqueref [real,out] :: Generator torque reference [Nm].
  • pitchcolref [real,out] :: Reference collective pitch [rad].
  • dump_array (50) [real,inout] :: Array for output.
Called from:

update_regulation()

Call to:

monitoring(), normal_operation(), shut_down(), start_up()

subroutine turbine_controller_mod/normal_operation(genspeed, pitchvect, wsp, pe, ttfa_acc, gentorqueref, pitchcolref, dump_array)
Controller for normal operation.
Parameters:
  • genspeed [real,in] :: Measured generator speed [rad/s].
  • pitchvect (3) [real,in] :: Measured pitch angles [rad].
  • wsp [real,in] :: Measured wind speed [m/s].
  • pe [real,in] :: Measured electrical power [W].
  • ttfa_acc [real,in] :: Measured tower top longitudinal acceleration.
  • gentorqueref [real,out] :: Generator torque reference [Nm].
  • pitchcolref [real,out] :: Reference collective pitch [rad].
  • dump_array (50) [real,inout] :: Array for output.
Called from:

turbine_controller()

Call to:

lowpass2orderfilt(), lowpass1orderfilt(), getoptipitch(), torquecontroller(), drivetraindamper(), switch_spline(), pitchcontroller(), towerdamper()

subroutine turbine_controller_mod/start_up(ctrlstatus, genspeed, pitchvect, wsp, gentorqueref, pitchcolref, dump_array)
Start-up procedures.
Parameters:
  • ctrlstatus [integer,inout] :: Integer indicating the status of the controller. ! (0: Normal operation, <0: Start-up., >0: Shutdown)
  • genspeed [real,in] :: Measured generator speed [rad/s].
  • pitchvect (3) [real,in] :: Measured pitch angles [rad].
  • wsp [real,in] :: Measured wind speed [m/s].
  • gentorqueref [real,out] :: Generator torque reference [Nm].
  • pitchcolref [real,out] :: Reference collective pitch [rad].
  • dump_array (50) [real,inout] :: Array for output.
Called from:

turbine_controller()

Call to:

lowpass2orderfilt(), lowpass1orderfilt(), getoptipitch(), pid2(), pid()

subroutine turbine_controller_mod/shut_down(ctrlstatus, genspeed, pitchvect, wsp, gentorqueref, pitchcolref, dump_array)
Shut-down procedures.
Parameters:
  • ctrlstatus [integer,in] :: Integer indicating the status of the controller. ! (0: Normal operation, <0: Start-up., >0: Shutdown)
  • genspeed [real,in] :: Measured generator speed [rad/s].
  • pitchvect (3) [real,in] :: Measured pitch angles [rad].
  • wsp [real,in] :: Measured wind speed [m/s].
  • gentorqueref [real,out] :: Generator torque reference [Nm].
  • pitchcolref [real,out] :: Reference collective pitch [rad].
  • dump_array (50) [real,inout] :: Array for output.
Called from:

turbine_controller()

Call to:

lowpass1orderfilt(), lowpass2orderfilt()

subroutine turbine_controller_mod/monitoring(ctrlstatus, gridflag, genspeed, ttacc, dump_array)
Lower level system monitoring. It changes the controller status to: - (1) if filtered GenSpeed is higher than the overspeed limit. - (2) if GridFlag is not 0. - (3) if filtered TTAcc is higher than the safety limit. - (6) if GenSpeed is negative.
Parameters:
  • ctrlstatus [integer,inout] :: Integer indicating the status of the controller. ! (0: Normal operation, <0: Start-up., >0: Shutdown)
  • gridflag [integer,inout] :: Integer indicating the status of the grid.
  • genspeed [real,in] :: Measured generator speed [rad/s].
  • ttacc [real,in] :: Tower top acceleration [m/s**2].
  • dump_array (50) [real,inout] :: Array for output.
Called from:

turbine_controller()

Call to:

lowpass2orderfilt(), lowpass1orderfilt()

subroutine turbine_controller_mod/torquecontroller(genspeed, genspeedfilt, dgenspeed_dtfilt, pitchmean, wspfilt, pitchmin, genspeedref_full, pe, gentorqueref, dump_array)
Parameters:
  • genspeed [real,in] :: Measured generator speed [rad/s].
  • genspeedfilt [real,in] :: Filtered generator speed [rad/s].
  • dgenspeed_dtfilt [real,in] :: Filtered generator acceleration [rad/s**2].
  • pitchmean [real,in] :: Mean pitch angle [rad].
  • wspfilt [real,in] :: Filtered wind speed [m/s].
  • pitchmin [real,in] :: Minimum pitch angle [rad].
  • genspeedref_full [real,in] :: Reference generator speed [rad/s].
  • pe [real,in] :: Measured electrical power [W].
  • gentorqueref [real,out] :: Generator torque reference [Nm].
  • dump_array (50) [real,inout] :: Array for output.
Called from:

normal_operation()

Call to:

switch_spline(), lowpass1orderfilt(), rotorspeedexcl(), pid()

subroutine turbine_controller_mod/pitchcontroller(genspeedfilt, dgenspeed_dtfilt, pitchmeanfilt, pe, pitchmin, genspeedref_full, pitchcolref, dump_array)
Parameters:
  • genspeedfilt [real,in] :: Filtered generator speed [rad/s].
  • dgenspeed_dtfilt [real,in] :: Filtered generator acceleration [rad/s**2].
  • pitchmeanfilt [real,in] :: Filtered mean pitch angle [rad].
  • pe [real,in] :: Measured electrical power [W].
  • pitchmin [real,in] :: Minimum pitch angle [rad].
  • genspeedref_full [real,in] :: Reference generator speed [rad/s].
  • pitchcolref [real,out] :: Reference collective pitch angle [rad].
  • dump_array (50) [real,inout] :: Array for output.
Called from:

normal_operation()

Call to:

notch2orderfilt(), pid2()

subroutine turbine_controller_mod/rotorspeedexcl(genspeedfilt, gentorque, qg_min_partial, gentorquemax_partial, genspeedfilterr, outmax, outmin, dump_array)
Parameters:
  • genspeedfilt [real,in] :: Filtered measured generator speed [rad/s].
  • gentorque [real,in] :: Measured generator torque [Nm].
  • qg_min_partial [real,in] :: Generator torque lower limit [Nm].
  • gentorquemax_partial [real,in] :: Generator torque upper limit [Nm].
  • genspeedfilterr [real,inout] :: Filtered generator speed error [rad/s].
  • outmax [real,inout] :: Generator torque maximum value [Nm].
  • outmin [real,inout] :: Generator torque minimum value [Nm].
  • dump_array (50) [real,inout] :: Array for output.
Called from:

torquecontroller()

Call to:

notch2orderfilt(), switch_spline()

subroutine turbine_controller_mod/drivetraindamper(genspeed, qdamp_ref, dump_array)
Drivetrain damper.
Parameters:
  • genspeed [real,in] :: Measured generator speed [rad/s].
  • qdamp_ref [real,out] :: Generator torque reference component from the drivetrain ! damper [Nm].
  • dump_array (50) [real,inout] :: Array for output.
Called from:

normal_operation()

Call to:

damper()

subroutine turbine_controller_mod/towerdamper(ttfa_acc, theta_dam_ref, dump_array)
Longitudinal tower damper.
Parameters:
  • ttfa_acc [real,in] :: Measured tower top longitudinal acceleration [m/s**2].
  • theta_dam_ref [real,out] :: Reference pitch angle component from longitudinal tower ! damper [rad].
  • dump_array (50) [real,inout] :: Array for output.
Called from:

normal_operation()

Call to:

damper()

safety_system

Quick access

Variables:safetysystemvar
Routines:safety_system()

Needed modules

  • dtu_we_controller_fcns: Module with general function that are specific of the DTU Wind Energy Controller. Types are also defined in this module.

Variables

Subroutines and functions

subroutine safety_system_mod/safety_system(stepno, deltat, omega, ttaccvect, emergpitchstop, activemechbrake, dump_array)
Safety system. Higher level of system monitoring. It activates the emergency pitch stop and the mechanical brake if the rotor speed or the tower top acceleration exceed certain levels.
Parameters:
  • stepno [integer,in] :: Time step number.
  • deltat [real,in] :: Time step size.
  • omega [real,in] :: Measured rotor speed.
  • ttaccvect (2) [real,in] :: Measured tower top acceleration. Longitudinal and ! lateral components [m/s**2].
  • emergpitchstop [integer,out] :: Flag for emergency pitch stop.
  • activemechbrake [integer,out] :: Flag for emergency brake activation.
  • dump_array (50) [real,inout]
Called from:

update_regulation()

Call to:

lowpass2orderfilt(), lowpass1orderfilt()

dtu_we_controller_fcns

Description

Module with general function that are specific of the DTU Wind Energy Controller. Types are also defined in this module.

Quick access

Types:tcutin, tcutout, tdamper, texclzone, tpid2var, tpidvar, tpitchgsvar, tsafetysystem, tswitch, twpdata
Variables:maxwplines, excluzone, opdatavar
Routines:pid(), pid2(), damper(), getoptipitch(), switch_spline(), interpolate()

Needed modules

  • misc_mod: Module where filters and the corresponding types are defined.

Types

  • type dtu_we_controller_fcns/tpidvar
    Type fields:
    • % outset [real]
    • % kpro [real]
    • % outpro [real]
    • % outdif [real]
    • % outres1 [real]
    • % outres1_old [real]
    • % outmax [real]
    • % error1 [real]
    • % velmax [real]
    • % outmin [real]
    • % kdif [real]
    • % kint [real]
    • % error1_old [real]
    • % stepno1 [integer]
    • % outset1_old [real]
    • % outset1 [real]
    • % outres [real]
  • type dtu_we_controller_fcns/tpid2var
    Type fields:
    • % outset [real]
    • % kpro (2) [real]
    • % outpro [real]
    • % outdif [real]
    • % outres1 [real]
    • % outres1_old [real]
    • % outmax [real]
    • % error1 (2) [real]
    • % velmax [real]
    • % outmin [real]
    • % kdif (2) [real]
    • % kint (2) [real]
    • % error1_old (2) [real]
    • % stepno1 [integer]
    • % outset1_old [real]
    • % outset1 [real]
    • % outres [real]
  • type dtu_we_controller_fcns/twpdata
    Type fields:
    • % wpdata (maxwplines,2) [real]
    • % lines [integer]
  • type dtu_we_controller_fcns/tdamper
    Type fields:
  • type dtu_we_controller_fcns/texclzone
    Type fields:
    • % notch [tnotch2order]
    • % hwr_tg [real]
    • % lwr [real]
    • % lwr_tg [real]
    • % hwr [real]
    • % time_excl_delay [real]
  • type dtu_we_controller_fcns/tcutin
    Type fields:
    • % delay [real]
    • % time [real]
  • type dtu_we_controller_fcns/tcutout
    Type fields:
    • % torquedelay [real]
    • % pitchdelay2 [real]
    • % pitchvelmax2 [real]
    • % pitchvelmax [real]
    • % time [real]
    • % stoptype [integer]
    • % pitchdelay [real]
  • type dtu_we_controller_fcns/tswitch
    Type fields:
    • % rel_sp_open_qg [real]
    • % pitang_upper [real]
    • % pitang_lower [real]
  • type dtu_we_controller_fcns/tsafetysystem
    Type fields:
  • type dtu_we_controller_fcns/tpitchgsvar
    Type fields:
    • % invkk2_speed [real]
    • % invkk1_speed [real]
    • % invkk2 [real]
    • % invkk1 [real]
    • % kp_speed [real]

Variables

  • dtu_we_controller_fcns/maxwplines [integer,parameter=100]
  • dtu_we_controller_fcns/excluzone [texclzone,save]
  • dtu_we_controller_fcns/opdatavar [twpdata,save]

Subroutines and functions

function dtu_we_controller_fcns/switch_spline(x, x0, x1)

A function that goes from 0 at x0 to 1 at x1

Parameters:
  • x [real]
  • x0 [real]
  • x1 [real]
Return:

switch_spline [real]

Called from:

torquecontroller(), rotorspeedexcl(), normal_operation()

function dtu_we_controller_fcns/interpolate(x, x0, x1, f0, f1)

Linear interpolation of x through the points (x0, f0) and (x1, f1)

Parameters:
  • x [real]
  • x0 [real]
  • x1 [real]
  • f0 [real]
  • f1 [real]
Return:

interpolate [real]

Called from:

getoptipitch()

function dtu_we_controller_fcns/getoptipitch(wsp)

Computes pitch angle from look-up table based on wind speed input

Parameters:wsp [real]
Return:getoptipitch [real]
Called from:start_up(), normal_operation()
Call to:interpolate()
function dtu_we_controller_fcns/pid(stepno, dt, kgain, pidvar, error)

PID controller with one input.

Parameters:
  • stepno [integer]
  • dt [real]
  • kgain (3) [real]
  • pidvar [tpidvar]
  • error [real]
Return:

pid [real]

Called from:

torquecontroller(), start_up()

function dtu_we_controller_fcns/pid2(stepno, dt, kgain, pidvar, error, added_term)

PID controller with two inputs. Used for the pitch angle with feebacks from generator speed and power errors.

Parameters:
  • stepno [integer]
  • dt [real]
  • kgain (3,2) [real]
  • pidvar [tpid2var]
  • error (2) [real]
  • added_term [real]
Return:

pid2 [real]

Called from:

start_up(), pitchcontroller()

subroutine dtu_we_controller_fcns/damper(stepno, dt, x, filters, y, x_filt)

General damper based on bandpass filter, notch filter, and a time delay.

Parameters:
  • stepno [integer]
  • dt [real]
  • x [real,in]
  • filters [tdamper,in]
  • y [real,out]
  • x_filt [real,out]
Called from:

drivetraindamper(), towerdamper()

Call to:

bandpassfilt(), notch2orderfilt(), timedelay()

misc_mod

Description

Module where filters and the corresponding types are defined.

Quick access

Types:tbandpassfilt, tfirstordervar, tlowpass2order, tnotch2order, ttdelay
Variables:degrad, pi, raddeg, mk, vertext32
Routines:timedelay(), bandpassfilt(), lowpass2orderfilt(), notch2orderfilt(), lowpass1orderfilt()

Types

  • type misc_mod/tfirstordervar
    Type fields:
    • % tau [real]
    • % stepno1 [integer]
    • % y1 [real]
    • % y1_old [real]
    • % x1 [real]
    • % x1_old [real]
  • type misc_mod/tlowpass2order
    Type fields:
    • % f0 [real]
    • % x1 [real]
    • % x2_old [real]
    • % y2_old [real]
    • % x1_old [real]
    • % x2 [real]
    • % stepno1 [integer]
    • % y1 [real]
    • % zeta [real]
    • % y2 [real]
    • % y1_old [real]
  • type misc_mod/tnotch2order
    Type fields:
    • % f0 [real]
    • % x1 [real]
    • % x2_old [real]
    • % zeta2 [real]
    • % zeta1 [real]
    • % y2_old [real]
    • % x2 [real]
    • % stepno1 [integer]
    • % y1 [real]
    • % x1_old [real]
    • % y2 [real]
    • % y1_old [real]
  • type misc_mod/tbandpassfilt
    Type fields:
    • % f0 [real]
    • % tau [real]
    • % x1 [real]
    • % x2_old [real]
    • % y2_old [real]
    • % x1_old [real]
    • % x2 [real]
    • % stepno1 [integer]
    • % y1 [real]
    • % zeta [real]
    • % y2 [real]
    • % y1_old [real]
  • type misc_mod/ttdelay
    Type fields:
    • % xz (40) [real]
    • % stepno1 [integer]

Variables

  • misc_mod/raddeg [real]
  • misc_mod/pi [real]
  • misc_mod/vertext32 [character]
  • misc_mod/mk [integer,parameter=kind(1.0d0)]
  • misc_mod/degrad [real]

Subroutines and functions

function misc_mod/lowpass1orderfilt(dt, stepno, filt, x)

First order low-pass filter.

Parameters:
Return:

lowpass1orderfilt [real]

Called from:

torquecontroller(), monitoring(), shut_down(), safety_system(), start_up(), normal_operation()

function misc_mod/lowpass2orderfilt(dt, stepno, filt, x)

Second order low-pass filter.

Parameters:
Return:

lowpass2orderfilt (2) [real]

Called from:

lowpass2orderfilt(), monitoring(), shut_down(), safety_system(), start_up(), normal_operation()

Call to:

lowpass2orderfilt()

function misc_mod/notch2orderfilt(dt, stepno, filt, x)

Second order notch filter.

Parameters:
Return:

notch2orderfilt [real]

Called from:

rotorspeedexcl(), pitchcontroller(), damper()

function misc_mod/bandpassfilt(dt, stepno, filt, x)

Second order band-pass filter.

Parameters:
Return:

bandpassfilt [real]

Called from:

damper()

function misc_mod/timedelay(dt, stepno, filt, td, x)

Time delay.

Parameters:
  • dt [real]
  • stepno [integer]
  • filt [ttdelay]
  • td [real]
  • x [real]
Return:

timedelay [real]

Called from:

damper()