util Namespace Reference

Kynema API: kynema::util Namespace Reference
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
kynema::util Namespace Reference

Classes

class  AeroDynInflowLibrary
 Wrapper class for the AeroDynInflow (ADI) shared library. More...
 
struct  ControllerIO
 
class  dylib
 
struct  EnvironmentalConditions
 Struct to hold the environmental conditions. More...
 
struct  ErrorHandling
 Struct for error handling settings. More...
 
struct  FluidProperties
 Struct to hold the properties of the working fluid (air) More...
 
struct  InternalState
 
struct  MeshData
 Struct to hold the motion + loads data of any structural mesh component in AeroDyn/InflowWind compatible format. More...
 
class  NetCDFFile
 Class for managing NetCDF files for writing outputs. More...
 
class  NodeStateWriter
 Class for writing Kynema nodal state data to NetCDF-based output files. More...
 
struct  SimulationControls
 Struct to hold the settings for simulation controls. More...
 
class  TimeSeriesWriter
 Class for writing time-series data to NetCDF file. More...
 
struct  TurbineConfig
 Configuration for the initial state of a turbine. More...
 
class  TurbineController
 
struct  TurbineData
 Struct to hold and manage turbine-specific data. More...
 
struct  VTKSettings
 Struct to hold the settings for VTK output. More...
 

Functions

void SetPositionAndOrientation (std::span< const double, 7 > data, std::span< float, 3 > position, std::array< std::array< double, 3 >, 3 > &orientation)
 Converts a 7-element array of position and quaternion to separate position and orientation arrays.
 
int SetupFirstCall (const ControllerIO &swap, InternalState &state, char *const avcMSG)
 
void FilterGeneratorSpeed (const ControllerIO &swap, InternalState &state)
 
void VariableSpeedTorqueControl (ControllerIO &swap, InternalState &state)
 
void PitchControl (ControllerIO &swap, InternalState &state)
 
int ComputeControl (ControllerIO &swap, InternalState &state, char *const avcMSG)
 
void PackInternalStateToFile (const InternalState &state, const char *const accINFILE)
 
void UnpackInternalStateFromFile (const char *const accINFILE, InternalState &state)
 
void DISCON (float avrSWAP[], int *aviFAIL, const char *accINFILE, char *avcOUTNAME, char *avcMSG)
 This Bladed-style DLL controller is used to implement a variable-speed generator-torque controller and PI collective blade pitch controller for the NREL Offshore 5MW baseline wind turbine. This routine was originally written in Fortran by J. Jonkman of NREL/NWTC for use in the IEA Annex XXIII OC3 studies.
 
void PITCH_CONTROLLER (float avrSWAP[], int *aviFAIL, const char *const, char *const, char *const avcMSG)
 
template<>
int NetCDFFile::AddVariable< std::string > (const std::string &name, std::span< const int > dim_ids) const
 

Variables

static constexpr int kSwapArraySize = 128
 
static constexpr double kVS_CtInSp {70.16224}
 Transitional generator speed (HSS side) between regions 1 and 1 1/2, rad/s.
 
static constexpr double kVS_DT {0.000125}
 Communication interval for torque controller, sec.
 
static constexpr double kVS_MaxRat {15000.}
 Maximum torque rate (in absolute value) in torque controller, N-m/s.
 
static constexpr double kVS_MaxTq {47402.91}
 Maximum generator torque in Region 3 (HSS side), N-m.
 
static constexpr double kVS_Rgn2K {2.332287}
 Generator torque constant in Region 2 (HSS side), N-m/(rad/s)^2.
 
static constexpr double kVS_Rgn2Sp {91.21091}
 Transitional generator speed (HSS side) between regions 1 1/2 and 2, rad/s.
 
static constexpr double kVS_Rgn3MP {0.01745329}
 
static constexpr double kVS_RtGnSp {121.6805}
 Rated generator speed (HSS side), rad/s.
 
static constexpr double kVS_RtPwr {5296610.0}
 Rated generator generator power in Region 3, Watts.
 
static constexpr double kCornerFreq {1.570796}
 
static constexpr double kOnePlusEps {1.0 + 1.19e-07}
 A value slightly greater than unity in single precision.
 
