2001-12-01 06:22:24 +00:00
|
|
|
#ifndef _PROPENGINE_HPP
|
|
|
|
#define _PROPENGINE_HPP
|
|
|
|
|
|
|
|
#include "Thruster.hpp"
|
|
|
|
|
|
|
|
namespace yasim {
|
|
|
|
|
|
|
|
class Propeller;
|
|
|
|
class PistonEngine;
|
|
|
|
|
|
|
|
class PropEngine : public Thruster {
|
|
|
|
public:
|
|
|
|
PropEngine(Propeller* prop, PistonEngine* eng, float moment);
|
|
|
|
virtual ~PropEngine();
|
2001-12-06 18:13:24 +00:00
|
|
|
|
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-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; }
|
|
|
|
virtual PistonEngine* getPistonEngine() { return _eng; }
|
|
|
|
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;
|
|
|
|
PistonEngine* _eng;
|
|
|
|
|
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
|