From c04e147f2a3146e8ee82531ab2e782f7959c54be Mon Sep 17 00:00:00 2001 From: Furkan Date: Tue, 29 Oct 2024 14:40:03 +0000 Subject: [PATCH] #7318 - Done --- src/ExternLib/StatisticFunctions/AbstractFunc.hh | 3 ++- src/ExternLib/StatisticFunctions/ProcessStatisticFunctions.cc | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/ExternLib/StatisticFunctions/AbstractFunc.hh b/src/ExternLib/StatisticFunctions/AbstractFunc.hh index d37b4f3..2b6c554 100644 --- a/src/ExternLib/StatisticFunctions/AbstractFunc.hh +++ b/src/ExternLib/StatisticFunctions/AbstractFunc.hh @@ -369,7 +369,8 @@ public: virtual void pushData(double time, InputElemType& elem) { _mem.push_back(std::make_pair(time, elem)); - _targets.push_back(time); + if (time >= AbstractFunc::getIntStartTime() && time <= AbstractFunc::getIntStopTime()) + _targets.push_back(time); } virtual void resetFunc() { diff --git a/src/ExternLib/StatisticFunctions/ProcessStatisticFunctions.cc b/src/ExternLib/StatisticFunctions/ProcessStatisticFunctions.cc index acbe112..9f03099 100644 --- a/src/ExternLib/StatisticFunctions/ProcessStatisticFunctions.cc +++ b/src/ExternLib/StatisticFunctions/ProcessStatisticFunctions.cc @@ -17,9 +17,12 @@ #include "ProcessStatisticFunctions.hh" #include "ParamMgr.hh" +#include "TimeInterval.hh" + using namespace std; using namespace boost; using namespace log4cxx; +using namespace TimeTableCatalog; namespace AMDA { namespace Parameters { @@ -49,8 +52,19 @@ TimeStamp ProcessStatisticFunctions::init() { if (_windowtime <= 0) { BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("Window Time must be greater than 0."))); } - - TimeStamp time = _parameterInput->init( this, _timeIntervalList); + + TimeIntervalListSPtr lTimeIntervalList(new TimeIntervalList()); + + // Add shift time for each time interval + for (TimeIntervalList::iterator it = _timeIntervalList->begin(); it != _timeIntervalList->end(); ++it) { + if ((*it)._startTime - _windowtime/2. > 0) { + lTimeIntervalList->push_back(TimeInterval( (*it)._startTime - _windowtime/2., (*it)._stopTime + _windowtime/2.)); + } + else { + lTimeIntervalList->push_back(TimeInterval( 0, (*it)._stopTime + _windowtime/2.)); + } + } + TimeStamp time = _parameterInput->init( this, lTimeIntervalList); _paramInput = _parameterInput->getParamData(this).get(); -- libgit2 0.21.2