From ff7756db38ee6088aeb6d06a44a05aa4511ac271 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Fri, 27 Jan 2017 01:07:39 +0100 Subject: [PATCH] refs #865, added parts to interpolation log --- src/blackmisc/simulation/interpolator.cpp | 7 ++++++- src/blackmisc/simulation/interpolator.h | 14 ++++++++------ src/blackmisc/simulation/interpolatorlinear.cpp | 6 ++++-- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/blackmisc/simulation/interpolator.cpp b/src/blackmisc/simulation/interpolator.cpp index 6926c8d4d..ec717faf9 100644 --- a/src/blackmisc/simulation/interpolator.cpp +++ b/src/blackmisc/simulation/interpolator.cpp @@ -203,6 +203,7 @@ namespace BlackMisc QLatin1Literal("elv.oldelv.newelv.cur") % QLatin1Literal("gnd.factor") % QLatin1Literal("onGnd.oldonGnd.newonGnd.cur") % + QLatin1Literal("partsparts details") % QLatin1Literal("\n"); static const CLengthUnit ft = CLengthUnit::ft(); @@ -244,7 +245,11 @@ namespace BlackMisc QLatin1Literal("") % QString::number(log.groundFactor) % QLatin1Literal("") % QLatin1Literal("") % log.oldSituation.getOnGroundInfo() % QLatin1Literal("") % QLatin1Literal("") % log.newSituation.getOnGroundInfo() % QLatin1Literal("") % - QLatin1Literal("") % log.currentSituation.getOnGroundInfo() % QLatin1Literal("") % + QLatin1Literal("") % log.currentSituation.getOnGroundInfo() % QLatin1Literal(""); + + tableRows += + QLatin1Literal("") % boolToYesNo(log.useParts) % QLatin1Literal("") % + QLatin1Literal("") % (log.useParts ? log.parts.toQString(true) : QLatin1Literal("")) % QLatin1Literal("") % QLatin1Literal("\n"); } diff --git a/src/blackmisc/simulation/interpolator.h b/src/blackmisc/simulation/interpolator.h index 7c9ab257b..c038dcbcb 100644 --- a/src/blackmisc/simulation/interpolator.h +++ b/src/blackmisc/simulation/interpolator.h @@ -109,9 +109,9 @@ namespace BlackMisc //! Parts before given offset time (aka pending parts) //! \threadsafe virtual BlackMisc::Aviation::CAircraftParts getInterpolatedParts( - const Aviation::CCallsign &callsign, - const BlackMisc::Aviation::CAircraftPartsList &parts, qint64 cutoffTime, - PartsStatus &partsStatus) const; + const Aviation::CCallsign &callsign, + const BlackMisc::Aviation::CAircraftPartsList &parts, qint64 cutoffTime, + PartsStatus &partsStatus) const; //! Parts before given offset time (aka pending parts) //! \threadsafe @@ -149,9 +149,11 @@ namespace BlackMisc double groundFactor = -1; //!< current ground factor double vtolAircraft = false; //!< VTOL aircraft double deltaTimeMs = 0; //!< delta time to last situation - double simulationTimeFraction = -1; //!< time fraction, normally 0..1 - double deltaTimeFractionMs = -1; //!< delta time fraction - BlackMisc::Aviation::CCallsign callsign; //!< current callsign + double simulationTimeFraction = -1; //!< time fraction, normally 0..1 + double deltaTimeFractionMs = -1; //!< delta time fraction + bool useParts = false; //!< supporting aircraft parts + BlackMisc::Aviation::CCallsign callsign; //!< current callsign + BlackMisc::Aviation::CAircraftParts parts; //!< corresponding parts used in interpolator BlackMisc::Aviation::CAircraftSituation oldSituation; //!< old situation BlackMisc::Aviation::CAircraftSituation newSituation; //!< new situation BlackMisc::Aviation::CAircraftSituation currentSituation; //!< interpolated situation diff --git a/src/blackmisc/simulation/interpolatorlinear.cpp b/src/blackmisc/simulation/interpolatorlinear.cpp index 238eebb1e..ef1f0cc25 100644 --- a/src/blackmisc/simulation/interpolatorlinear.cpp +++ b/src/blackmisc/simulation/interpolatorlinear.cpp @@ -107,7 +107,7 @@ namespace BlackMisc IInterpolator::setGroundElevationFromHint(hints, newSituation); } - CAircraftSituation currentSituation(oldSituation); + CAircraftSituation currentSituation(oldSituation); // also sets ground elevation if available CCoordinateGeodetic currentPosition; // Time between start and end packet @@ -139,7 +139,8 @@ namespace BlackMisc currentSituation.setPosition(currentPosition); // Interpolate altitude: Alt = (AltB - AltA) * t + AltA - const CAltitude oldAlt(oldSituation.getCorrectedAltitude()); // avoid underflow below ground elevation + // avoid underflow below ground elevation by using getCorrectedAltitude + const CAltitude oldAlt(oldSituation.getCorrectedAltitude()); const CAltitude newAlt(newSituation.getCorrectedAltitude()); Q_ASSERT_X(oldAlt.getReferenceDatum() == CAltitude::MeanSeaLevel && oldAlt.getReferenceDatum() == newAlt.getReferenceDatum(), Q_FUNC_INFO, "mismatch in reference"); // otherwise no calculation is possible currentSituation.setAltitude(CAltitude((newAlt - oldAlt) @@ -222,6 +223,7 @@ namespace BlackMisc log.currentSituation = currentSituation; log.oldSituation = oldSituation; log.newSituation = newSituation; + log.useParts = hints.hasAircraftParts(); this->logInterpolation(log); }