MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
NREL_AeroDyn.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef long int F_LOGICAL
 
typedef char F_CHAR
 
typedef long int F_INTEGER
 

Functions

int __FC_DECL__() ad_inputgate (F_CHAR *input_file)
 
int __FC_DECL__() adinputgate (void)
 
int __FC_DECL__() elemout (void)
 
int __FC_DECL__() aerofrcintrface (F_LOGICAL *FirstLoop, F_INTEGER *JElem, F_REAL *DFN, F_REAL *DFT, F_REAL *PMA)
 
int __FC_DECL__() getrotorparams (F_REAL *Omega, F_REAL *gamma, F_REAL *VHUB, F_REAL *tau)
 
int __FC_DECL__() getbladeparams (F_REAL *psi)
 
int __FC_DECL__() getelemparams (F_INTEGER *MulTabLoc, F_REAL *phi, F_REAL *radius, F_REAL *XGRND, F_REAL *YGRND, F_REAL *ZGRND)
 
int __FC_DECL__() getvnvt (F_REAL *VX, F_REAL *VY, F_REAL *VZ, F_REAL *VT, F_REAL *VNW, F_REAL *VNE)
 
int __FC_DECL__() usrmes (F_LOGICAL *Logical, F_CHAR msg[], F_INTEGER *code, F_CHAR level[])
 
int __FC_DECL__() ad_abort (void)
 
int __FC_DECL__() mbdyn_init (F_CHAR *Version, F_INTEGER *nblades, F_REAL *rotradius)
 
int __FC_DECL__() mbdyn_ad_inputgate (F_CHAR *ifname, F_INTEGER *ifnamelen, F_CHAR *efname, F_INTEGER *efnamelen)
 
int __FC_DECL__() mbdyn_true (F_LOGICAL *val)
 
int __FC_DECL__() mbdyn_false (F_LOGICAL *val)
 
int __FC_DECL__() mbdyn_com_data (F_INTEGER *c_blade, F_INTEGER *c_elem)
 
int __FC_DECL__() mbdyn_sim_time (doublereal *c_time)
 
int __FC_DECL__() mbdyn_time_step (F_REAL *dt)
 
int __FC_DECL__() mbdyn_get_tl_const (F_REAL *RLOCAL, F_INTEGER *Cur_elem)
 
int __FC_DECL__() mbdyn_get_hl_const (F_REAL *RLOCAL, F_INTEGER *Cur_elem, F_REAL *RHub)
 

Typedef Documentation

typedef char F_CHAR

Definition at line 64 of file NREL_AeroDyn.h.

typedef long int F_INTEGER

Definition at line 65 of file NREL_AeroDyn.h.

typedef long int F_LOGICAL

Definition at line 63 of file NREL_AeroDyn.h.

Function Documentation

int __FC_DECL__() ad_abort ( void  )
int __FC_DECL__() ad_inputgate ( F_CHAR input_file)
int __FC_DECL__() adinputgate ( void  )
int __FC_DECL__() aerofrcintrface ( F_LOGICAL FirstLoop,
F_INTEGER JElem,
F_REAL *  DFN,
F_REAL *  DFT,
F_REAL *  PMA 
)

Referenced by AeroDynModule::AssRes().

int __FC_DECL__() elemout ( void  )

Referenced by getrotorparams().

int __FC_DECL__() getbladeparams ( F_REAL *  psi)

Definition at line 1021 of file module-aerodyn.cc.

References AeroDynModule::GetCurrBladeR(), StructNode::GetRCurr(), AeroDynModule::iGetCurrBlade(), M_PI, module_aerodyn, AeroDynModule::pGetHubNode(), AeroDynModule::pGetNacelleNode(), R, and RotManip::VecRot().

