diff --git a/src/blackmisc/simulation/interpolationlogger.cpp b/src/blackmisc/simulation/interpolationlogger.cpp
index ff72b1745..5945a2b4c 100644
--- a/src/blackmisc/simulation/interpolationlogger.cpp
+++ b/src/blackmisc/simulation/interpolationlogger.cpp
@@ -132,7 +132,7 @@ namespace BlackMisc
if (logs.isEmpty()) { return {}; }
const QString tableHeader =
QLatin1String("") %
- QLatin1String("| c. | CS | VTOL | timestamp | since | ") %
+ QLatin1String("cs. | CS | VTOL | timestamp | since | ") %
QLatin1String("ts old | ts new | ts cur | ") %
QLatin1String("Δt | Δt fr. | fraction | ") %
QLatin1String("lat.old | lat.new | lat.cur | ") %
@@ -141,7 +141,8 @@ namespace BlackMisc
QLatin1String("elv.old | elv.new | elv.cur | ") %
QLatin1String("gnd.factor | ") %
QLatin1String("onGnd.old | onGnd.new | onGnd.cur | ") %
- QLatin1String("parts | c. | parts details | ") %
+ QLatin1String("CG | ") %
+ QLatin1String("parts | cp. | parts details | ") %
QLatin1String("
\n");
static const CLengthUnit ft = CLengthUnit::ft();
@@ -198,11 +199,13 @@ namespace BlackMisc
QLatin1String("
") % log.currentSituation.getOnGroundInfo() % QLatin1String(" | ");
tableRows +=
+ QLatin1String("") % log.cgAboveGround.valueRoundedWithUnit(CLengthUnit::ft(), 0) % QLatin1String(" | ") %
QLatin1String("") % boolToYesNo(log.useParts) % QLatin1String(" | ") %
- (changedParts ? QLatin1String("* | ") : QLatin1String(" | ")) %
+ (changedParts ? QLatin1String("* | ") : QLatin1String(" | ")) %
QLatin1String("") % (log.useParts ? log.parts.toQString(true) : QLatin1String("")) % QLatin1String(" | ") %
QLatin1String("\n");
}
+
tableRows += QLatin1String("\n");
return QLatin1String("\n") % tableHeader % tableRows % QLatin1String("
\n");
}
diff --git a/src/blackmisc/simulation/interpolationlogger.h b/src/blackmisc/simulation/interpolationlogger.h
index 6d4c02491..6f9b65449 100644
--- a/src/blackmisc/simulation/interpolationlogger.h
+++ b/src/blackmisc/simulation/interpolationlogger.h
@@ -70,15 +70,16 @@ namespace BlackMisc
BlackMisc::Aviation::CAircraftSituation oldSituation; //!< old situation
BlackMisc::Aviation::CAircraftSituation newSituation; //!< new situation
BlackMisc::Aviation::CAircraftSituation currentSituation; //!< interpolated situation
+ BlackMisc::PhysicalQuantities::CLength cgAboveGround; //!< center of gravity
};
//! Log entry for parts interpolation
struct PartsLog
{
qint64 timestamp = -1; //!< current timestamp
+ bool empty = false; //!< empty parts?
BlackMisc::Aviation::CCallsign callsign; //!< current callsign
BlackMisc::Aviation::CAircraftParts parts; //!< parts to be logged
- bool empty = false;
};
//! Log current interpolation cycle, only stores in memory, for performance reasons
diff --git a/src/blackmisc/simulation/interpolator.cpp b/src/blackmisc/simulation/interpolator.cpp
index 9f57709ec..a5c147963 100644
--- a/src/blackmisc/simulation/interpolator.cpp
+++ b/src/blackmisc/simulation/interpolator.cpp
@@ -58,7 +58,7 @@ namespace BlackMisc
if (currentTimeMsSinceEpoc < 0) { currentTimeMsSinceEpoc = QDateTime::currentMSecsSinceEpoch(); }
// interpolant function from derived class
- auto interpolant = derived()->getInterpolant(currentTimeMsSinceEpoc, setup, hints, status, log);
+ const auto interpolant = derived()->getInterpolant(currentTimeMsSinceEpoc, setup, hints, status, log);
// succeeded so far?
if (!status.didInterpolationSucceed()) { return currentSituation; }
@@ -84,8 +84,8 @@ namespace BlackMisc
if (!currentGroundElevation.isNull())
{
Q_ASSERT_X(currentGroundElevation.getReferenceDatum() == CAltitude::MeanSeaLevel, Q_FUNC_INFO, "Need MSL value");
- currentSituation.setAltitude(CAltitude(currentSituation.getAltitude() * (1.0 - groundFactor)
- + currentGroundElevation * groundFactor,
+ currentSituation.setAltitude(CAltitude(currentSituation.getAltitude() * (1.0 - groundFactor) +
+ currentGroundElevation * groundFactor,
currentSituation.getAltitude().getReferenceDatum()));
}
}
@@ -116,6 +116,7 @@ namespace BlackMisc
{
log.timestamp = currentTimeMsSinceEpoc;
log.callsign = m_callsign;
+ log.cgAboveGround = hints.getCGAboveGround();
log.vtolAircraft = hints.isVtolAircraft();
log.currentSituation = currentSituation;
log.useParts = hints.hasAircraftParts();
@@ -187,7 +188,7 @@ namespace BlackMisc
{
static const CAircraftParts emptyParts;
this->logParts(currentTimeMsSinceEpoch, emptyParts, true, log);
- emptyParts;
+ return emptyParts;
}
// find the first parts not in the correct order, keep only the parts before that one
diff --git a/src/blackmisc/simulation/interpolator.h b/src/blackmisc/simulation/interpolator.h
index 72f8d8397..8504f75cc 100644
--- a/src/blackmisc/simulation/interpolator.h
+++ b/src/blackmisc/simulation/interpolator.h
@@ -123,6 +123,8 @@ namespace BlackMisc
PhysicalQuantities::CAngle getPitch() const;
PhysicalQuantities::CAngle getBank() const;
PhysicalQuantities::CSpeed getGroundSpeed() const;
+ Aviation::CAircraftSituation getOldSituation() const { return oldSituation; }
+ Aviation::CAircraftSituation getNewSituation() const { return newSituation; }
//! @}
//! Change time fraction
diff --git a/src/blackmisc/simulation/interpolatorspline.cpp b/src/blackmisc/simulation/interpolatorspline.cpp
index 560ee92af..ab632326d 100644
--- a/src/blackmisc/simulation/interpolatorspline.cpp
+++ b/src/blackmisc/simulation/interpolatorspline.cpp
@@ -94,7 +94,6 @@ namespace BlackMisc
{
Q_UNUSED(hints);
Q_UNUSED(setup);
- Q_UNUSED(log);
// recalculate derivatives only if they changed
if (currentTimeMsSinceEpoc > m_nextSampleTime)
@@ -129,6 +128,8 @@ namespace BlackMisc
m_altitudeUnit = situationsOlder.begin()->getAltitude().getUnit();
pbh = { *situationsOlder.begin(), *(situationsNewer.end() - 1) };
}
+ log.oldSituation = pbh.getOldSituation();
+ log.newSituation = pbh.getNewSituation();
status.setInterpolationSucceeded(true);
status.setChangedPosition(true);