static constexpr double kPC_DT {0.000125}
 Communication interval for the pitch controller, sec.
 
static constexpr double kPC_KI {0.008068634}
 Integral gain for pitch controller at rated pitch (zero), (-)
 
static constexpr double kPC_KK {0.1099965}
 
static constexpr double kPC_KP {0.01882681}
 Proportional gain for pitch controller at rated pitch (zero), sec.
 
static constexpr double kPC_MaxPit {1.570796}
 Maximum pitch setting in pitch controller, rad.
 
static constexpr double kPC_MaxRat {0.1396263}
 Maximum pitch rate (in absolute value) in pitch controller, rad/s.
 
static constexpr double kPC_MinPit {0.0}
 Minimum pitch setting in pitch controller, rad.
 
static constexpr double kPC_RefSpd {122.9096}
 Desired (reference) HSS speed for pitch controller, rad/s.
 
static constexpr double kVS_SlPc {10.0}
 Factor to convert radians to degrees.
 

Function Documentation

◆ ComputeControl()

int kynema::util::ComputeControl ( ControllerIO swap,
InternalState state,
char *const  avcMSG 
)
inline

◆ DISCON()

void kynema::util::DISCON ( float  avrSWAP[],
int *  aviFAIL,
const char *  accINFILE,
char *  avcOUTNAME,
char *  avcMSG 
)

This Bladed-style DLL controller is used to implement a variable-speed generator-torque controller and PI collective blade pitch controller for the NREL Offshore 5MW baseline wind turbine. This routine was originally written in Fortran by J. Jonkman of NREL/NWTC for use in the IEA Annex XXIII OC3 studies.

Parameters
avrSWAPThe swap array, used to pass data to, and receive data from, the DLL controller.
aviFAILFlag used to indicate the success of this DLL call set as follows: 0 if the DLL call was successful, > 0 if the DLL call was successful but cMessage should be issued as a warning messsage, < 0 if the DLL call was unsuccessful or for any other reason the simulation is to be stopped at this point with cMessage as the error message
accINFILEThe name of the parameter input file, 'DISCON.IN'
avcOUTNAMEOUTNAME (Simulation RootName)
avcMSGMESSAGE (Message from DLL to simulation code [ErrMsg]) The message which will be displayed by the calling program if aviFAIL <> 0

◆ FilterGeneratorSpeed()

void kynema::util::FilterGeneratorSpeed ( const ControllerIO swap,
InternalState state 
)
inline

◆ NetCDFFile::AddVariable< std::string >()

template<>
int kynema::util::NetCDFFile::AddVariable< std::string > ( const std::string &  name,
std::span< const int >  dim_ids 
) const

◆ PackInternalStateToFile()

void kynema::util::PackInternalStateToFile ( const InternalState state,
const char *const  accINFILE 
)
inline

◆ PITCH_CONTROLLER()

void kynema::util::PITCH_CONTROLLER ( float  avrSWAP[],
int *  aviFAIL,
const char *  accINFILE,
char *  avcOUTNAME,
char *  avcMSG 
)

Implement a test controller that returns pitch angle in radians (ranges from -90 to 90 starting at zero) - used for testing purposes

◆ PitchControl()

void kynema::util::PitchControl ( ControllerIO swap,
InternalState state 
)
inline

◆ SetPositionAndOrientation()

void kynema::util::SetPositionAndOrientation ( std::span< const double, 7 >  data,
std::span< float, 3 >  position,
std::array< std::array< double, 3 >, 3 > &  orientation 
)
inline

Converts a 7-element array of position and quaternion to separate position and orientation arrays.

Parameters
dataInput array: [x, y, z, qw, qx, qy, qz]
positionOutput array for position [x, y, z]
orientationOutput array for flattened 3x3 rotation matrix

◆ SetupFirstCall()

int kynema::util::SetupFirstCall ( const ControllerIO swap,
InternalState state,
char *const  avcMSG 
)
inline

◆ UnpackInternalStateFromFile()

void kynema::util::UnpackInternalStateFromFile ( const char *const  accINFILE,
InternalState state 
)
inline

◆ VariableSpeedTorqueControl()

