Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServoDyn: StC controls, and cable controls for MD and SD #664

Merged
merged 94 commits into from
Mar 2, 2022

Conversation

andrew-platt
Copy link
Collaborator

@andrew-platt andrew-platt commented Feb 22, 2021

This PR is not ready for merging. Feedback is requested from end users

Feature description

This pull request adds the following capabilities:

  • Cable control feed-through from a Bladed-style controller to the MoorDyn and SubDyn modules. This feature is needed for several projects under the ATLANTIS program.
  • Cable control feed-through from an external input (such as Simulink)
  • Aerodynamic flow control actuation control -- the ability to turn on a simple model was added, along with the ability to turn off feed-through from a Bladed-style controller
  • Control channel groups for
  • Extended avrSWAP array for future development
  • Summary file from ServoDyn that includes information about channel allocations in communication with a Bladed-style controller.

Related issue, if one exists

#646 -- status request about this project
#565 -- MoorDyn initial cable implementation
#537 -- SubDyn cable capabilities added
#395 -- Flap controls added to AD15

Impacted areas of the software

This change affects the ServoDyn module and the cable controls added to MoorDyn and SubDyn in prior pull requests.

Additional supporting information

  • StC control channel feed-through from the controller to the StC (Structural Control) sub-module of ServoDyn for independent and omnidirectional dampers is now completed (StC_DOF_MODE=1 or 2). A control channel set can be requested from each of the StC input files. The StC instance will then pass the local displacement and velocity in X, Y, and Z to the controller. The controller then can change the stiffness, damping, brake force, and external force in each of the local X, Y, and Z directions. This is then passed to each StC that requested a control channel. This is related to ServoDyn Structural control submodule (formerly TMD) #607.

Test results

Input files for ServoDyn change with this PR (additional lines). There are no specific test cases for this set of features as no publicly available models using these features.

Now that summary files are produced by ServoDyn, it might be worth rerunning the baselines and adding those files to the regression test results.

  • Update summary files from ServoDyn

Checklist of items to address

  • Bugfix for SubDyn to enable cable elements (commented out currently due to rotation issue) @ebranlard
  • Update documentation for missing terms in equations (Brake force, External Force, Force Table).
  • Update results for StC test case

@andrew-platt
Copy link
Collaborator Author

andrew-platt commented Feb 22, 2021

Example of ServoDyn summary file from a fictional architecture test:


This summary file was generated by ServoDyn on 19-Feb-2021 at 15:13:49.

 Unless specified, units are consistent with Input units, [SI] system is advised.
____________________________________________________________________________________________________
 Pitch control mode {0: none, 3: user-defined from routine PitchCntrl, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} (switch)
   PCMode -- Pitch control mode:            5
   TPCOn  -- pitch control start time:      0.000000000000E+000
   -------------------
   TPitManS  -- pitch override start time:  9.99990E+03 9.99990E+03 9.99990E+03
   BlPitchF  -- pitch override final pos:   1.57080E+00 1.57080E+00 1.57080E+00
   PitManRat -- pitch override rate:        1.39626E-01 1.39626E-01 1.39626E-01

____________________________________________________________________________________________________
 Variable-speed control mode {0: none, 1: simple VS, 3: user-defined from routine UserVSCont, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} (switch)
   VSContrl -- speed control mode:        5
   -------------------
   GenModel:       2
     GenEff  --  efficiency (%):                        9.44000E-01
     GenTiStr -- Timed generator start (s):             0.00000E+00
     GenTiStp -- Timed generator stop (s):              9.99990E+03

____________________________________________________________________________________________________
 HSS brake model {0: none, 1: simple, 3: user-defined from routine UserHSSBr, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} (switch)
    HSSBrMode -- high speed shaft brake mode  0

____________________________________________________________________________________________________
 Yaw control mode {0: none, 3: user-defined from routine UserYawCont, 4: user-defined from Simulink/Labview, 5: user-defined from Bladed-style DLL} (switch)
    YCMode  -- yaw control mode  0
    -------------------
    Yaw spring characteristics
      YawNeut --  neutral spring position (degrees)     0.00000E+00
      YawSpr  --  spring constant (N-m/rad)             9.02832E+09
      YawDamp --  damping constant (N-m/(rad/s))        1.91600E+07
    -------------------
    Prescribed yaw motion
      TYawManS  -- yaw maneuver start time (s)          9.99990E+03
      YawManRat -- yaw maneuver rate (deg/s)            5.23599E-03
      NacYawF   -- Final yaw angle for override (deg)   0.00000E+00

