refs #896, added logging of CG and old/new position

This commit is contained in:
Klaus Basan
2017-03-05 03:06:48 +01:00
committed by Mathew Sutcliffe
parent 03b8739158
commit 78f3ef375f
5 changed files with 17 additions and 9 deletions

View File

@@ -132,7 +132,7 @@ namespace BlackMisc
if (logs.isEmpty()) { return {}; }
const QString tableHeader =
QLatin1String("<thead><tr>") %
QLatin1String("<th>c.</th><th>CS</th><th>VTOL</th><th>timestamp</th><th>since</th>") %
QLatin1String("<th title=\"changed situation\">cs.</th><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>") %
@@ -141,7 +141,8 @@ namespace BlackMisc
QLatin1String("<th>elv.old</th><th>elv.new</th><th>elv.cur</th>") %
QLatin1String("<th>gnd.factor</th>") %
QLatin1String("<th>onGnd.old</th><th>onGnd.new</th><th>onGnd.cur</th>") %
QLatin1String("<th>parts</th><th>c.</th><th>parts details</th>") %
QLatin1String("<th>CG</th>") %
QLatin1String("<th>parts</th><th title=\"changed parts\">cp.</th><th>parts details</th>") %
QLatin1String("</tr></thead>\n");
static const CLengthUnit ft = CLengthUnit::ft();
@@ -198,11 +199,13 @@ namespace BlackMisc
QLatin1String("<td class=\"cur\">") % log.currentSituation.getOnGroundInfo() % QLatin1String("</td>");
tableRows +=
QLatin1String("<td>") % log.cgAboveGround.valueRoundedWithUnit(CLengthUnit::ft(), 0) % QLatin1String("</td>") %
QLatin1String("<td>") % boolToYesNo(log.useParts) % QLatin1String("</td>") %
(changedParts ? QLatin1String("<td>*</td>") : QLatin1String("<td></td>")) %
(changedParts ? QLatin1String("<td class=\"changed\">*</td>") : QLatin1String("<td></td>")) %
QLatin1String("<td>") % (log.useParts ? log.parts.toQString(true) : QLatin1String("")) % QLatin1String("</td>") %
QLatin1String("</tr>\n");
}
tableRows += QLatin1String("</tbody>\n");
return QLatin1String("<table class=\"small\">\n") % tableHeader % tableRows % QLatin1String("</table>\n");
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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);