forked from xcompact3d/Incompact3d
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathacl_farm_controller.f90
45 lines (36 loc) · 1.55 KB
/
acl_farm_controller.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
!Copyright (c) 2012-2022, Xcompact3d
!This file is part of Xcompact3d (xcompact3d.com)
!SPDX-License-Identifier: BSD 3-Clause
subroutine GebraadController(Turbine,Ntur,time)
use actuator_line_model_utils
use actuator_line_turbine
use actuator_line_controller
use param, only: zero, one
use constants
implicit none
real(mytype) :: time
integer :: Ntur
type(TurbineType), dimension(Ntur), intent(inout) :: turbine
integer :: i,j,k
real(mytype) :: TotalPower, WSRotorAve
TotalPower=zero
do i=1,Ntur
TotalPower=TotalPower+Turbine(i)%Power
call compute_rotor_upstream_velocity(Turbine(i))
enddo
do i=1,Ntur
Turbine(i)%yaw_angle=zero
Turbine(i)%shaft_tilt_angle=zero
! APPLY FARM LEVEL CONTROL
! Rotate the turbine according to the tilt and yaw angle
! Yaw
call rotate_turbine(turbine(i),(/zero,one,zero/),turbine(i)%yaw_angle*conrad)
! Tilt
call rotate_turbine(turbine(i),(/zero,zero,one/),-turbine(i)%shaft_tilt_angle*conrad)
! Set the rotational axis
call QuatRot(turbine(i)%RotN(1),turbine(i)%RotN(2),turbine(i)%RotN(3),turbine(i)%yaw_angle*conrad,zero,one,zero,zero,zero,zero,&
turbine(i)%RotN(1),turbine(i)%RotN(2),turbine(i)%RotN(3))
call QuatRot(turbine(i)%RotN(1),turbine(i)%RotN(2),turbine(i)%RotN(3),-turbine(i)%shaft_tilt_angle*conrad,zero,zero,one,zero,zero,zero,&
turbine(i)%RotN(1),turbine(i)%RotN(2),turbine(i)%RotN(3))
enddo
end subroutine GebraadController