2003-10-16 14:40:13 +00:00
|
|
|
#ifndef _ROTOR_HPP
|
|
|
|
#define _ROTOR_HPP
|
|
|
|
|
|
|
|
#include "Vector.hpp"
|
|
|
|
#include "Rotorpart.hpp"
|
2006-08-14 21:59:44 +00:00
|
|
|
#include "Integrator.hpp"
|
|
|
|
#include "RigidBody.hpp"
|
|
|
|
#include "BodyEnvironment.hpp"
|
|
|
|
|
2003-10-16 14:40:13 +00:00
|
|
|
namespace yasim {
|
|
|
|
|
|
|
|
class Surface;
|
|
|
|
class Rotorpart;
|
2006-09-14 18:18:33 +00:00
|
|
|
class Ground;
|
2006-08-14 21:59:44 +00:00
|
|
|
const float rho_null=1.184f; //25DegC, 101325Pa
|
2003-10-16 14:40:13 +00:00
|
|
|
|
|
|
|
class Rotor {
|
2006-09-14 18:18:33 +00:00
|
|
|
friend std::ostream & operator<<(std::ostream & out, /*const*/ Rotor& r);
|
2006-08-14 21:59:44 +00:00
|
|
|
private:
|
|
|
|
float _torque;
|
|
|
|
float _omega,_omegan,_omegarel,_ddt_omega,_omegarelneu;
|
2007-05-09 20:36:43 +00:00
|
|
|
float _phi_null;
|
2006-08-14 21:59:44 +00:00
|
|
|
float _chord;
|
|
|
|
float _taper;
|
|
|
|
float _airfoil_incidence_no_lift;
|
|
|
|
float _collective;
|
|
|
|
float _airfoil_lift_coefficient;
|
|
|
|
float _airfoil_drag_coefficient0;
|
|
|
|
float _airfoil_drag_coefficient1;
|
|
|
|
int _ccw;
|
2006-09-14 18:18:33 +00:00
|
|
|
int _number_of_blades;
|
|
|
|
int _number_of_segments;
|
|
|
|
int _number_of_parts;
|
2007-05-25 21:15:59 +00:00
|
|
|
float _balance1;
|
|
|
|
float _balance2;
|
2007-06-13 21:10:23 +00:00
|
|
|
float _tilt_yaw;
|
|
|
|
float _tilt_roll;
|
|
|
|
float _tilt_pitch;
|
2007-06-16 07:22:47 +00:00
|
|
|
float _old_tilt_roll;
|
|
|
|
float _old_tilt_pitch;
|
|
|
|
float _old_tilt_yaw;
|
2006-08-14 21:59:44 +00:00
|
|
|
|
2003-10-16 14:40:13 +00:00
|
|
|
public:
|
|
|
|
Rotor();
|
|
|
|
~Rotor();
|
|
|
|
|
|
|
|
// Rotor geometry:
|
2006-08-14 21:59:44 +00:00
|
|
|
void setNormal(float* normal);
|
|
|
|
//the normal vector (direction of rotormast, pointing up)
|
|
|
|
|
|
|
|
void setForward(float* forward);
|
|
|
|
//the normal vector pointing forward (for ele and ail)
|
2003-10-16 14:40:13 +00:00
|
|
|
void setForceAtPitchA(float force);
|
|
|
|
void setPowerAtPitch0(float value);
|
|
|
|
void setPowerAtPitchB(float value);
|
|
|
|
void setNotorque(int value);
|
|
|
|
void setPitchA(float value);
|
|
|
|
void setPitchB(float value);
|
|
|
|
void setMinCyclicail(float value);
|
|
|
|
void setMinCyclicele(float value);
|
|
|
|
void setMaxCyclicail(float value);
|
|
|
|
void setMaxCyclicele(float value);
|
|
|
|
void setMaxCollective(float value);
|
|
|
|
void setMinCollective(float value);
|
2007-06-13 21:10:23 +00:00
|
|
|
void setMinTiltYaw(float value);
|
|
|
|
void setMinTiltPitch(float value);
|
|
|
|
void setMinTiltRoll(float value);
|
|
|
|
void setMaxTiltYaw(float value);
|
|
|
|
void setMaxTiltPitch(float value);
|
|
|
|
void setMaxTiltRoll(float value);
|
|
|
|
void setTiltCenterX(float value);
|
|
|
|
void setTiltCenterY(float value);
|
|
|
|
void setTiltCenterZ(float value);
|
|
|
|
void setTiltYaw(float lval);
|
|
|
|
void setTiltPitch(float lval);
|
|
|
|
void setTiltRoll(float lval);
|
2003-10-16 14:40:13 +00:00
|
|
|
void setDiameter(float value);
|
|
|
|
void setWeightPerBlade(float value);
|
|
|
|
void setNumberOfBlades(float value);
|
|
|
|
void setRelBladeCenter(float value);
|
|
|
|
void setDelta3(float value);
|
|
|
|
void setDelta(float value);
|
|
|
|
void setDynamic(float value);
|
|
|
|
void setTranslift(float value);
|
|
|
|
void setC2(float value);
|
|
|
|
void setStepspersecond(float steps);
|
|
|
|
void setRPM(float value);
|
2007-05-09 20:36:43 +00:00
|
|
|
void setPhiNull(float value);
|
2003-10-16 14:40:13 +00:00
|
|
|
void setRelLenHinge(float value);
|
|
|
|
void setBase(float* base); // in local coordinates
|
2006-08-14 21:59:44 +00:00
|
|
|
void getPosition(float* out);
|
2003-10-16 14:40:13 +00:00
|
|
|
void setCyclicail(float lval,float rval);
|
|
|
|
void setCyclicele(float lval,float rval);
|
|
|
|
void setCollective(float lval);
|
|
|
|
void setAlphaoutput(int i, const char *text);
|
|
|
|
void setCcw(int ccw);
|
2006-08-14 21:59:44 +00:00
|
|
|
int getCcw() {return _ccw;};
|
|
|
|
void setParameter(char *parametername, float value);
|
|
|
|
void setGlobalGround(double* global_ground, float* global_vel);
|
|
|
|
float getTorqueOfInertia();
|
2003-10-16 14:40:13 +00:00
|
|
|
int getValueforFGSet(int j,char *b,float *f);
|
|
|
|
void setName(const char *text);
|
2006-08-14 21:59:44 +00:00
|
|
|
void inititeration(float dt,float omegarel,float ddt_omegarel,float *rot);
|
2003-10-16 14:40:13 +00:00
|
|
|
void compile();
|
2007-06-16 07:22:47 +00:00
|
|
|
void updateDirectionsAndPositions(float *rot);
|
2003-10-16 14:40:13 +00:00
|
|
|
void getTip(float* tip);
|
2006-08-14 21:59:44 +00:00
|
|
|
void calcLiftFactor(float* v, float rho, State *s);
|
|
|
|
void getDownWash(float *pos, float * v_heli, float *downwash);
|
2006-09-14 18:18:33 +00:00
|
|
|
int getNumberOfBlades(){return _number_of_blades;}
|
2006-08-14 21:59:44 +00:00
|
|
|
|
2003-10-16 14:40:13 +00:00
|
|
|
// Query the list of Rotorpart objects
|
|
|
|
int numRotorparts();
|
|
|
|
Rotorpart* getRotorpart(int n);
|
|
|
|
void setAlpha0(float f);
|
|
|
|
void setAlphamin(float f);
|
|
|
|
void setAlphamax(float f);
|
|
|
|
void setTeeterdamp(float f);
|
|
|
|
void setMaxteeterdamp(float f);
|
|
|
|
void setRelLenTeeterHinge(float value);
|
|
|
|
void setAlpha0factor(float f);
|
2006-08-14 21:59:44 +00:00
|
|
|
void setTorque(float f);
|
|
|
|
void addTorque(float f);
|
|
|
|
float getTorque() {return _torque;}
|
|
|
|
float getLiftFactor();
|
|
|
|
float getLiftCoef(float incidence,float speed);
|
|
|
|
float getDragCoef(float incidence,float speed);
|
|
|
|
float getOmegaRel() {return _omegarel;}
|
|
|
|
float getOmegaRelNeu() {return _omegarelneu;}
|
|
|
|
void setOmegaRelNeu(float orn) {_omegarelneu=orn;}
|
|
|
|
float getOmegan() {return _omegan;}
|
|
|
|
float getTaper() { return _taper;}
|
|
|
|
float getChord() { return _chord;}
|
2006-09-14 18:18:33 +00:00
|
|
|
int getNumberOfParts() { return _number_of_parts;}
|
2006-08-14 21:59:44 +00:00
|
|
|
float getOverallStall()
|
|
|
|
{if (_stall_v2sum !=0 ) return _stall_sum/_stall_v2sum; else return 0;}
|
2006-09-14 18:18:33 +00:00
|
|
|
float getAirfoilIncidenceNoLift() {return _airfoil_incidence_no_lift;}
|
2006-08-14 21:59:44 +00:00
|
|
|
Vector _rotorparts;
|
2006-09-14 18:18:33 +00:00
|
|
|
void findGroundEffectAltitude(Ground * ground_cb,State *s);
|
2007-05-15 21:30:33 +00:00
|
|
|
float *getGravDirection() {return _grav_direction;}
|
2006-09-14 18:18:33 +00:00
|
|
|
void writeInfo();
|
2007-05-09 20:36:43 +00:00
|
|
|
void setSharedFlapHinge(bool s);
|
2007-05-25 21:15:59 +00:00
|
|
|
void setBalance(float b);
|
|
|
|
float getBalance(){ return (_balance1>0)?_balance1*_balance2:_balance1;}
|
2003-10-16 14:40:13 +00:00
|
|
|
|
|
|
|
private:
|
2007-05-25 21:15:59 +00:00
|
|
|
void testForRotorGroundContact (Ground * ground_cb,State *s);
|
2003-10-16 14:40:13 +00:00
|
|
|
void strncpy(char *dest,const char *src,int maxlen);
|
|
|
|
void interp(float* v1, float* v2, float frac, float* out);
|
2006-08-14 21:59:44 +00:00
|
|
|
float calcStall(float incidence,float speed);
|
2006-09-14 18:18:33 +00:00
|
|
|
float findGroundEffectAltitude(Ground * ground_cb,State *s,
|
|
|
|
float *pos0,float *pos1,float *pos2,float *pos3,
|
|
|
|
int iteration=0,float a0=-1,float a1=-1,float a2=-1,float a3=-1);
|
2007-06-13 21:10:23 +00:00
|
|
|
static void euler2orient(float roll, float pitch, float hdg,
|
|
|
|
float* out);
|
|
|
|
Rotorpart* newRotorpart(/*float* pos, float *posforceattac, float *normal,
|
|
|
|
float* speed,float *dirzentforce, */float zentforce,float maxpitchforce,
|
2006-08-14 21:59:44 +00:00
|
|
|
float delta3,float mass,float translift,float rellenhinge,float len);
|
2003-10-16 14:40:13 +00:00
|
|
|
float _base[3];
|
2006-09-14 18:18:33 +00:00
|
|
|
float _groundeffectpos[4][3];
|
2007-05-25 21:15:59 +00:00
|
|
|
float _ground_contact_pos[16][3];
|
|
|
|
int _num_ground_contact_pos;
|
2006-09-14 18:18:33 +00:00
|
|
|
float _ground_effect_altitude;
|
|
|
|
//some postions, where to calcualte the ground effect
|
2003-10-16 14:40:13 +00:00
|
|
|
float _normal[3];//the normal vector (direction of rotormast, pointing up)
|
2006-08-14 21:59:44 +00:00
|
|
|
float _normal_with_yaw_roll[3];//the normal vector (perpendicular to rotordisc)
|
2003-10-16 14:40:13 +00:00
|
|
|
float _forward[3];
|
|
|
|
float _diameter;
|
|
|
|
float _weight_per_blade;
|
|
|
|
float _rel_blade_center;
|
2007-06-13 21:10:23 +00:00
|
|
|
float _tilt_center[3];
|
|
|
|
float _min_tilt_yaw;
|
|
|
|
float _min_tilt_pitch;
|
|
|
|
float _min_tilt_roll;
|
|
|
|
float _max_tilt_yaw;
|
|
|
|
float _max_tilt_pitch;
|
|
|
|
float _max_tilt_roll;
|
2003-10-16 14:40:13 +00:00
|
|
|
float _min_pitch;
|
|
|
|
float _max_pitch;
|
|
|
|
float _force_at_pitch_a;
|
|
|
|
float _pitch_a;
|
|
|
|
float _power_at_pitch_0;
|
|
|
|
float _power_at_pitch_b;
|
|
|
|
int _no_torque;
|
|
|
|
int _sim_blades;
|
|
|
|
float _pitch_b;
|
|
|
|
float _rotor_rpm;
|
|
|
|
float _rel_len_hinge;
|
|
|
|
float _maxcyclicail;
|
|
|
|
float _maxcyclicele;
|
|
|
|
float _mincyclicail;
|
|
|
|
float _mincyclicele;
|
|
|
|
float _delta3;
|
|
|
|
float _delta;
|
|
|
|
float _dynamic;
|
|
|
|
float _translift;
|
|
|
|
float _c2;
|
|
|
|
float _stepspersecond;
|
|
|
|
char _alphaoutput[8][256];
|
|
|
|
char _name[256];
|
|
|
|
int _engineon;
|
|
|
|
float _alphamin,_alphamax,_alpha0,_alpha0factor;
|
|
|
|
float _teeterdamp,_maxteeterdamp;
|
|
|
|
float _rellenteeterhinge;
|
2006-08-14 21:59:44 +00:00
|
|
|
float _translift_ve;
|
|
|
|
float _translift_maxfactor;
|
|
|
|
float _ground_effect_constant;
|
|
|
|
float _vortex_state_lift_factor;
|
|
|
|
float _vortex_state_c1;
|
|
|
|
float _vortex_state_c2;
|
|
|
|
float _vortex_state_c3;
|
|
|
|
float _vortex_state_e1;
|
|
|
|
float _vortex_state_e2;
|
|
|
|
float _vortex_state_e3;
|
|
|
|
float _lift_factor,_f_ge,_f_vs,_f_tl;
|
|
|
|
float _vortex_state;
|
|
|
|
double _global_ground[4];
|
|
|
|
float _liftcoef;
|
|
|
|
float _dragcoef0;
|
|
|
|
float _dragcoef1;
|
|
|
|
float _twist; //outer incidence = inner inner incidence + _twist
|
|
|
|
float _rel_len_where_incidence_is_measured;
|
|
|
|
float _torque_of_inertia;
|
|
|
|
float _rel_len_blade_start;
|
|
|
|
float _incidence_stall_zero_speed;
|
|
|
|
float _incidence_stall_half_sonic_speed;
|
|
|
|
float _lift_factor_stall;
|
|
|
|
float _stall_change_over;
|
|
|
|
float _drag_factor_stall;
|
|
|
|
float _stall_sum;
|
|
|
|
float _stall_v2sum;
|
|
|
|
float _yaw;
|
|
|
|
float _roll;
|
2006-09-14 18:18:33 +00:00
|
|
|
float _cyclicail;
|
|
|
|
float _cyclicele;
|
|
|
|
float _cyclic_factor;
|
|
|
|
float _rotor_correction_factor;
|
2007-05-09 20:36:43 +00:00
|
|
|
float _phi;
|
|
|
|
bool _shared_flap_hinge;
|
2007-05-15 21:30:33 +00:00
|
|
|
float _grav_direction[3];
|
2007-05-25 21:15:59 +00:00
|
|
|
int _properties_tied;
|
2007-06-13 21:10:23 +00:00
|
|
|
bool _directions_and_postions_dirty;
|
2006-08-14 21:59:44 +00:00
|
|
|
};
|
2006-09-14 18:18:33 +00:00
|
|
|
std::ostream & operator<<(std::ostream & out, /*const*/ Rotor& r);
|
2003-10-16 14:40:13 +00:00
|
|
|
|
2006-08-14 21:59:44 +00:00
|
|
|
class Rotorgear {
|
|
|
|
private:
|
|
|
|
int _in_use;
|
|
|
|
int _engineon;
|
|
|
|
float _max_power_engine;
|
|
|
|
float _engine_prop_factor;
|
|
|
|
float _yasimdragfactor;
|
|
|
|
float _yasimliftfactor;
|
|
|
|
float _rotorbrake;
|
|
|
|
float _max_power_rotor_brake;
|
2006-09-14 18:18:33 +00:00
|
|
|
float _rotorgear_friction;
|
2006-08-14 21:59:44 +00:00
|
|
|
float _ddt_omegarel;
|
2006-09-14 18:18:33 +00:00
|
|
|
float _engine_accel_limit;
|
|
|
|
float _total_torque_on_engine;
|
2006-08-14 21:59:44 +00:00
|
|
|
Vector _rotors;
|
2007-07-09 19:51:01 +00:00
|
|
|
float _target_rel_rpm;
|
|
|
|
float _max_rel_torque;
|
2003-10-16 14:40:13 +00:00
|
|
|
|
2006-08-14 21:59:44 +00:00
|
|
|
public:
|
|
|
|
Rotorgear();
|
|
|
|
~Rotorgear();
|
|
|
|
int isInUse() {return _in_use;}
|
|
|
|
void setInUse() {_in_use = 1;}
|
2007-01-10 19:03:02 +00:00
|
|
|
void compile();
|
2006-08-14 21:59:44 +00:00
|
|
|
void addRotor(Rotor* rotor);
|
|
|
|
int getNumRotors() {return _rotors.size();}
|
|
|
|
Rotor* getRotor(int i) {return (Rotor*)_rotors.get(i);}
|
|
|
|
void calcForces(float* torqueOut);
|
|
|
|
void setParameter(char *parametername, float value);
|
|
|
|
void setEngineOn(int value);
|
|
|
|
int getEngineon();
|
|
|
|
void setRotorBrake(float lval);
|
2007-05-27 20:19:15 +00:00
|
|
|
void setRotorEngineMaxRelTorque(float lval);
|
|
|
|
void setRotorRelTarget(float lval);
|
2006-08-14 21:59:44 +00:00
|
|
|
float getYasimDragFactor() { return _yasimdragfactor;}
|
|
|
|
float getYasimLiftFactor() { return _yasimliftfactor;}
|
|
|
|
float getMaxPowerEngine() { return _max_power_engine;}
|
|
|
|
float getMaxPowerRotorBrake() { return _max_power_rotor_brake;}
|
|
|
|
float getRotorBrake() { return _rotorbrake;}
|
|
|
|
float getEnginePropFactor() {return _engine_prop_factor;}
|
|
|
|
Vector* getRotors() { return &_rotors;}
|
|
|
|
void initRotorIteration(float *lrot,float dt);
|
|
|
|
void getDownWash(float *pos, float * v_heli, float *downwash);
|
2006-09-14 18:18:33 +00:00
|
|
|
int getValueforFGSet(int j,char *b,float *f);
|
2003-10-16 14:40:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}; // namespace yasim
|
|
|
|
#endif // _ROTOR_HPP
|