Add terminateCondition to Rocket class. Allows the propagator to check the rocket for a terminate condition instead of hardcoding it in the propagator itself
This commit is contained in:
parent
e942cfb819
commit
23566efa67
@ -23,6 +23,14 @@ void Rocket::launch()
|
||||
propagator.runUntilTerminate();
|
||||
}
|
||||
|
||||
bool Rocket::terminateCondition(const std::pair<double, std::vector<double>>& cond)
|
||||
{
|
||||
if(cond.second[2] < 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
double Rocket::getThrust(double t)
|
||||
{
|
||||
return tc.getThrust(t);
|
||||
|
@ -25,6 +25,8 @@ public:
|
||||
|
||||
double getThrust(double t);
|
||||
void setThrustCurve(const Thrustcurve& curve);
|
||||
|
||||
bool terminateCondition(const std::pair<double, std::vector<double>>& cond);
|
||||
private:
|
||||
|
||||
sim::Propagator propagator;
|
||||
|
@ -60,7 +60,7 @@ void Propagator::runUntilTerminate()
|
||||
{
|
||||
states.push_back(std::make_pair(currentTime, currentState));
|
||||
}
|
||||
if(currentState[2] < 0.0)
|
||||
if(rocket->terminateCondition(std::make_pair(currentTime, currentState)))
|
||||
break;
|
||||
|
||||
currentTime += timeStep;
|
||||
|
Loading…
x
Reference in New Issue
Block a user