void kynema::util::VariableSpeedTorqueControl ( ControllerIO swap,
InternalState state 
)
inline

Variable Documentation

◆ kCornerFreq

constexpr double kynema::util::kCornerFreq {1.570796}
staticconstexpr

Corner frequency (-3dB point) in the recursive, single-pole, low-pass filter, rad/s – chosen to be 1/4 the blade edgewise natural frequency ( 1/4 of approx. 1 Hz = 0.25 Hz = 1.570796 rad/s)

◆ kOnePlusEps

constexpr double kynema::util::kOnePlusEps {1.0 + 1.19e-07}
staticconstexpr

A value slightly greater than unity in single precision.

◆ kPC_DT

constexpr double kynema::util::kPC_DT {0.000125}
staticconstexpr

Communication interval for the pitch controller, sec.

◆ kPC_KI

constexpr double kynema::util::kPC_KI {0.008068634}
staticconstexpr

Integral gain for pitch controller at rated pitch (zero), (-)

◆ kPC_KK

constexpr double kynema::util::kPC_KK {0.1099965}
staticconstexpr

Pitch angle where the the derivative of the aerodynamic power w.r.t. pitch has increased by a factor of two relative to the derivative at rated pitch (zero), rad

◆ kPC_KP

constexpr double kynema::util::kPC_KP {0.01882681}
staticconstexpr

Proportional gain for pitch controller at rated pitch (zero), sec.

◆ kPC_MaxPit

constexpr double kynema::util::kPC_MaxPit {1.570796}
staticconstexpr

Maximum pitch setting in pitch controller, rad.

◆ kPC_MaxRat

constexpr double kynema::util::kPC_MaxRat {0.1396263}
staticconstexpr

Maximum pitch rate (in absolute value) in pitch controller, rad/s.

◆ kPC_MinPit

constexpr double kynema::util::kPC_MinPit {0.0}
staticconstexpr

Minimum pitch setting in pitch controller, rad.

◆ kPC_RefSpd

constexpr double kynema::util::kPC_RefSpd {122.9096}
staticconstexpr

Desired (reference) HSS speed for pitch controller, rad/s.

◆ kSwapArraySize

constexpr int kynema::util::kSwapArraySize = 128
staticconstexpr

◆ kVS_CtInSp

constexpr double kynema::util::kVS_CtInSp {70.16224}
staticconstexpr

Transitional generator speed (HSS side) between regions 1 and 1 1/2, rad/s.

◆ kVS_DT

constexpr double kynema::util::kVS_DT {0.000125}
staticconstexpr

Communication interval for torque controller, sec.

◆ kVS_MaxRat

constexpr double kynema::util::kVS_MaxRat {15000.}
staticconstexpr

Maximum torque rate (in absolute value) in torque controller, N-m/s.

◆ kVS_MaxTq

constexpr double kynema::util::kVS_MaxTq {47402.91}
staticconstexpr

Maximum generator torque in Region 3 (HSS side), N-m.

◆ kVS_Rgn2K

constexpr double kynema::util::kVS_Rgn2K {2.332287}
staticconstexpr

Generator torque constant in Region 2 (HSS side), N-m/(rad/s)^2.

◆ kVS_Rgn2Sp

constexpr double kynema::util::kVS_Rgn2Sp {91.21091}
staticconstexpr

Transitional generator speed (HSS side) between regions 1 1/2 and 2, rad/s.

◆ kVS_Rgn3MP

constexpr double kynema::util::kVS_Rgn3MP {0.01745329}
staticconstexpr

Minimum pitch angle at which the torque is computed as if we are in region 3 regardless of the generator speed, rad

◆ kVS_RtGnSp

constexpr double kynema::util::kVS_RtGnSp {121.6805}
staticconstexpr

Rated generator speed (HSS side), rad/s.

◆ kVS_RtPwr

constexpr double kynema::util::kVS_RtPwr {5296610.0}
staticconstexpr

Rated generator generator power in Region 3, Watts.

◆ kVS_SlPc

constexpr double kynema::util::kVS_SlPc {10.0}
staticconstexpr

Factor to convert radians to degrees.

Factor to convert radians per second to revolutions per minute Rated generator slip percentage in Region 2 1/2, %