WSF
WsfCoverageAccessDuration.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 WSFCOVERAGEACCESSDURATION_HPP
13#define WSFCOVERAGEACCESSDURATION_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 AccessDuration : public Measure
31{
32public:
33 explicit AccessDuration(const WsfScenario& aScenario)
34 : Measure{aScenario}
35 {
37 }
38 AccessDuration(const AccessDuration& aOther) = default;
39 ~AccessDuration() override = default;
40
41 // Measure overrides
42 AccessDuration* Clone() const override { return new AccessDuration{*this}; }
43 bool ProcessInput(UtInput& aInput) override;
44 double GetDefaultValue() const override;
45 double GetMeasuredValue(const GridAsset& aGridAsset) const override;
46 void CollectionStarting(Coverage& aCoverage, double aSimTime) override;
47 std::string GetValueHeader() const override;
48
49 constexpr static const char* cTYPE{"WSF_ACCESS_DURATION_MOE"};
50
52 enum class SubType
53 {
54 cMEAN,
55 cMIN,
56 cMAX,
57 cPERCENT_ABOVE,
58 cSTDDEV,
59 cSUM,
60 cUNKNOWN
61 };
62
64 SubType GetSubType() const { return mSubType; }
65
67 double GetParameter() const { return mParameter * 100.0; }
68
69private:
70 bool InitializeP(Coverage& aCoverage) override;
71 void CollectionCompletingP(Coverage& aCoverage, double aSimTime) override;
72 double ComputeValue(std::vector<AccessInterval>& aIntervals) const;
73 double ComputeMean(std::vector<AccessInterval>& aIntervals) const;
74 double ComputeMin(std::vector<AccessInterval>& aIntervals) const;
75 double ComputeMax(std::vector<AccessInterval>& aIntervals) const;
76 double ComputePercentAbove(std::vector<AccessInterval>& aIntervals) const;
77 double ComputeStddev(std::vector<AccessInterval>& aIntervals) const;
78 double ComputeSum(std::vector<AccessInterval>& aIntervals) const;
79
80 void SortIntervalsByDuration(std::vector<AccessInterval>& aIntervals) const;
81
82 void OnAccessIntervalComplete(const GridAsset& aGridAsset, const FreeAsset& aFreeAsset, const AccessInterval& aInterval);
83
84 static SubType GetSubtypeFromIdentifier(const std::string& aIdentifier);
85 static bool SubtypeHasParameter(SubType aSubType);
86
88 mutable std::map<GridAsset, std::vector<AccessInterval>> mIntervals{};
89
91 std::map<GridAsset, double> mData{};
92
94 AccessInterval mCoverageInterval{};
95
97 SubType mSubType{SubType::cUNKNOWN};
98
100 double mParameter{-1.0};
101};
102
103} // namespace coverage
104} // namespace wsf
105
106#endif // WSFCOVERAGEACCESS_DURATION_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
static constexpr const char * cTYPE
Definition WsfCoverageAccessDuration.hpp:49
double GetParameter() const
Get the parameter passed if the subtype is percent_above, or -100.0 otherwise.
Definition WsfCoverageAccessDuration.hpp:67
AccessDuration(const AccessDuration &aOther)=default
AccessDuration * Clone() const override
Definition WsfCoverageAccessDuration.hpp:42
~AccessDuration() override=default
AccessDuration(const WsfScenario &aScenario)
Definition WsfCoverageAccessDuration.hpp:33
SubType GetSubType() const
Get the MoE's subtype enum.
Definition WsfCoverageAccessDuration.hpp:64
SubType
The available sub-types for this MOE.
Definition WsfCoverageAccessDuration.hpp:53
Definition WsfCoverageAccessInterval.hpp:28
Definition WsfCoverage.hpp:57
Definition WsfCoverageAsset.hpp:81
Definition WsfCoverageAsset.hpp:37
Measure(const WsfScenario &aScenario)
Definition WsfCoverageMeasure.hpp:45
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