Dear @Jason.Jonkman ,
I see. I don’t know Fortran very well, so my next question might be a silly one.
As a first step towards achieving this real-time capability, I am modifying the UserSubs.f90
routine, as follows:
module UserSubs
contains
!=======================================================================
SUBROUTINE PitchCntrl ( BlPitch, ElecPwr, LSS_Spd, TwrAccel, NumBl, ZTime, DT, DirRoot, BlPitchCom )
! ! This is a dummy routine for holding the place of a user-specified
! ! blade pitch control model (either independent or rotor-collective).
! ! Modify this code to create your own model.
USE Precision
!use forpy_mod
!implicit none
IMPLICIT NONE
! ! Passed variables:
INTEGER(4), INTENT(IN ) :: NumBl ! Number of blades, (-).
REAL(ReKi), INTENT(IN ) :: BlPitch (NumBl) ! Current values of the blade pitch angles, rad.
REAL(DbKi), INTENT(IN ) :: DT ! Integration time step, sec.
REAL(ReKi), INTENT(IN ) :: ElecPwr ! Electrical power, watts.
REAL(ReKi), INTENT(IN ) :: LSS_Spd ! LSS speed (rad/s)
REAL(ReKi), INTENT(OUT) :: BlPitchCom(NumBl) ! Commanded blade pitch angles (demand pitch angles), rad.
REAL(ReKi), INTENT(IN ) :: TwrAccel ! Tower Acceleration, m/s^2.
REAL(DbKi), INTENT(IN ) :: ZTime ! Current simulation time, sec.
!
CHARACTER(1024), INTENT(IN ) :: DirRoot ! The name of the root file including the full path to the current working directory. This may be useful if you want this routine to write a permanent record of what it does to be stored with the simulation results: the results should be stored in a file whose name (including path) is generated by appending any suitable extension to DirRoot.
!
BlPitchCom(1) = 1.0
BlPitchCom(2) = 2.0
BlPitchCom(3) = 3.0
RETURN
END SUBROUTINE PitchCntrl
So basically I should see a constant command applied to the blades, respectively of one, two and three degrees.
As a next step, I proceed with re-compiling a new build (I am compiling in Linux/Ubuntu).
cmake ..
runs fine, but when I launch:
sudo make install
I get the following error:
23 | USE ServoDyn_Types
| 2
......
41 | INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1
| 1
Error: Symbol ‘outstrlenm1’ at (1) conflicts with symbol from module ‘nwtc_base’, use-associated at (2)
/home/yoda/Workspace/OpenFAST/modules/servodyn/src/ServoDyn_IO.f90:1377:115:
1377 | InputFileData%NumOuts, 'OutList', "List of user-requested output channels", ErrStat2, ErrMsg2, UnEcho )
| 1
Error: Type mismatch in argument ‘errstat’ at (1); passed CHARACTER(7) to INTEGER(4)
make[2]: *** [modules/servodyn/CMakeFiles/servodynlib.dir/build.make:140: modules/servodyn/CMakeFiles/servodynlib.dir/src/ServoDyn_IO.f90.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:944: modules/servodyn/CMakeFiles/servodynlib.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
As the “code” should not contain any errors - hopefully, since I am just assigning some values - I must doing something wrong in the procedure.
Maybe you can easily spot what is wrong?
Also, in OpenFAST/modules/servodyn/CMakeLists.txt
I have commeted out PitchCntrl.f90
as the pitch command will be provided now from the UserSubs.f90
routine.
[...]
set(SrvD_SOURCES
src/BladedInterface.f90
src/UserSubs.f90
#src/PitchCntrl_ACH.f90 commenting since we are using UserSubs.f90 (custom defined)
src/StrucCtrl.f90
src/UserVSCont_KP.f90
src/ServoDyn.f90
src/ServoDyn_IO.f90
src/StrucCtrl_Types.f90
src/ServoDyn_Types.f90
)
Many thanks for you precious help,