____________________________________________________________________________________________________
 Tip Brake  (not available)

____________________________________________________________________________________________________
 Airfoil control
    AfCMode  -- Airfoil control mode  0

____________________________________________________________________________________________________
 Cable control
    CCMode  -- cable control mode  5

____________________________________________________________________________________________________
 Structural controls

____________________________________________________________________________________________________
 Bladed Interface: in use

   Legacy Bladed DLL interface channel usage by SrvD:

                 -->   indicates from DLL to SrvD
                 -->   indicates from SrvD to DLL
      Record #         Description
      --------         -----------
           1      -->  Status flag set as follows: 0 if this is the first call, 1 for all subsequent time steps, -1 if this is the final call at the end of the simulation (-)
           2      -->  Current time (sec) [t in single precision]
           3      -->  Communication interval (sec)
           4      -->  Blade 1 pitch angle (rad) [SrvD input]
           5      -->  Below-rated pitch angle set-point (rad) [SrvD Ptch_SetPnt parameter]
           6      -->  Minimum pitch angle (rad) [SrvD Ptch_Min parameter]
           7      -->  Maximum pitch angle (rad) [SrvD Ptch_Max parameter]
           8      -->  Minimum pitch rate (most negative value allowed) (rad/s) [SrvD PtchRate_Min parameter]
           9      -->  Maximum pitch rate                               (rad/s) [SrvD PtchRate_Max parameter]
          10      -->  0 = pitch position actuator, 1 = pitch rate actuator (-) [must be 0 for ServoDyn]
          11      -->  Current demanded pitch angle (rad) [I am sending the previous value for blade 1 from the DLL, in the absence of any more information provided in Bladed documentation]
          12      -->  Current demanded pitch rate  (rad/s) [always zero for ServoDyn]
          13      -->  Demanded power (W) [SrvD GenPwr_Dem parameter from input file]
          14      -->  Measured shaft power (W) [SrvD input]
          15      -->  Measured electrical power output (W) [SrvD calculation from previous step; should technically be a state]
          16      -->  Optimal mode gain (Nm/(rad/s)^2) [if torque-speed table look-up not selected in input file, use SrvD Gain_OM parameter, otherwise use 0 (already overwritten in Init routine)]
          17      -->  Minimum generator speed (rad/s) [SrvD GenSpd_MinOM parameter]
          18      -->  Optimal mode maximum speed (rad/s) [SrvD GenSpd_MaxOMp arameter]
          19      -->  Demanded generator speed above rated (rad/s) [SrvD GenSpd_Dem parameter]
          20      -->  Measured generator speed (rad/s) [SrvD input]
          21      -->  Measured rotor speed (rad/s) [SrvD input]
          22      -->  Demanded generator torque above rated (Nm) [SrvD GenTrq_Dem parameter from input file]
          23      -->  Measured generator torque (Nm) [SrvD calculation from previous step; should technically be a state]
          24      -->  Measured yaw error (rad) [SrvD input]
          25      -->  Start of below-rated torque-speed look-up table (Lookup table not in use)
          26      -->  No. of points in torque-speed look-up table (-) [SrvD DLL_NumTrq parameter]:
          27      -->  Hub wind speed (m/s) [SrvD input]
          28      -->  Pitch control: 0 = collective, 1 = individual (-) [SrvD Ptch_Cntrl parameter]
          29      -->  Yaw control: 0 = yaw rate control, 1 = yaw torque control (-) [must be 0 for ServoDyn]
          30      -->  Blade 1 root out-of-plane bending moment (Nm) [SrvD input]
          31      -->  Blade 2 root out-of-plane bending moment (Nm) [SrvD input]
          32      -->  Blade 3 root out-of-plane bending moment (Nm) [SrvD input]
          33      -->  Blade 2 pitch angle (rad) [SrvD input]
          34      -->  Blade 3 pitch angle (rad) [SrvD input]
          35      <--  Generator contactor (-) [sent to DLL at the next call]
          36      <--  Shaft brake status (-) [sent to DLL at the next call; anything other than 0 or 1 is an error]
          37      -->  Nacelle yaw angle from North (rad)
          41      <--  demanded yaw actuator torque [this output is ignored since record 29 is set to 0 by ServoDyn indicating yaw rate control]
          45      <--  Demanded pitch angle (Collective pitch) (rad)
          47      <--  Demanded generator torque (Nm)
          48      <--  Demanded nacelle yaw rate (rad/s)
          49      -->  Maximum number of characters in the "MESSAGE" argument (-) [size of ErrMsg argument plus 1 (we add one for the C NULL CHARACTER)]
          50      -->  Number of characters in the "INFILE"  argument (-) [trimmed length of DLL_InFile parameter plus 1 (we add one for the C NULL CHARACTER)]
          51      -->  Number of characters in the "OUTNAME" argument (-) [trimmed length of RootName parameter plus 1 (we add one for the C NULL CHARACTER)]
          53      -->  Tower top fore-aft     acceleration (m/s^2) [SrvD input]
          54      -->  Tower top side-to-side acceleration (m/s^2) [SrvD input]
          55      <--  UNUSED: Pitch override [anything other than 0 is an error in ServoDyn]
          56      <--  UNUSED: Torque override [anything other than 0 is an error in ServoDyn]
          60      -->  Rotor azimuth angle (rad) [SrvD input]
          61      -->  Number of blades (-) [SrvD NumBl parameter]
          62      -->  Maximum number of values which can be returned for logging (-) [set to 300]
          63      <--  Number logging channels
          64      -->  Maximum number of characters which can be returned in "OUTNAME" (-) [set to 12601 including the C NULL CHARACTER)]
          65      <--  Number of variables returned for logging [anything greater than MaxLoggingChannels is an error]
          69      -->  Blade 1 root in-plane bending moment (Nm) [SrvD input]
          70      -->  Blade 2 root in-plane bending moment (Nm) [SrvD input]
          71      -->  Blade 3 root in-plane bending moment (Nm) [SrvD input]
          73      -->  Rotating hub My (GL co-ords) (Nm) [SrvD input]
          74      -->  Rotating hub Mz (GL co-ords) (Nm) [SrvD input]
          75      -->  Fixed    hub My (GL co-ords) (Nm) [SrvD input]
          76      -->  Fixed    hub Mz (GL co-ords) (Nm) [SrvD input]
          77      -->  Yaw bearing  My (GL co-ords) (Nm) [SrvD input]
          78      -->  Yaw bearing  Mz (GL co-ords) (Nm) [SrvD input]
          82      -->  Nacelle roll    acceleration (rad/s^2) [SrvD input] -- this is in the shaft (tilted) coordinate system, instead of the nacelle (nontilted) coordinate system
          83      -->  Nacelle nodding acceleration (rad/s^2) [SrvD input]
          84      -->  Nacelle yaw     acceleration (rad/s^2) [SrvD input] -- this is in the shaft (tilted) coordinate system, instead of the nacelle (nontilted) coordinate system
          95      -->  Reserved (SrvD customization: set to SrvD AirDens parameter)
          96      -->  Reserved (SrvD customization: set to SrvD AvgWindSpeed parameter)
         109      -->  Shaft torque (=hub Mx for clockwise rotor) (Nm) [SrvD input]
         117      -->  Controller state [always set to 0]
         120      <--  Airfoil command, blade 1
         121      <--  Airfoil command, blade 2
         122      <--  Airfoil command, blade 3
         129      -->  Maximum extent of the avrSWAP array: 3300

   Legacy Bladed DLL interface with Extended avrSWAP
          channel usage by SrvD:

                 -->   indicates from DLL to SrvD
                 -->   indicates from SrvD to DLL
      Record #         Requested by            Description
      --------         ---------------------   -----------
        1000     -->                           Version of extended avrSWAP: 1
        1001     -->                           Starting index for the non-lidar measurements channel block
        2000     -->                           Ending   index for the non-lidar measurements channel block
        2001     -->                           Starting index for the lidar measurements channel block
        2500     -->                           Ending   index for the lidar measurements channel block
        2501     <--                           Starting index for the lidar control channel block
        2600     <--                           Ending   index for the lidar control channel block
        2601     <--                           Cable control channel group 1 -- DeltaL
        2602     <--                           Cable control channel group 1 -- DeltaLdot
        2603     <--                           Cable control channel group 2 -- DeltaL
        2604     <--                           Cable control channel group 2 -- DeltaLdot
        2605     <--                           Cable control channel group 3 -- DeltaL
        2606     <--                           Cable control channel group 3 -- DeltaLdot
        2607     <--                           Cable control channel group 4 -- DeltaL
        2608     <--                           Cable control channel group 4 -- DeltaLdot
        2609     <--                           Cable control channel group 5 -- DeltaL
        2610     <--                           Cable control channel group 5 -- DeltaLdot
        2611     <--                           Cable control channel group 6 -- DeltaL
        2612     <--                           Cable control channel group 6 -- DeltaLdot
        2613     <--    MoorDyn                Cable control channel group 7 -- DeltaL
        2614     <--    MoorDyn                Cable control channel group 7 -- DeltaLdot
        2615     <--                           Cable control channel group 8 -- DeltaL
        2616     <--                           Cable control channel group 8 -- DeltaLdot
        2617     <--    MoorDyn                Cable control channel group 9 -- DeltaL
        2618     <--    MoorDyn                Cable control channel group 9 -- DeltaLdot
        2800     <--                           Ending   index for the cable control channel block
        2801     <--                           Starting index for the TMD control channel block
        3000     <--                           Ending   index for the TMD control channel block

