WSF
WsfEngageLaunchPkTableLethality.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI//REL TO USA ONLY
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2016 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 WSFENGAGELAUNCHPKTABLELETHALITY_HPP
13#define WSFENGAGELAUNCHPKTABLELETHALITY_HPP
14
15#include <memory>
16
17#include "UtCloneablePtr.hpp"
18#include "UtTable.hpp"
19#include "WsfWeaponEffects.hpp"
20
22{
23public:
27 WsfWeaponEffects* Clone() const override;
28 bool PreInitialize() override;
29 bool Initialize(double aSimTime, const WsfWeaponEngagement* aEngagementPtr) override;
30
31 bool ProcessInput(UtInput& aInput) override;
32
33protected:
35
36 void CalcLaunchPk(double aSimTime) override;
37
38private:
39 bool LoadPkTable(const std::string& aFileName, std::string& aErrorString);
40
41 template<typename T>
42 bool ReadHeaderLine(std::ifstream& aFile, const std::string& aExpectedHeaderField, T& aHeaderValue, std::string& aErrorString);
43
44 class PkTableInput
45 {
46 public:
47 bool ReadPkTableInput(std::ifstream& aFile,
48 double aAltitude, // meters
49 double aTargetSpeed, // meters/sec
50 const std::string& aLengthUnits);
51
52 // Use default constant value if table inputs are malformed
53 bool CreateTableFromInput(std::unique_ptr<UtTable::Table>& aPkTablePtr,
54 double aDefaultConstant,
55 std::string& aErrorString);
56
57 private:
58 struct CrDrPkTable
59 {
60 std::vector<double> mCrossRanges; // meters
61 std::vector<double> mDownRanges; // meters
62 std::vector<double> mPkValues;
63 };
64
65 // File input: Altitude (m) -> Target speed (m/s) -> CR/DR/Pk Table
66 // These inputs will be processed into a UtInput object that is loaded into UtTable using ProcessInput
67 std::map<double, std::map<double, std::unique_ptr<CrDrPkTable>>> mCrDrPkTables;
68 };
69
70 std::string mPkTablesPath;
71 double mDefaultPk; // Use default Pk if <Launcher type, Target type> pair is not found in tables
72 std::string mPkTableFileFilter; // Use to filter table files that are loaded
73
74 // Key is <Launcher type, Target type>
75 using KeyType = std::pair<WsfStringId, WsfStringId>;
76
77 std::map<KeyType, std::unique_ptr<PkTableInput>> mPkTableInputs;
78 std::map<KeyType, UtCloneablePtr<UtTable::Table>> mPkTables; // The lookup tables : Pk = f(Altitude, Target speed,
79 // Cross Range, Down Range)
80};
81
82#endif // WSFENGAGELAUNCHPKTABLELETHALITY_HPP
bool Initialize(double aSimTime, const WsfWeaponEngagement *aEngagementPtr) override
Definition WsfEngageLaunchPkTableLethality.cpp:179
bool ProcessInput(UtInput &aInput) override
Definition WsfEngageLaunchPkTableLethality.cpp:197
WsfEngageLaunchPkTableLethality(WsfScenario &aScenario)
Definition WsfEngageLaunchPkTableLethality.cpp:45
WsfWeaponEffects * Clone() const override
Definition WsfEngageLaunchPkTableLethality.cpp:121
bool PreInitialize() override
Definition WsfEngageLaunchPkTableLethality.cpp:127
~WsfEngageLaunchPkTableLethality() override=default
void CalcLaunchPk(double aSimTime) override
Definition WsfEngageLaunchPkTableLethality.cpp:77
WsfEngageLaunchPkTableLethality & operator=(const WsfEngageLaunchPkTableLethality &)=delete
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
WsfWeaponEffects(WsfScenario &aScenario)
Definition WsfWeaponEffects.cpp:51
Definition WsfWeaponEngagement.hpp:43
Copyrights Multiple, All Rights Reserved