WSF
WsfCoverageRevisitTime.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2020 Infoscitex, a DCS Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef WSFCOVERAGEREVISITTIME_HPP
13#define WSFCOVERAGEREVISITTIME_HPP
14
15#include "wsf_coverage_export.h"
16
17#include <map>
18#include <vector>
19
21#include "WsfCoverageAsset.hpp"
23
24namespace wsf
25{
26namespace coverage
27{
28
30class WSF_COVERAGE_EXPORT RevisitTime : public Measure
31{
32public:
33 explicit RevisitTime(const WsfScenario& aScenario)
34 : Measure{aScenario}
35 {
37 }
38 RevisitTime(const RevisitTime& aOther) = default;
39 ~RevisitTime() override = default;
40
41 // Measure overrides
42 RevisitTime* Clone() const override { return new RevisitTime{*this}; }
43 bool ProcessInput(UtInput& aInput) override;
44 double GetMeasuredValue(const GridAsset& aGridAsset) const override;
45 double GetDefaultValue() const override;
46 void CollectionStarting(Coverage& aCoverage, double aSimTime) override;
47 std::string GetValueHeader() const override;
48
49 constexpr static const char* cTYPE{"WSF_REVISIT_TIME_MOE"};
50
52 enum class SubType
53 {
54 cUNKNOWN,
55 cMEAN,
56 cMINIMUM,
57 cMAXIMUM,
58 cSTD_DEV,
59 cNUM_PERCENT_BELOW,
60 cPERCENT_BELOW,
61 cPERCENT_BELOW_GAPS_ONLY
62 };
63
64 SubType GetSubType() const { return mSubType; }
65 double GetParameter() const { return mParameter * 100.0; }
66
67private:
68 bool InitializeP(Coverage& aCoverage) override;
69 void CollectionCompletingP(Coverage& aCoverage, double aSimTime) override;
70 double ComputeValue(std::vector<AccessInterval>& aGaps) const;
71 double ComputeMean(const std::vector<AccessInterval>& aGaps) const;
72 double ComputeMin(const std::vector<AccessInterval>& aGaps) const;
73 double ComputeMax(const std::vector<AccessInterval>& aGaps) const;
74 double ComputeStdDev(const std::vector<AccessInterval>& aGaps) const;
75 double ComputeNumPercentBelow(std::vector<AccessInterval>& aGaps) const;
76 double ComputePercentBelow(std::vector<AccessInterval>& aGaps) const;
77 double ComputePercentBelowGapsOnly(std::vector<AccessInterval>& aGaps) const;
78 double ComputePercentageOffset(std::vector<AccessInterval>& aGaps, double aOffset) const;
79 void SortGapsByDuration(std::vector<AccessInterval>& aGaps) const;
80
81 void OnAccessIntervalComplete(const GridAsset& aGridAsset, const FreeAsset& aFreeAsset, const AccessInterval& aInterval);
82
83 static SubType GetSubtypeFromIdentifier(const std::string& aIdentifier);
84 static bool SubtypeHasParameter(SubType aSubType);
85
87 std::map<GridAsset, std::vector<AccessInterval>> mIntervals{};
88
90 std::map<GridAsset, double> mData{};
91
93 AccessInterval mCoverageInterval{};
94
96 SubType mSubType{SubType::cUNKNOWN};
97
99 double mParameter{-1.0};
100};
101
102} // namespace coverage
103} // namespace wsf
104
105#endif // WSFCOVERAGEREVISITTIME_HPP
void SetType(WsfStringId aType)
Definition WsfObject.cpp:172
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
Definition WsfCoverageAccessInterval.hpp:28
Definition WsfCoverage.hpp:57
Definition WsfCoverageAsset.hpp:81
Definition WsfCoverageAsset.hpp:37
Measure(const WsfScenario &aScenario)
Definition WsfCoverageMeasure.hpp:45
~RevisitTime() override=default
static constexpr const char * cTYPE
Definition WsfCoverageRevisitTime.hpp:49
RevisitTime * Clone() const override
Definition WsfCoverageRevisitTime.hpp:42
double GetParameter() const
Definition WsfCoverageRevisitTime.hpp:65
RevisitTime(const WsfScenario &aScenario)
Definition WsfCoverageRevisitTime.hpp:33
RevisitTime(const RevisitTime &aOther)=default
SubType
The available sub-types for this MOE.
Definition WsfCoverageRevisitTime.hpp:53
SubType GetSubType() const
Definition WsfCoverageRevisitTime.hpp:64
Definition WsfCoverage.cpp:35
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Copyrights Multiple, All Rights Reserved