Fix bug in Thrustcurve::setThrustCurveVector that didn't recalculate maxTime after setting a new thrust curve
This commit is contained in:
parent
2b7606c417
commit
e942cfb819
@ -13,9 +13,12 @@ void Rocket::launch()
|
|||||||
std::vector<std::pair<double, double>> temp;
|
std::vector<std::pair<double, double>> temp;
|
||||||
temp.push_back(std::make_pair(0.0, 0.0));
|
temp.push_back(std::make_pair(0.0, 0.0));
|
||||||
temp.push_back(std::make_pair(0.1, 10.0));
|
temp.push_back(std::make_pair(0.1, 10.0));
|
||||||
temp.push_back(std::make_pair(0.2, 50.0));
|
temp.push_back(std::make_pair(0.2, 100.0));
|
||||||
temp.push_back(std::make_pair(1.2, 50.0));
|
temp.push_back(std::make_pair(1.2, 50.0));
|
||||||
temp.push_back(std::make_pair(1.3, 0.0));
|
temp.push_back(std::make_pair(1.3, 0.0));
|
||||||
|
temp.push_back(std::make_pair(8.0, 0.0));
|
||||||
|
temp.push_back(std::make_pair(9.0, 100.0));
|
||||||
|
temp.push_back(std::make_pair(10.0, 0.0));
|
||||||
tc.setThrustCurveVector(temp);
|
tc.setThrustCurveVector(temp);
|
||||||
propagator.runUntilTerminate();
|
propagator.runUntilTerminate();
|
||||||
}
|
}
|
||||||
|
@ -29,12 +29,18 @@ void Thrustcurve::setThrustCurveVector(const std::vector<std::pair<double, doubl
|
|||||||
thrustCurve.clear();
|
thrustCurve.clear();
|
||||||
thrustCurve.resize(v.size());
|
thrustCurve.resize(v.size());
|
||||||
std::copy(v.begin(), v.end(), thrustCurve.begin());
|
std::copy(v.begin(), v.end(), thrustCurve.begin());
|
||||||
|
maxTime = std::max_element(thrustCurve.begin(),
|
||||||
|
thrustCurve.end(),
|
||||||
|
[](const auto& a, const auto& b)
|
||||||
|
{
|
||||||
|
return a.first < b.first;
|
||||||
|
})->first;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thrustcurve::setIgnitionTime(double t)
|
void Thrustcurve::setIgnitionTime(double t)
|
||||||
{
|
{
|
||||||
ignitionTime = t;
|
ignitionTime = t;
|
||||||
maxTime += ignitionTime;
|
//maxTime += ignitionTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
double Thrustcurve::getThrust(double t)
|
double Thrustcurve::getThrust(double t)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user