Modifying DISCON.dll

Dear,

I am using the 5MW NREL turbine with the control routine provided in DISCON.dll. Currently, I am trying to simulate sensor and actuator faults on the Blade-Pitch Controller and Generator-Torque Controller loops. For this, I need to do some modifications to the DISCON.f90 code and I will need to access the internal variables of the controllers for implementing fault detection algorithms (I would need some variables included in an output file after the simulation with OpenFast).

I have to say I am not familiar with Fortran. However, from the code I see that there is a ‘debugging’ option that is enabled with the flag ‘PC_DbgOut’. This option seems to print or modify a file by printing a header and some variables values:

[code]! If we’re debugging the pitch controller, open the debug file and write the
! header:

IF ( PC_DbgOut ) THEN

  OPEN ( UnDb, FILE=TRIM( RootName )//'.dbg', STATUS='REPLACE' )

  WRITE (UnDb,'(/////)')
  WRITE (UnDb,'(A)')  'Time '//Tab//'ElapTime'//Tab//'HorWindV'//Tab//'GenSpeed'//Tab//'GenSpeedF'//Tab//'RelSpdErr'//Tab// &
                      'SpdErr '//Tab//'IntSpdErr'//Tab//'GK '//Tab//'PitComP'//Tab//'PitComI'//Tab//'PitComT'//Tab//        &
                      'PitRate1'//Tab//'PitRate2'//Tab//'PitRate3'//Tab//'PitCom1'//Tab//'PitCom2'//Tab//'PitCom3'//Tab// &
                      'BlPitch1'//Tab//'BlPitch2'//Tab//'BlPitch3' 
  WRITE (UnDb,'(A)')  '(sec)'//Tab//'(sec)   '//Tab//'(m/sec) '//Tab//'(rpm)   '//Tab//'(rpm)    '//Tab//'(%)      '//Tab// &
                      '(rad/s)'//Tab//'(rad)    '//Tab//'(-)'//Tab//'(deg)  '//Tab//'(deg)  '//Tab//'(deg)  '//Tab//        &
                      '(deg/s) '//Tab//'(deg/s) '//Tab//'(deg/s) '//Tab//'(deg)  '//Tab//'(deg)  '//Tab//'(deg)  '//Tab// &
                      '(deg)   '//Tab//'(deg)   '//Tab//'(deg)   ' 

  
  OPEN ( UnDb2, FILE=TRIM( RootName )//'.dbg2', STATUS='REPLACE' )
  WRITE (UnDb2,'(/////)')
  
  WRITE (UnDb2,'(A,85("'//Tab//'AvrSWAP(",I2,")"))')  'Time ', (i,i=1,85) 
  WRITE (UnDb2,'(A,85("'//Tab//'(-)"))')  '(s)'

ENDIF[/code]

[code]! Output debugging information if requested:

  IF ( PC_DbgOut )  THEN
                    WRITE (UnDb,FmtDat)  Time, ElapTime, HorWindV, GenSpeed*RPS2RPM, GenSpeedF*RPS2RPM,           &
                                         100.0*SpdErr/PC_RefSpd, SpdErr, IntSpdErr, GK, PitComP*R2D, PitComI*R2D, &
                                         PitComT*R2D, PitRate*R2D, PitCom*R2D, BlPitch*R2D 
                                            
  END IF

ENDIF [/code]

I think I can make use of this debugging option in order to have access to the internal variables of the controllers. I tried to compile DISCON.f90 with 'PC_DbgOut = .TRUE. '. However, once I use the compiled DISCON.dll, I don’t see any new file once the simulation with OpenFast is over.

I guess I need to do something in addition for using the debugging option? like maybe create a file ‘.dbg’ with a name coinciding with ‘RootName’ in a given folder or something? (I don’t know what ‘RootName’ should be equal to, as I mentioned I am not familiar with Fortran).

Could you please help by pointing out how to enable correctly the debugging option?

Best regards,

Sandra Vasquez
PhD student

Dear Sandra,

All you should need to do is recompile the DISCON.dll after changing PC_DbgOut from .FALSE. to .TRUE. in DISCON.f90. Then running OpenFAST should generate two new files, one named RootName.dbg containing the internal data and one named RootName.dbg2 containing the data in the avrSWAP array, where “RootName” is the name of your OpenFAST primary input file minus the “.fst” extension and with “.SrvD” added, including full path.

If you have done this and you are not seeing these files, are you sure you are calling the correct DLL, which is specified via input parameter DLL_FileName in the ServoDyn input file?

Best regards,

Dear Jason,

Thank you very much for your reply. I was compiling wrongly the DISCON.dll. Now the files RootName.dbg and RootName.dbg2 are being generated.

Best regards,

Sandra Vásquez

Dear Jason,

I have been working on this control to. My main objetive is do a pitch control depending of the positition of the blade.

The code Discon.dll mention in differents part to see Appendix A of Bladed User’s Guide, I have tried to find it but do not achieved it. Where can I find it? Could you send it to me?

My main problem at the moment is that I do not have any local variables relation with the position of the blade to use in the fortran file. What I think, is that the Appendix A of Bladed User’s Guide relation the variables AvrSWAP(i) with their real meaning. Thats the reason why I would like to read it.

My second questions is about the files in ServoData, whats the differents between DISCON and DISCON_OC3? I am working with the SemiOC4.

Best regards,

Raul Palacios

Dear Raul,

The Bladed User’s Guide is a product of DNV, and so, is a document that you must obtain from them, not NREL.

That said, you can clearly see how the various elements of the avrSWAP() array are set–including inputs to the controller from FAST/OpenFAST and outputs from the controller to FAST/OpenFAST–by reviewing the FAST/OpenFAST source file BladedInterface.f90, especially SUBROUTINEs Fill_avrSWAP() and Retrieve_avrSWAP().

The baseline controllers for the various NREL 5-MW wind turbine models are all variations of the same baseline controller. DISCON is the original version documented in the NREL 5-MW specifications report: nrel.gov/docs/fy08osti/42589.pdf.

Best regards,

Dear Jason,

Recently, I worked on the yaw control of wind turbine, but I haven’t found any part about the control of yaw in the DISCON.f90. So I want to know the wind turbine how to align the direction of wind in the openfast?

Best regards,
Jiaping.Cui

Dear Jiaping.Cui,

Which DISCON.f90 file are you referring to? Certainly the nacelle-yaw can be defined within the DISCON controller interface, e.g., avrSWAP(48) outputs the demanded nacelle-yaw rate. However, not all DISCON.f90 examples have yaw control logic implemented, e.g., the baseline DISCON controllers for the NREL 5-MW baseline wind turbine. NREL’s ROSCO controller implemented in DISCON format does support active control of nacelle yaw: github.com/NREL/ROSCO.

Best regards,