Ref T171, interpolator log

* set interpolator type spline or linear
* set some detail values for spline log
* removed unused variable
This commit is contained in:
Klaus Basan
2017-10-16 09:17:35 +02:00
parent 7b50917410
commit 1155bf3ed2
4 changed files with 14 additions and 4 deletions

View File

@@ -154,7 +154,8 @@ namespace BlackMisc
if (logs.isEmpty()) { return {}; }
const QString tableHeader =
QLatin1String("<thead><tr>") %
QLatin1String("<th title=\"changed situation\">cs.</th><th>CS</th><th>VTOL</th><th>timestamp</th><th>since</th>") %
QLatin1String("<th title=\"changed situation\">cs.</th><th>Int</th>") %
QLatin1String("<th>CS</th><th>VTOL</th><th>timestamp</th><th>since</th>") %
QLatin1String("<th>ts old</th><th>ts new</th><th>ts cur</th>") %
QLatin1String("<th>&Delta;t</th><th>&Delta;t fr.</th><th>fraction</th>") %
QLatin1String("<th>lat.old</th><th>lat.new</th><th>lat.cur</th>") %
@@ -184,6 +185,7 @@ namespace BlackMisc
tableRows +=
QLatin1String("<tr>") %
(changedNewPosition ? QLatin1String("<td class=\"changed\">*</td>") : QLatin1String("<td></td>")) %
QLatin1String("<td>") % log.interpolator % QLatin1String("</td>") %
QLatin1String("<td>") % log.callsign.asString() % QLatin1String("</td>") %
QLatin1String("<td>") % boolToYesNo(log.vtolAircraft) % QLatin1String("</td>") %
QLatin1String("<td>") % msSinceEpochToTime(log.timestamp) % QLatin1String("</td>") %

View File

@@ -54,6 +54,7 @@ namespace BlackMisc
//! Log entry for situation interpolation
struct SituationLog
{
QChar interpolator; //!< what interpolator is used
qint64 timestamp = -1; //!< current timestamp
double groundFactor = -1; //!< current ground factor
double vtolAircraft = false; //!< VTOL aircraft

View File

@@ -36,7 +36,7 @@ namespace BlackMisc
namespace Simulation
{
CInterpolatorLinear::Interpolant CInterpolatorLinear::getInterpolant(qint64 currentTimeMsSinceEpoc,
const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints, CInterpolationStatus &status, CInterpolationLogger::SituationLog &log) const
const CInterpolationAndRenderingSetup &setup, const CInterpolationHints &hints, CInterpolationStatus &status, CInterpolationLogger::SituationLog &log) const
{
Q_UNUSED(setup);
Q_UNUSED(hints);
@@ -94,11 +94,11 @@ namespace BlackMisc
}
CAircraftSituation currentSituation(oldSituation); // also sets ground elevation if available
CCoordinateGeodetic currentPosition;
// Time between start and end packet
const double deltaTimeMs = newSituation.getAdjustedMSecsSinceEpoch() - oldSituation.getAdjustedMSecsSinceEpoch();
Q_ASSERT_X(deltaTimeMs >= 0, Q_FUNC_INFO, "Negative delta time");
log.interpolator = 'l';
log.deltaTimeMs = deltaTimeMs;
// Fraction of the deltaTime, ideally [0.0 - 1.0]

View File

@@ -128,12 +128,19 @@ namespace BlackMisc
m_altitudeUnit = situationsOlder.begin()->getAltitude().getUnit();
m_pbh = { *situationsOlder.begin(), *(situationsNewer.end() - 1) };
}
log.interpolator = 's';
log.oldSituation = m_pbh.getOldSituation();
log.newSituation = m_pbh.getNewSituation();
status.setInterpolationSucceeded(true);
status.setChangedPosition(true);
m_pbh.setTimeFraction(static_cast<double>(currentTimeMsSinceEpoc - m_prevSampleTime) / static_cast<double>(m_nextSampleTime - m_prevSampleTime));
const double dt1 = static_cast<double>(currentTimeMsSinceEpoc - m_prevSampleTime);
const double dt2 = static_cast<double>(m_nextSampleTime - m_prevSampleTime);
const double timeFraction = dt1 / dt2;
log.deltaTimeMs = dt1;
log.deltaTimeFractionMs = dt2;
log.simulationTimeFraction = timeFraction;
m_pbh.setTimeFraction(timeFraction);
return { *this, currentTimeMsSinceEpoc };
}