This summary file was closed on 19-Feb-2021 at 15:13:49.

Note that in this example case, cable control channels 7 & 9 were requested from MoorDyn. Channels 1,2,3,4,5,6, & 8 were not, but the array is sized from 1:max(chanRequestNumber).

@andrew-platt
Copy link
Collaborator Author

@dzalkind, could you take a quick look at the code changes and see if this will work with what we discussed for ROSCO?

@bjonkman, could you take a quick look and see if there are any glaringly obvious issues?

@bjonkman
Copy link
Contributor

@andrew-platt , after a quick look, the only things that stood out to me are these items:

  • In the summary file, records 35 and 36 are supposed to be both in and out, so you might change the arrows to "<-->". Record 36 acts somewhat like it's only from the DLL to SrvD, but the Bladed specs say otherwise. Also, there are a couple of comments that aren't entirely true anymore (I probably missed updating them in a previous PR)... e.g., Record 35 now allows an entry of 16, too.
  • You may need to have a check that R+(2*m%dll_data%DLL_NumTrq)-1 + MaxLoggingChannels < 1000 . 1000 being the index where you appear to start the extended legacy DLL array; the left side of the equation being the size of the array without your extension. It's unlikely, but if someone did choose to enter a long torque-speed lookup table and you compiled this so that it has the potential to return logging channels from the DLL, you may overwrite parts of the avrSWAP array.

