2001-12-01 06:22:24 +00:00
|
|
|
#ifndef _PROPENGINE_HPP
|
|
|
|
#define _PROPENGINE_HPP
|
|
|
|
|
|
|
|
#include "Thruster.hpp"
|
2004-05-01 00:26:33 +00:00
|
|
|
#include "Engine.hpp"
|
2001-12-01 06:22:24 +00:00
|
|
|
|
|
|
|
namespace yasim {
|
|
|
|
|
|
|
|
class Propeller;
|
|
|
|
|
|
|
|
class PropEngine : public Thruster {
|
|
|
|
public:
|
2004-04-30 19:06:29 +00:00
|
|
|
PropEngine(Propeller* prop, Engine* eng, float moment);
|
2001-12-01 06:22:24 +00:00
|
|
|
virtual ~PropEngine();
|
2001-12-06 18:13:24 +00:00
|
|
|
|
2004-05-01 00:26:33 +00:00
|
|
|
void setEngine(Engine* eng) { delete _eng; _eng = eng; }
|
|
|
|
|
2002-02-20 04:27:22 +00:00
|
|
|
void setMagnetos(int magnetos);
|
2001-12-06 18:13:24 +00:00
|
|
|
void setAdvance(float advance);
|
2003-05-16 17:27:17 +00:00
|
|
|
void setPropPitch(float proppitch);
|
2001-12-06 18:13:24 +00:00
|
|
|
void setVariableProp(float min, float max);
|
2004-07-20 22:17:58 +00:00
|
|
|
void setPropFeather(int state);
|
2004-01-24 23:09:41 +00:00
|
|
|
void setGearRatio(float ratio) { _gearRatio = ratio; }
|
2001-12-06 18:13:24 +00:00
|
|
|
|
|
|
|
virtual PropEngine* getPropEngine() { return this; }
|
2004-04-30 19:06:29 +00:00
|
|
|
virtual Engine* getEngine() { return _eng; }
|
2001-12-06 18:13:24 +00:00
|
|
|
virtual Propeller* getPropeller() { return _prop; }
|
2001-12-01 06:22:24 +00:00
|
|
|
|
|
|
|
// Dynamic output
|
2002-02-20 04:27:22 +00:00
|
|
|
virtual bool isRunning();
|
|
|
|
virtual bool isCranking();
|
2001-12-01 06:22:24 +00:00
|
|
|
virtual void getThrust(float* out);
|
|
|
|
virtual void getTorque(float* out);
|
|
|
|
virtual void getGyro(float* out);
|
|
|
|
virtual float getFuelFlow();
|
|
|
|
|
|
|
|
// Runtime instructions
|
2002-02-27 00:41:57 +00:00
|
|
|
virtual void init();
|
2001-12-01 06:22:24 +00:00
|
|
|
virtual void integrate(float dt);
|
2001-12-06 18:13:24 +00:00
|
|
|
virtual void stabilize();
|
2001-12-01 06:22:24 +00:00
|
|
|
|
|
|
|
float getOmega();
|
2003-10-18 20:07:06 +00:00
|
|
|
void setOmega (float omega);
|
2001-12-01 06:22:24 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
float _moment;
|
|
|
|
Propeller* _prop;
|
2004-04-30 19:06:29 +00:00
|
|
|
Engine* _eng;
|
2001-12-01 06:22:24 +00:00
|
|
|
|
2001-12-06 18:13:24 +00:00
|
|
|
bool _variable;
|
2002-02-20 04:27:22 +00:00
|
|
|
int _magnetos; // 0=off, 1=right, 2=left, 3=both
|
2004-01-24 23:09:41 +00:00
|
|
|
float _gearRatio;
|
2001-12-06 18:13:24 +00:00
|
|
|
float _advance; // control input, 0-1
|
|
|
|
float _maxOmega;
|
|
|
|
float _minOmega;
|
|
|
|
|
2001-12-01 06:22:24 +00:00
|
|
|
float _omega; // RPM, in radians/sec
|
|
|
|
float _thrust[3];
|
|
|
|
float _torque[3];
|
|
|
|
float _gyro[3];
|
|
|
|
float _fuelFlow;
|
|
|
|
};
|
|
|
|
|
|
|
|
}; // namespace yasim
|
|
|
|
#endif // _PROPENGINE_HPP
|