| 1 | #ifndef _ROTORPART_HPP |
| 2 | #define _ROTORPART_HPP |
| 3 | #include <iosfwd> |
| 4 | |
| 5 | namespace yasim { |
| 6 | class Rotor; |
| 7 | class Rotorpart |
| 8 | { |
| 9 | friend std::ostream & operator<<(std::ostream & out, const Rotorpart& rp); |
| 10 | private: |
| 11 | float _dt; |
| 12 | float _last_torque[3]; |
| 13 | int _compiled; |
| 14 | public: |
| 15 | Rotorpart(); |
| 16 | |
| 17 | // Position of this surface in local coords |
| 18 | void setPosition(float* p); |
| 19 | void getPosition(float* out); |
| 20 | void setCompiled() {_compiled=1;} |
| 21 | float getDt() {return _dt;} |
| 22 | void setPositionForceAttac(float* p); |
| 23 | void getPositionForceAttac(float* out); |
| 24 | void setNormal(float* p); |
| 25 | void getNormal(float* out); |
| 26 | void setCollective(float pos); |
| 27 | void setCyclic(float pos); |
| 28 | void getLastTorque(float *t) |
| 29 | {for (int i=0;i<3;i++) t[i]=_last_torque[i];} |
| 30 | void getAccelTorque(float relaccel,float *t); |
| 31 | void setSpeed(float* p); |
| 32 | void setDirectionofZentipetalforce(float* p); |
| 33 | void setDirectionofRotorPart(float* p); |
| 34 | void setZentipetalForce(float f); |
| 35 | void setMaxpitch(float f); |
| 36 | void setMinpitch(float f); |
| 37 | void setMaxcyclic(float f); |
| 38 | void setMincyclic(float f); |
| 39 | void setDelta3(float f); |
| 40 | void setDynamic(float f); |
| 41 | void setTranslift(float f); |
| 42 | void setC2(float f); |
| 43 | void setZentForce(float f); |
| 44 | void setRelLenHinge(float f); |
| 45 | void setRelamp(float f); |
| 46 | void setDiameter(float f); |
| 47 | float getAlpha(int i); |
| 48 | float getrealAlpha(void); |
| 49 | char* getAlphaoutput(int i); |
| 50 | void setAlphaoutput(char *text,int i); |
| 51 | void inititeration(float dt,float *rot); |
| 52 | float getWeight(void); |
| 53 | void setWeight(float value); |
| 54 | void calcForce(float* v, float rho, float* forceOut, float* torqueOut, |
| 55 | float* torque_scalar); |
| 56 | float calculateAlpha(float* v, float rho, float incidence, float cyc, |
| 57 | float alphaalt, float *torque,float *returnlift=0); |
| 58 | void setlastnextrp(Rotorpart*lastrp,Rotorpart*nextrp, |
| 59 | Rotorpart *oppositerp,Rotorpart*last90rp,Rotorpart*next90rp); |
| 60 | void setTorque(float torque_max_force,float torque_no_force); |
| 61 | void setOmega(float value); |
| 62 | void setOmegaN(float value); |
| 63 | void setPhi(float value); |
| 64 | void setDdtOmega(float value); |
| 65 | float getIncidence(); |
| 66 | float getPhi(); |
| 67 | void setAlphamin(float f); |
| 68 | void setAlphamax(float f); |
| 69 | void setAlpha0(float f); |
| 70 | void setAlpha0factor(float f); |
| 71 | void setLen(float value); |
| 72 | void setParameter(const char *parametername, float value); |
| 73 | void setRotor(Rotor *rotor); |
| 74 | void setTorqueOfInertia(float toi); |
| 75 | void writeInfo(std::ostringstream &buffer); |
| 76 | void setSharedFlapHinge(bool s); |
| 77 | void setDirection(float direction); |
| 78 | float getAlphaAlt() {return _alphaalt;} |
| 79 | |
| 80 | private: |
| 81 | void strncpy(char *dest,const char *src,int maxlen); |
| 82 | Rotorpart *_lastrp,*_nextrp,*_oppositerp,*_last90rp,*_next90rp; |
| 83 | Rotor *_rotor; |
| 84 | |
| 85 | float _pos[3]; // position in local coords |
| 86 | float _posforceattac[3]; // position in local coords |
| 87 | float _normal[3]; //direcetion of the rotation axis |
| 88 | float _torque_max_force; |
| 89 | float _torque_no_force; |
| 90 | float _speed[3]; |
| 91 | float _direction_of_movement[3]; |
| 92 | float _directionofcentripetalforce[3]; |
| 93 | float _directionofrotorpart[3]; |
| 94 | float _centripetalforce; |
| 95 | float _cyclic; |
| 96 | float _collective; |
| 97 | float _delta3; |
| 98 | float _dynamic; |
| 99 | float _translift; |
| 100 | float _c2; |
| 101 | float _mass; |
| 102 | float _alpha; |
| 103 | float _alphaalt; |
| 104 | float _alphamin,_alphamax,_alpha0,_alpha0factor; |
| 105 | float _rellenhinge; |
| 106 | float _relamp; |
| 107 | float _omega,_omegan,_ddt_omega; |
| 108 | float _phi; |
| 109 | float _len; |
| 110 | float _incidence; |
| 111 | float _twist; //outer incidence = inner inner incidence + _twist |
| 112 | int _number_of_segments; |
| 113 | float _rel_len_where_incidence_is_measured; |
| 114 | float _rel_len_blade_start; |
| 115 | float _diameter; |
| 116 | float _torque_of_inertia; |
| 117 | float _torque; |
| 118 | // total torque of rotor (scalar) for calculating new rotor rpm |
| 119 | char _alphaoutputbuf[2][256]; |
| 120 | int _alpha2type; |
| 121 | float _rotor_correction_factor; |
| 122 | bool _shared_flap_hinge; |
| 123 | float _direction; |
| 124 | float _balance; |
| 125 | }; |
| 126 | std::ostream & operator<<(std::ostream & out, const Rotorpart& rp); |
| 127 | }; // namespace yasim |
| 128 | #endif // _ROTORPART_HPP |