1022 {
1023  /*
1024  * This comment is added by Fanzhong MENG 10th.Feb.2008
1025  * NOTE: Add code here too get blade Azimuth angle.
1026  * The 6 o'clock position is positive value
1027  * Variable name is *psi. [rad].
1028  */
1029  const Mat3x3& R_nacelle = ::module_aerodyn->pGetNacelleNode()->GetRCurr();
1030  const Mat3x3& R_hub = ::module_aerodyn->pGetHubNode()->GetRCurr();
1031  const Mat3x3& R_blade_root = ::module_aerodyn->GetCurrBladeR();
1032  Mat3x3 R = (R_hub*R_blade_root).MulTM(R_nacelle);
1033  Vec3 Phi(RotManip::VecRot(R));
1034  *psi = -Phi(3);
1035 
1036  // unwrap psi (0 <= psi <= 360)
1037  while (*psi < 0) {
1038  *psi += 2*M_PI;
1039  }
1040 
1041 #ifdef MODULE_AERODYN_DEBUG
1042  silent_cerr("getbladeparams: blade=" << ::module_aerodyn->iGetCurrBlade()
1043  << " psi=" << (*psi)*180/M_PI << std::endl);
1044 #endif // MODULE_AERODYN_DEBUG
1045 
1046  return 0;
1047 }
#define M_PI
Definition: gradienttest.cc:67
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
static AeroDynModule * module_aerodyn
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
const Mat3x3 & GetCurrBladeR(void) const
const StructNode * pGetHubNode(void) const
F_INTEGER iGetCurrBlade(void) const
const StructNode * pGetNacelleNode(void) const
Mat3x3 R

Here is the call graph for this function:

int __FC_DECL__() getelemparams ( F_INTEGER MulTabLoc,
F_REAL *  phi,
F_REAL *  radius,
F_REAL *  XGRND,
F_REAL *  YGRND,
F_REAL *  ZGRND 
)

Definition at line 1053 of file module-aerodyn.cc.

References AeroDynModule::dGetCurrBladeNodeBuiltinTwist(), AeroDynModule::GetCurrBladeR(), StructNode::GetRCurr(), StructDispNode::GetXCurr(), module_aerodyn, Mat3x3::MulTV(), Vec3::Norm(), AeroDynModule::pGetCurrBladeNode(), AeroDynModule::pGetHubNode(), AeroDynModule::pGetNacelleNode(), R, AeroDynModule::SetCurrBladeNodePITNOW(), Mat3x3::Transpose(), and RotManip::VecRot().

1060 {
1061  /*
1062  * This comment is added by Fanzhong MENG 10th.Feb.2008
1063  * Get coordinates of blade element relative to the undeflected
1064  * tower top reference frame. At the Hub height.
1065  * The variable name is *XGRND *YGRND *ZGRND
1066  */
1067  /*
1068  * Get blade elements coordinates X,Y,Z.
1069  */
1072  // Maybe we have to modified here. Here we need
1073  // hub height coordinates.
1074  *XGRND = x(1);
1075  *YGRND = x(2);
1076  *ZGRND = x(3);
1077  /*
1078  * Get blade elements radius. It is the perpendicular distance
1079  * from the rotor axis to the element aerodynamic reference point.
1080  */
1081  const Vec3& X_node = ::module_aerodyn->pGetCurrBladeNode()->GetXCurr();
1082  const Vec3& X_hub = ::module_aerodyn->pGetHubNode()->GetXCurr();
1083  const Mat3x3& R_nacelle = ::module_aerodyn->pGetNacelleNode()->GetRCurr();
1084  Vec3 d = R_nacelle.MulTV(X_node - X_hub);
1085  d(3) = 0.;
1086  *radius = d.Norm();
1087 
1088  /*
1089  * Get the blade elements local pitch angle. Here X-axis is in the blade
1090  * spanwise direction.
1091  */
1092  // unsigned blade = ::module_aerodyn->iGetCurrBlade();
1093  const Mat3x3& R_node = ::module_aerodyn->pGetCurrBladeNode()->GetRCurr();
1094  const Mat3x3& R_hub = ::module_aerodyn->pGetHubNode()->GetRCurr();
1095  const Mat3x3& R_blade_root = ::module_aerodyn->GetCurrBladeR();
1096  Mat3x3 R = (R_hub*R_blade_root).MulTM(R_node);
1097  Vec3 Phi(RotManip::VecRot(R.Transpose()));
1098 
1099  // Pitch Now = Pitch + Twist
1102 
1103  /*
1104  * This comment is added by Fanzhong MENG 10th.Feb.2008
1105  * When the Multi-airfoil table option is open, we should also
1106  * switch on this option. By default, this value should be set to ZERO.
1107  * I don't know how this Multi-airfoil table work,yet.
1108  */
1109  *MulTabLoc = 0;
1110 
1111  return 0;
1112 }
doublereal dGetCurrBladeNodeBuiltinTwist(void) const
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
doublereal Norm(void) const
Definition: matvec3.h:263
static AeroDynModule * module_aerodyn
Vec3 VecRot(const Mat3x3 &Phi)
Definition: Rot.cc:136
Vec3 MulTV(const Vec3 &v) const
Definition: matvec3.cc:482
const Mat3x3 & GetCurrBladeR(void) const
void SetCurrBladeNodePITNOW(doublereal PITNOW)
const StructNode * pGetHubNode(void) const
const StructNode * pGetCurrBladeNode(void) const
const StructNode * pGetNacelleNode(void) const
virtual const Vec3 & GetXCurr(void) const
Definition: strnode.h:310
Mat3x3 Transpose(void) const
Definition: matvec3.h:816
Mat3x3 R

