Comments (6)
I created a workaround/solution for this problem. Replace the CalculateStandardYaw subroutine in the .\Source\dependencies\ServoDyn\ ServoDyn.f90-file, and recompile FAST.
SUBROUTINE CalculateStandardYaw(t, u, p, m, YawPosCom, YawRateCom, ErrStat, ErrMsg)
REAL(DbKi), INTENT(IN ) :: t !< Current simulation time in seconds
TYPE(SrvD_InputType), INTENT(IN ) :: u !< Inputs at t
TYPE(SrvD_ParameterType), INTENT(IN ) :: p !< Parameters
TYPE(SrvD_MiscVarType), INTENT(INOUT) :: m !< Misc (optimization) variables
REAL(ReKi), INTENT( OUT) :: YawPosCom !< Commanded yaw angle from user-defined routines, rad.
REAL(ReKi), INTENT( OUT) :: YawRateCom !< Commanded yaw rate from user-defined routines, rad/s.
INTEGER(IntKi), INTENT( OUT) :: ErrStat !< Error status of the operation
CHARACTER(*), INTENT( OUT) :: ErrMsg !< Error message if ErrStat /= ErrID_None
REAL(4), SAVE :: YawPosComInt !< Internal variable that integrates the commanded yaw rate and passes it to YawPosCom
ErrStat = ErrID_None
ErrMsg = ""
!...................................................................
! Calculate standard yaw position and rate commands:
!...................................................................
IF ( t >= p%TYCOn .AND. p%YCMode /= ControlMode_NONE ) THEN ! Time now to enable active yaw control.
SELECT CASE ( p%YCMode ) ! Which yaw control mode are we using? (we already took care of ControlMode_None)
CASE ( ControlMode_SIMPLE ) ! Simple ... BJJ: THIS will be NEW
CASE ( ControlMode_USER ) ! User-defined from routine UserYawCont().
CALL UserYawCont ( u%Yaw, u%YawRate, u%WindDir, u%YawErr, p%NumBl, t, p%DT, p%RootName, YawPosCom, YawRateCom )
CASE ( ControlMode_EXTERN ) ! User-defined from Simulink or LabVIEW
YawPosCom = u%ExternalYawPosCom
YawRateCom = u%ExternalYawRateCom
CASE ( ControlMode_DLL ) ! User-defined yaw control from Bladed-style DLL
YawPosComInt = YawPosComInt + m%dll_data%YawRateCom*p%DT
YawPosCom = YawPosComInt !bjj: was this: LastYawPosCom + YawRateCom*( ZTime - LastTime )
YawRateCom = m%dll_data%YawRateCom
END SELECT
ELSE ! Do not control yaw, maintain initial (neutral) yaw angles
YawPosCom = p%YawNeut
YawRateCom = 0.0_ReKi
ENDIF
END SUBROUTINE CalculateStandardYaw
Regards,
Sebastiaan Mulders
PhD candidate - Delft University of Technology
from openfast.
Dear Sabastiaan,
Thanks for updated code. However, I see three problems that will need to be fixed for the general solution:
- According to the NWTC Programmer's Handbook (https://nwtc.nrel.gov/system/files/ProgrammingHandbook_Mod20130717.pdf), you should not use the SAVE attribute for variables within a FAST module. Instead, YawPosComInt must become a state of the ServoDyn module (included in the FAST Registry, passed as a subroutine argument, etc.)
- YawPosComInt needs to be initialized at simulation initialization i.e. within SrvD_Init. I would guess a good initial value would be the initial yaw angle or YawNeut.
- Routine CalculateStandardYaw is called both within routines SrvD_UpdateStates and SrvD_CalcOutput. Because YawPosComInt must become a state of ServoDyn, its value can only be set within Srv_UpdateStates.
I hope that helps.
Best regards,
from openfast.
Dear Jason,
Thank you very much for your suggestions. I will implement these changes later, and create a pull request accordingly.
Best regards,
Sebastiaan Mulders
from openfast.
@sebastiaanmuld,
Thank you for your efforts in isolating and finding a solution for the ServoDyn bug.
A couple of weeks ago we launched a new workflow for OpenFAST contribution which aims to support a larger magnitude of community driven development than we have in the past. To that end, we have established a basic regression test and unit test system to maintain confidence and stability in OpenFAST. Being the first to propose a bug fix since our latest release, you are in a lucky position to try it all out!
The procedure for bug fixes is as follows:
- File a bug report in GitHub issues (DONE: issue #25)
- Develop a unit test which isolates the bug and document the failure
- Implement the bug fix on a
bugfix/issue##
branch on your fork of OpenFAST - Document the unit test which no longer fails
- Document the full regression test suite passing or note any failing cases
- Issue a pull request referencing the GitHub issue and including the test documentation
For reference, the test specific documentation is at http://openfast.readthedocs.io/en/latest/source/testing/index.html, and the git usage is described at
http://openfast.readthedocs.io/en/latest/source/dev/github_workflow.html.
I understand that this is a heavy lift for a simple bug fix, especially since some of the infrastructure for unit testing does not yet exist for ServoDyn. I am happy to support by working with you to establish the ServoDyn testing infrastructure which you can then build on to implement the unit test and bug fix more easily.
Please let me know if you'd like to talk about this in more detail or work together to develop a plan for implementing the bug fix.
Thanks again for your contribution to OpenFAST.
Rafael M Mudafort
from openfast.
Dear Rafael,
Thanks you very much for your e-mail! I would like to work with you on solving this bug. I think it is best for me to first get more familiar with the NWTC Programmer’s Handbook as Jason suggested. I will contact you in 1-2 weeks once I have done this, and then we can work out a plan for implementing the bugfix and setting up the ServoDyn testing infrastructure.
Best regards,
Sebastiaan Mulders
from openfast.
Closed with PR #456
from openfast.
Related Issues (20)
- erros about inflowWind HOT 1
- A question about the "FAST.Farm Response to VaryingWind Inflow Techniques" paper HOT 3
- When I use a new model, something goes wrong. HOT 1
- Pitch Control-Mechanical Loads HOT 2
- openfast(the tower shadow effect) HOT 6
- Doubts about wind turbines in TEST 11-14 HOT 2
- Airfoil Data HOT 5
- A question about generating modal shapes using linearization HOT 4
- DRTRDOF HOT 1
- Problems encountered in the process of stepedwind HOT 6
- Damping ratios for U-Maine VolturnUS-S FOWT HOT 1
- looking for source code for FAST V7 HOT 1
- About buoy in mooring line HOT 2
- Error when compile openfast v3.5.1 in double precision HOT 2
- Pitch Control Simulink HOT 3
- About the output of FAST.Farm HOT 1
- ROSCO Controller Question HOT 6
- SubDyn: Floating system issues HOT 7
- Simulate wind turbine shutdown status HOT 5
- Some problems about python-toolbox HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openfast.