WSF
WsfLaserWeapon.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 2003-2015 The Boeing 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 WSFLASERWEAPON_HPP
13#define WSFLASERWEAPON_HPP
14
15#include "wsf_mil_export.h"
16
17#include <string>
18
20#include "WsfEvent.hpp"
22#include "WsfStringId.hpp"
23#include "WsfThermalSystem.hpp"
24#include "WsfTrack.hpp"
26
33class WSF_MIL_EXPORT WsfLaserWeapon : public WsfDirectedEnergyWeapon
34{
35public:
44
45 WsfLaserWeapon(WsfScenario& aScenario);
47 ~WsfLaserWeapon() override;
48
49 WsfWeapon* Clone() const override;
50
51 bool ProcessInput(UtInput& aInput) override;
52
53 bool PreInitialize(double aSimTime) override;
54
55 bool Initialize(double aSimTime) override;
56
57 bool Initialize2(double aSimTime) override;
58
59 void Update(double aSimTime) override;
60
61 void TurnOff(double aSimTime) override;
62
63 double GetQuantityRemaining() const override;
64
65 const char* GetScriptClassName() const override;
66
68 WsfHighEnergyLaser* GetHEL() const { return mHEL_Ptr; }
69
71 void SetHEL(WsfHighEnergyLaser* aHEL);
72
73 using WsfWeapon::GetTargetIndex; // Needed to prevent SGI compiler warning
74
75 FireResult Fire(double aSimTime, const FireTarget& aTarget, const FireOptions& aSettings) override;
76
77 // Todo; pause/resume are not necessary; just call fire again after CeaseFire call.
78 void CeaseFire(double aSimTime) override;
79
81 bool IsFiring() const override;
82
83 bool CanLase(double aSimTime);
84
86 int GetState() const { return mState; }
87
89 double GetPeakFluence() const { return mHEL_Ptr->GetPeakFluence(); }
90
93 double GetEdgeFluence() const { return mHEL_Ptr->GetEdgeFluence(); }
94
96 double GetEnergy() const { return mHEL_Ptr->GetEnergy(); }
97
100 double GetTotalFiringTime() const { return mTotalFiringTime; }
101
103 double GetEnergyDensity() const { return mHEL_Ptr->GetEnergyDensity(); }
104
105 void SetFiringTime(double aFiringTime);
106 double GetCoolingTime() const;
107 double GetCoolingTimeRemaining() const;
108
109 double GetFiringTime() const;
110
111 double GetTotalFiringTimeRemaining(double aSimTime) const;
112
113 double GetFiringTimeRemaining() const;
114
115protected:
116 WsfLaserWeapon(const WsfLaserWeapon& aSrc);
117
119 virtual bool BeginShot(double aSimTime);
120
121 virtual bool UpdateShot(double aSimTime);
122
123 virtual bool EndShot(double aSimTime);
124
126 virtual void EvaluateCooling(double aSimTime);
127
128protected:
129 // The laser system's aggregated objects:
131
132 // The state of the laser (see states above).
134
135private:
136 friend class LaserEvent;
137
138 class LaserEvent : public WsfEvent
139 {
140 public:
141 enum EventId
142 {
143 cNONE,
144 cDONE_COOLING,
145 cUPDATE_SHOT,
146 cEND_SHOT,
147 cEVALUATE_COOLING // for thermal system.
148 };
149
150 LaserEvent(double aSimTime, size_t aParentPlatformIndex, WsfLaserWeapon* aWsfLaserWeaponPtr, int aShotId)
151 : WsfEvent(aSimTime)
152 , mWsfLaserWeaponPtr(aWsfLaserWeaponPtr)
153 , mParentPlatformIndex(aParentPlatformIndex)
154 , mEventId(aShotId)
155 , mShotId(aWsfLaserWeaponPtr->mShotId)
156 , mLastEvaluationTime(0.0)
157 {
158 }
159 ~LaserEvent() override = default;
160
161 EventDisposition Execute() override;
162
163 private:
164 WsfLaserWeapon* mWsfLaserWeaponPtr;
165 size_t mParentPlatformIndex;
166 int mEventId;
167 int mShotId;
168 double mLastEvaluationTime;
169 };
170
171 // The thermal management object
172 //(no effect if it is not configured).
173 WsfThermalSystem* mThermalSystemPtr;
174
175 double mFiringTime; // The time that the laser fires per shot.
176 double mTotalFiringTime; // The total possible firing time of a fully-charged system
177 double mLastFiringStartTime;
178 double mLastFiringEndTime;
179 double mFiringUpdateInterval;
180
181 // Thermal System-Related values.
182 double mCoolingUpdateInterval;
183 double mPostCoolingCapacity; //(s)
184 double mEfficiency;
185 double mLowTempLimit;
186 double mHighTempLimit;
187 double mPowerDissipation;
188
189 int mNumberOfShots;
190 int mCurrentShotNumber;
191 int mShotId;
192 double mCoolingTime;
193 double mLastCoolingStartTime;
194 double mLastUpdateTime;
195 WsfStringId mThermalSystemName;
196
197 bool mAtThermalLimit;
198 bool mCommentsEnabled;
199};
200#endif
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
WsfDirectedEnergyWeapon(const WsfScenario &aScenario)
Definition WsfDirectedEnergyWeapon.cpp:26
void CeaseFire(double aSimTime) override
Definition WsfDirectedEnergyWeapon.cpp:319
WsfWeapon * Clone() const override
Definition WsfDirectedEnergyWeapon.hpp:33
virtual bool IsFiring() const
Return whether the weapon is firing for the last updated time.
Definition WsfDirectedEnergyWeapon.cpp:285
FireResult Fire(double aSimTime, const FireTarget &aTarget, const FireOptions &aSettings) override
Definition WsfDirectedEnergyWeapon.cpp:263
Definition WsfEvent.hpp:29
This implementation is decoupled from the weapon class to handle only laser-related effects,...
Definition WsfHighEnergyLaser.hpp:33
const char * GetScriptClassName() const override
Definition WsfImplicitWeapon.cpp:515
void Update(double aSimTime) override
Definition WsfImplicitWeapon.cpp:420
bool Initialize(double aSimTime) override
Definition WsfImplicitWeapon.cpp:62
Definition WsfLaserWeapon.hpp:34
double GetEnergy() const
Return the total energy (i.e., the average irradiance on target integrated over time and area).
Definition WsfLaserWeapon.hpp:96
WsfHighEnergyLaser * GetHEL() const
Return the HEL object associated with energy propagation.
Definition WsfLaserWeapon.hpp:68
State
Definition WsfLaserWeapon.hpp:37
@ cREADY_TO_FIRE
Definition WsfLaserWeapon.hpp:39
@ cFIRING
Definition WsfLaserWeapon.hpp:40
@ cNOT_READY_TO_FIRE
Definition WsfLaserWeapon.hpp:41
@ cSTATE_INVALID
Definition WsfLaserWeapon.hpp:38
@ cPAUSED
The weapon is out of constraints and can't fire.
Definition WsfLaserWeapon.hpp:42
WsfLaserWeapon(WsfScenario &aScenario)
Definition WsfLaserWeapon.cpp:42
double GetEnergyDensity() const
Return the average integrated energy density for the current engagement.
Definition WsfLaserWeapon.hpp:103
WsfHighEnergyLaser * mHEL_Ptr
Definition WsfLaserWeapon.hpp:130
WsfLaserWeapon & operator=(const WsfLaserWeapon &)=delete
int GetState() const
Return the current state of the laser.
Definition WsfLaserWeapon.hpp:86
int mState
Definition WsfLaserWeapon.hpp:133
double GetTotalFiringTime() const
Definition WsfLaserWeapon.hpp:100
double GetPeakFluence() const
Return the peak fluence (i.e., the peak irradiance on target integrated over time).
Definition WsfLaserWeapon.hpp:89
double GetEdgeFluence() const
Definition WsfLaserWeapon.hpp:93
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
Definition WsfWeaponEngagement.hpp:43
bool PreInitialize(double aSimTime) override
Definition WsfWeapon.cpp:171
bool ProcessInput(UtInput &aInput) override
Definition WsfWeapon.cpp:276
WsfWeapon(const WsfScenario &aScenario)
Definition WsfWeapon.cpp:48
bool Initialize2(double aSimTime) override
Definition WsfWeapon.cpp:256
virtual size_t GetTargetIndex(int aId) const
Definition WsfWeapon.hpp:464
virtual double GetQuantityRemaining() const
Definition WsfWeapon.cpp:1014
void TurnOff(double aSimTime) override
Definition WsfWeapon.cpp:446
Copyrights Multiple, All Rights Reserved