Here is the call graph for this function:

int __FC_DECL__() getrotorparams ( F_REAL *  Omega,
F_REAL *  gamma,
F_REAL *  VHUB,
F_REAL *  tau 
)

Definition at line 949 of file module-aerodyn.cc.

References grad::atan2(), AeroDynModule::dGetHubTowerXYDistance(), elemout(), StructNode::GetRCurr(), Mat3x3::GetVec(), StructNode::GetWCurr(), M_PI, module_aerodyn, AeroDynModule::pGetHubNode(), AeroDynModule::pGetNacelleNode(), AeroDynModule::SetRotorSpeed(), and grad::sqrt().

954 {
955  /*
956  * This comment is added by Fanzhong MENG 10th.Feb.2008
957  * NOTE: Add code here to get rotorspeed from MBDyn.
958  * Rotor can be running clockwise or ccw. But the
959  * value of *Omega must be positive [rad/s]
960  */
961  /*
962  * PM 2008-09-06:
963  * nacelle & rotor axis is node axis 3, positive opposite
964  * to wind direction
965  */
966 
967  const Mat3x3& nacelle_R = ::module_aerodyn->pGetNacelleNode()->GetRCurr();
968  const Vec3& hub_Omega = ::module_aerodyn->pGetHubNode()->GetWCurr();
969  Vec3 rotation_axis = nacelle_R.GetVec(3);
970 
971  *Omega = std::abs(hub_Omega*rotation_axis);
972  module_aerodyn->SetRotorSpeed(*Omega);
973 
974  /*
975  * This comment is added by Fanzhong MENG 10th.Feb.2008
976  * NOTE: Add code here to get Yawangle from MBDyn.
977  * Yaw angle of the shaft relative to the ground reference.
978  * Positive value is clockwise when viewed from above of nacelle.
979  * Variable name is *gamma. [rad].
980  */
981  *gamma = std::atan2(-rotation_axis(2), -rotation_axis(1));
982 
983  /*
984  * This comment is added by Fanzhong MENG 10th.Feb.2008
985  * NOTE: Add code here to get tilt angle from MBDyn.
986  * Tilt angle of the shaft relative to the ground reference.
987  * Positive value is Tilt UP
988  * Variable name is *tau. [rad].
989  */
990  *tau = std::atan2(rotation_axis(3),
991  std::sqrt(rotation_axis(1)*rotation_axis(1) + rotation_axis(2)*rotation_axis(2)));
992 
993  /*
994  * This comment is added by Fanzhong MENG 10th.Feb.2008
995  * NOTE: Add code here to get Hub Tangential velocity from MBDyn.
996  * Positive value is in the same direction with Yaw Angle.
997  * Variable name is *VHUB.[m/s or feet/s]
998  */
999  // *VHUB = hub_Omega(3)*::module_aerodyn->dGetHubTowerXYDistance();
1000  /* See Emails by Fanzhong Meng August 27, 2010 */
1001  const Vec3& nacelle_Omega = ::module_aerodyn->pGetNacelleNode()->GetWCurr();
1002  *VHUB = nacelle_Omega(3)*::module_aerodyn->dGetHubTowerXYDistance();
1003 
1004  __FC_DECL__(elemout)();
1005 
1006 #ifdef MODULE_AERODYN_DEBUG
1007  silent_cerr("getrotorparams: "
1008  "Omega=" << *Omega << " "
1009  "gamma=" << (*gamma)*180/M_PI << " "
1010  "tau=" << (*tau)*180/M_PI << " "
1011  "VHUB=" << *VHUB << std::endl);
1012 #endif // MODULE_AERODYN_DEBUG
1013 
1014  return 0;
1015 }
#define M_PI
Definition: gradienttest.cc:67
Definition: matvec3.h:98
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
static AeroDynModule * module_aerodyn
Vec3 GetVec(unsigned short int i) const
Definition: matvec3.h:893
doublereal dGetHubTowerXYDistance(void) const
const StructNode * pGetHubNode(void) const
virtual const Vec3 & GetWCurr(void) const
Definition: strnode.h:1030
const StructNode * pGetNacelleNode(void) const
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
Definition: gradient.h:2974
int __FC_DECL__() elemout(void)
void SetRotorSpeed(doublereal Omega)
GradientExpression< BinaryExpr< FuncAtan2, LhsExpr, RhsExpr > > atan2(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
Definition: gradient.h:2962

Here is the call graph for this function:

int __FC_DECL__() getvnvt ( F_REAL *  VX,
F_REAL *  VY,
F_REAL *  VZ,
F_REAL *  VT,
F_REAL *  VNW,
F_REAL *  VNE 
)

Definition at line 1118 of file module-aerodyn.cc.

References grad::cos(), AeroDynModule::dGetCurrBladeNodePITNOW(), AeroDynModule::GetCurrBladeNodeRa(), StructNode::GetRCurr(), StructDispNode::GetVCurr(), module_aerodyn, Mat3x3::MulTV(), AeroDynModule::pGetCurrBladeNode(), and grad::sin().

1125 {
1126  /*
1127  * Fanzhong MENG 18th.Feb.2008.
1128  * This function returns velocities of the wind
1129  * and the element in the ground reference frame.
1130  * VX,VY,VZ are provided by AeroDyn for MBDyn.
1131  */
1132  /*
1133  * This "getvnvt" function is correct now!
1134  */
1135  /*
1136  * velocity of the element related to Ground reference frame.
1137  */
1138  const Vec3& ve_G = ::module_aerodyn->pGetCurrBladeNode()->GetVCurr();
1139 
1140  /*
1141  * velocity of the wind related to Ground reference frame.
1142  * The "-" sign change the wind velocity from Aerodyn reference frame to MBDyn
1143  * Global reference frame. AeroDyn global reference frame can be found on page 35 of Aerodyn user's guide--Figure C1
1144  */
1145  Vec3 vw_G = Vec3(-(*VX), -(*VY), *VZ);
1146 
1147  /*
1148  * Transform wind vector from ground coordinate system (vw_G) to
1149  * blade Node reference frame (vw_El)
1150  */
1151  const Mat3x3& R_node = ::module_aerodyn->pGetCurrBladeNode()->GetRCurr();
1152  /*
1153  * 10th of June. Modified by fanzhong meng.
1154  * get orientation matrix of node twist with respect to node without pitch.
1155  */
1156  const Mat3x3& R_node_twist = ::module_aerodyn->GetCurrBladeNodeRa();
1157 
1158 
1159  Vec3 vw_El = R_node_twist.MulTV( R_node.MulTV(vw_G) );
1160  Vec3 ve_El = R_node_twist.MulTV( R_node.MulTV(ve_G) );
1161 
1162  /*
1163  * Calculate SIN and COS value of current pitch angle.
1164  */
1165 
1167  doublereal CPitchNow = std::cos(PitchNow);
1168  doublereal SPitchNow = std::sin(PitchNow);
1169 
1170  /*
1171  * Play around with these SIN and COS value to get
1172  * *VT,*VNW and *VNE.
1173  */
1174 
1175  doublereal vt_wind = -vw_El(2)*CPitchNow - vw_El(3)*SPitchNow;
1176  doublereal vt_element = ve_El(2)*CPitchNow + ve_El(3)*SPitchNow;
1177 
1178  *VT = vt_wind + vt_element;
1179  *VNW = -vw_El(2)*SPitchNow + vw_El(3)*CPitchNow;
1180  /*
1181  * Element Normal velocity opposites to the Wind Normal velocity.
1182  * You can find is on page 35 of Aerodyn user's guide--Figure C2.
1183  */
1184  *VNE = -(-ve_El(2)*SPitchNow + ve_El(3)*CPitchNow);
1185 
1186  return 0;
1187 }
doublereal dGetCurrBladeNodePITNOW(void) const
Definition: matvec3.h:98
GradientExpression< UnaryExpr< FuncSin, Expr > > sin(const GradientExpression< Expr > &u)
Definition: gradient.h:2977
virtual const Mat3x3 & GetRCurr(void) const
Definition: strnode.h:1012
static AeroDynModule * module_aerodyn
Vec3 MulTV(const Vec3 &v) const
Definition: matvec3.cc:482
const Mat3x3 & GetCurrBladeNodeRa(void) const
const StructNode * pGetCurrBladeNode(void) const
virtual const Vec3 & GetVCurr(void) const
Definition: strnode.h:322
GradientExpression< UnaryExpr< FuncCos, Expr > > cos(const GradientExpression< Expr > &u)
Definition: gradient.h:2978
double doublereal
Definition: colamd.c:52

Here is the call graph for this function:

int __FC_DECL__() mbdyn_ad_inputgate ( F_CHAR ifname,
F_INTEGER ifnamelen,
F_CHAR efname,
F_INTEGER efnamelen 
)
int __FC_DECL__() mbdyn_com_data ( F_INTEGER c_blade,
F_INTEGER c_elem 
)

Referenced by AeroDynModule::AssRes().

int __FC_DECL__() mbdyn_false ( F_LOGICAL val)

Referenced by AeroDynModule::AssRes().

int __FC_DECL__() mbdyn_get_hl_const ( F_REAL *  RLOCAL,
F_INTEGER Cur_elem,
F_REAL *  RHub 
)
int __FC_DECL__() mbdyn_get_tl_const ( F_REAL *  RLOCAL,
F_INTEGER Cur_elem 
)
int __FC_DECL__() mbdyn_init ( F_CHAR Version,
F_INTEGER nblades,
F_REAL *  rotradius 
)
int __FC_DECL__() mbdyn_sim_time ( doublereal c_time)
int __FC_DECL__() mbdyn_time_step ( F_REAL *  dt)
int __FC_DECL__() mbdyn_true ( F_LOGICAL val)
int __FC_DECL__() usrmes ( F_LOGICAL Logical,
F_CHAR  msg[],
F_INTEGER code,
F_CHAR  level[] 
)

Definition at line 1199 of file module-aerodyn.cc.

References msg.

1204 {
1205 #if 0
1206  // can't work, unless we know the size of the arrays!
1207  silent_cerr("module-aerodyn: msg=\"" << msg << "\" "
1208  "code=" << *code
1209  << " level=" << level
1210  << std::endl);
1211 #endif
1212  silent_cerr("module-aerodyn: diagnostics from AeroDyn, "
1213  "code=" << *code << std::endl);
1214 
1215  return 0;
1216 }
struct mbrtai_msg_t msg