@dzalkind
Copy link
Contributor

@andrew-platt, I used this PR with ROSCO via the bladed interface and was able to read the version of the extended avrSwap and write a control input to the mooring line control. Exciting to see all the extra sensors and possibilities!

ebranlard and others added 2 commits February 24, 2021 14:55
This is manually transcribed from work by Mandar Phadnis (CU Boulder) in 2020
The reference position, reference orientation, translational displacement, and orientation at init are now passed to SrvD for all the StC instances.  It is possible to do this with less info since some orientations could be assumed at init, but for throroughness we pass all of it to ServoDyn to use in initializing the StC instances.  This in some ways future-proofs for when arbitrary initial orientations are added to the code (if ever)
Invalid unit numbers could be passed to the CLOSE intrinsic causing a segfault
…release on linux

FAST_Farm_Types would not complete compilation with:
 - ifort 2021.4.0 20210910 (from oneapi)
 - Intel Xeon X7350 chipset with 256 GB of memory
 - killed compilation after 33 hours

It isn't clear exactly what fails in the -O3 optimization -- the -qopt-report=5 option yielded a very long report, but I only spent a few hours trying to figure it out.  Need to move on to something else.
Test was reconfigured and bugs found in the StC implemantion that changed results.
@andrew-platt andrew-platt removed the request for review from ebranlard January 5, 2022 22:01
Copy link
Collaborator

@jjonkman jjonkman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I quickly reviewed the updated documentation; please find a few comments below.

Also, where are extended avrSWAP array mappings documented?

docs/source/user/api_change.rst Outdated Show resolved Hide resolved
docs/source/user/api_change.rst Outdated Show resolved Hide resolved
docs/source/user/servodyn/input.rst Outdated Show resolved Hide resolved
docs/source/user/servodyn/input.rst Outdated Show resolved Hide resolved
docs/source/user/servodyn/input.rst Outdated Show resolved Hide resolved
docs/source/user/servodyn/input.rst Outdated Show resolved Hide resolved
docs/source/user/servodyn/input.rst Outdated Show resolved Hide resolved
@andrew-platt
Copy link
Collaborator Author

Added documentation for the extended Bladed DLL interface. So finally ready to merge.

@andrew-platt andrew-platt merged commit a5d6262 into OpenFAST:dev Mar 2, 2022
@andrew-platt andrew-platt deleted the f/StrucCtrl_controls branch June 30, 2022 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Additional OpenFAST Control Inputs
7 participants