Skip to content
Snippets Groups Projects
Commit a2ba0da5 authored by James Goppert's avatar James Goppert
Browse files

Added RPM for each motor.

parent e3eed2cf
No related branches found
No related tags found
No related merge requests found
...@@ -42,10 +42,14 @@ int main (int argc, char const* argv[]) ...@@ -42,10 +42,14 @@ int main (int argc, char const* argv[])
ss.x.add(new FGStateSpace::Theta); ss.x.add(new FGStateSpace::Theta);
ss.x.add(new FGStateSpace::Q); ss.x.add(new FGStateSpace::Q);
if (thruster0->GetType()==FGThruster::ttPropeller) if (thruster0->GetType()==FGThruster::ttPropeller)
{ {
ss.x.add(new FGStateSpace::Rpm); ss.x.add(new FGStateSpace::Rpm0);
if (variablePropPitch) ss.x.add(new FGStateSpace::PropPitch); if (variablePropPitch) ss.x.add(new FGStateSpace::PropPitch);
int numEngines = fdm.GetPropulsion()->GetNumEngines();
if (numEngines>1) ss.x.add(new FGStateSpace::Rpm1);
if (numEngines>2) ss.x.add(new FGStateSpace::Rpm2);
if (numEngines>3) ss.x.add(new FGStateSpace::Rpm3);
} }
ss.x.add(new FGStateSpace::Beta); ss.x.add(new FGStateSpace::Beta);
ss.x.add(new FGStateSpace::Phi); ss.x.add(new FGStateSpace::Phi);
......
...@@ -237,8 +237,12 @@ int main (int argc, char const* argv[]) ...@@ -237,8 +237,12 @@ int main (int argc, char const* argv[])
if (thruster0->GetType()==FGThruster::ttPropeller) if (thruster0->GetType()==FGThruster::ttPropeller)
{ {
ss.x.add(new FGStateSpace::Rpm); ss.x.add(new FGStateSpace::Rpm0);
if (variablePropPitch) ss.x.add(new FGStateSpace::PropPitch); if (variablePropPitch) ss.x.add(new FGStateSpace::PropPitch);
int numEngines = fdm.GetPropulsion()->GetNumEngines();
if (numEngines>1) ss.x.add(new FGStateSpace::Rpm1);
if (numEngines>2) ss.x.add(new FGStateSpace::Rpm2);
if (numEngines>3) ss.x.add(new FGStateSpace::Rpm3);
} }
ss.x.add(new FGStateSpace::Beta); ss.x.add(new FGStateSpace::Beta);
ss.x.add(new FGStateSpace::Phi); ss.x.add(new FGStateSpace::Phi);
......
...@@ -595,20 +595,59 @@ public: ...@@ -595,20 +595,59 @@ public:
} }
}; };
class Rpm : public Component class Rpm0 : public Component
{ {
public: public:
Rpm() : Component("Rpm","rev/min") {}; Rpm0() : Component("Rpm0","rev/min") {};
double get() const double get() const
{ {
return m_fdm->GetPropulsion()->GetEngine(0)->GetThruster()->GetRPM(); return m_fdm->GetPropulsion()->GetEngine(0)->GetThruster()->GetRPM();
} }
void set(double val) void set(double val)
{ {
for (int i=0;i<m_fdm->GetPropulsion()->GetNumEngines();i++) m_fdm->GetPropulsion()->GetEngine(0)->GetThruster()->SetRPM(val);
{ }
m_fdm->GetPropulsion()->GetEngine(i)->GetThruster()->SetRPM(val); };
}
class Rpm1 : public Component
{
public:
Rpm1() : Component("Rpm1","rev/min") {};
double get() const
{
return m_fdm->GetPropulsion()->GetEngine(1)->GetThruster()->GetRPM();
}
void set(double val)
{
m_fdm->GetPropulsion()->GetEngine(1)->GetThruster()->SetRPM(val);
}
};
class Rpm2 : public Component
{
public:
Rpm2() : Component("Rpmr2","rev/min") {};
double get() const
{
return m_fdm->GetPropulsion()->GetEngine(2)->GetThruster()->GetRPM();
}
void set(double val)
{
m_fdm->GetPropulsion()->GetEngine(2)->GetThruster()->SetRPM(val);
}
};
class Rpm3 : public Component
{
public:
Rpm3() : Component("Rpm3","rev/min") {};
double get() const
{
return m_fdm->GetPropulsion()->GetEngine(3)->GetThruster()->GetRPM();
}
void set(double val)
{
m_fdm->GetPropulsion()->GetEngine(3)->GetThruster()->SetRPM(val);
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment