WSF
BrawlerPlatform.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 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// Updated by Infoscitex, a DCS Company
13// ****************************************************************************
14
15#ifndef BRAWLERPLATFORM_HPP
16#define BRAWLERPLATFORM_HPP
17
18#include "brawler_export.h"
19
20#include "BrawlerMIND.hpp"
21#include "BrawlerUtil.hpp"
22#include "UtEntity.hpp"
23#include "UtFortMat3.hpp"
24#include "UtMatrix.hpp"
25#include "UtRandom.hpp"
26#include "UtVec3.hpp"
27
28/******************************************************************************
29 * OOP representation of a Brawler aircraft.
30 *
31 * all units in:
32 * feet/ nmi
33 * deg
34 * NED
35 * ECS
36 *
37 * Has a UtEntity to maintain "Brawler state"
38 *
39 ******************************************************************************/
40class BRAWLER_EXPORT BrawlerPlatform
41{
42public:
43 // force inheritance? have pure abstract methods?
47 virtual ~BrawlerPlatform() = default;
48 void Init(UtEntity& state, ut::Random& random);
49 // virtual void Update(float aSimTime);
50 virtual double GetTime() = 0;
51
52 virtual double MindUpdate(double aSimTime);
53
54 // replicates valsti() and lines 552-587 of aeva3i()
55 // called before any alternative evaluations for current update
56 virtual void InitializeStatistics();
57 // replicates valst()
58 // called after each alternative evaluation for the current update
59 virtual void UpdateStatistics(double value);
60 // replicates valsth()
61 // called after all alternative evaluations for current update
62 virtual void CalculateStatistics();
63 // replicates adj_tnl_mlt()
65
66 UtVec3d PositionNED();
67 // UtVec3d PositionECS(); //would always be (0,0,0)
68 UtVec3d VelocityNED();
69 UtVec3d VelocityECS();
70 UtVec3d AccelerationNED();
71 UtVec3d AccelerationECS();
72 UtVec3d OrientationNED();
73
74 double GetSpeed(); // ft/s
75 double GetAlpha();
76
77 UtVec3d RelativePositionNED(UtEntity& aTgt);
78 UtVec3d RelativeVelocityNED(UtEntity& aTgt);
79 UtVec3d RelativePositionECS(UtEntity& aTgt);
80 UtVec3d RelativeVelocityECS(UtEntity& aTgt);
81
82 // TODO - move any NED conversion functionality to BrawlerCoordinateConversion
83 UtVec3d ConvertNEDtoECS(UtVec3d ned); // this function needs its own mutable copy of 'ned', just pass by value
84 UtVec3d ConvertNEDtoWind(UtVec3d ned); // this function needs its own mutable copy of 'ned', just pass by value
85 UtVec3d ConvertECStoNED(UtVec3d ecs); // this function needs its own mutable copy of 'ecs', just pass by value
86 UtVec3d ConvertECStoWind(UtVec3d ecs); // this function needs its own mutable copy of 'ecs', just pass by value
87 UtVec3d ConvertWindtoNED(UtVec3d wind); // this function needs its own mutable copy of 'wind', just pass by value
88 UtVec3d ConvertWindtoECS(UtVec3d wind); // this function needs its own mutable copy of 'wind', just pass by value
89
90 UtFortMat3d GetNEDToECSRotation();
91
92 static UtVec3d PositionNED(UtEntity& aTgt);
93 // static UtVec3d PositionECS(UtEntity&); //would always be (0,0,0)
94 static UtVec3d VelocityNED(UtEntity& aTgt);
95 static UtVec3d VelocityECS(UtEntity& aTgt);
96 static UtVec3d AccelerationNED(UtEntity& aTgt);
97 static UtVec3d AccelerationECS(UtEntity& aTgt);
98
99 static UtVec3d RelativePositionNED(UtEntity& ref, UtEntity& aTgt);
100 static UtVec3d RelativeVelocityNED(UtEntity& ref, UtEntity& aTgt);
101 static UtVec3d RelativePositionECS(UtEntity& ref, UtEntity& aTgt);
102 static UtVec3d RelativeVelocityECS(UtEntity& ref, UtEntity& aTgt);
103
104 // TODO - move any NED conversion functionality to BrawlerCoordinateConversion
105 static UtVec3d ConvertNEDtoLLA(UtVec3d ned);
106 static UtVec3d ConvertNEDtoECS(UtEntity& ref, UtVec3d ned);
107 static UtVec3d ConvertNEDtoWind(UtEntity& ref, UtVec3d ned);
108 static UtVec3d ConvertECStoNED(UtEntity& ref, UtVec3d ecs);
109 static UtVec3d ConvertECStoWind(UtEntity& ref, UtVec3d ecs);
110 static UtVec3d ConvertWindtoNED(UtEntity& ref, UtVec3d wind);
111 static UtVec3d ConvertWindtoECS(UtEntity& ref, UtVec3d wind);
112
113 static double GetSpeed(UtEntity& aRef);
114 static double GetAlpha(UtEntity& aRef);
115
116 // double SlantRange(WsfTrack* aTgt, double defaultRange = 1000000 / ftnmi);
117 double SlantRange(UtEntity& aTgt, double defaultRange = 1000000 / BRAWLER::ftnmi);
118
119 virtual UtEntity* GetTarget() = 0;
120 virtual double FirstObservedTime(UtEntity* aTgt)
121 {
122 return 0;
123 } // replaces "fstobs", returns -1 if not currently observed
124
125 // return largest threat [missile] track
126 virtual UtEntity* GetThreat() = 0;
127 virtual int GetNumberThreats() { return 0; }
128
129 UtEntity& State() { return mMyState; }
130 void SetState(UtEntity& state) { mMyState = state; }
131
132 UtEntity& NominalState() { return mMyNom; }
133 void SetNominalState(UtEntity& state) { mMyNom = state; }
134
135 UtEntity& ProjectedState() { return mMyPro; }
136 void SetProjectedState(UtEntity& state) { mMyPro = state; }
137
138 UtEntity& TargetNominalState() { return mTgNom; }
139 void SetTargetNominalState(UtEntity& state) { mTgNom = state; }
140
141 virtual double GetConsciousnessEventTime() { return 1.0; }
142 virtual double LastConsciousnessEventTime() { return 0.0; }
143
144 // just use class a storehouse for these values? (set from script behaviors?)
145 // what are enumerations of each value???
146 virtual void SetAlternative(int ilevel, int kalt, int icall,
147 int lcall); // replaces use of "altupk(altdsc,...)"
148
149 virtual void GetAlternative(int& ilevel, int& kalt, int& icall,
150 int& lcall); // replaces use of "indupk(altdsc,...)"
151
154
155 // brawler aero command type 1
156 virtual double EvaluateRates(UtVec3d& aAngularRates, // radian/sec
157 UtVec3d& aLongitudinalAccel) = 0; // meter/sec^2
158 // brawler aero command type 2
159 virtual double EvaluateHeadingSpeedAltitude(const double& aHeading, // degrees
160 const double& aSpeed, // meters/sec
161 const double& aAltitude, // meters
162 const double& aMaxGees, // Gs
163 const double& aMaxClimb) = 0; // meters/sec
164 // brawler aero command type 3
165 virtual double EvaluateTurnInPlaneWithSpeed(UtVec3d& aPlane, // World coordinates, meters
166 const double& aGees, // Meters/sec^2
167 const double& aSpeed) = 0; // meters/sec
168 virtual double EvaluateTurnInPlaneWithThrottle(UtVec3d& aPlane, // World coordinates, meters
169 const double& aGees, // Meters/sec^2
170 const double& aThrottle) = 0; // meters/sec
171 // brawler aero command type 4
172 virtual double EvaluateVectorWithSpeed(UtVec3d& aVelocityVector, // Directional unit vector
173 const double& aMaxGees, // Gs
174 const double& aSpeed) = 0; // meters/sec
175 virtual double EvaluateVectorWithThrottle(UtVec3d& aVelocityVector, // Directional unit vector
176 const double& aMaxGees, // Gs
177 const double& aThrottle) = 0; //[0,3]
178
180 double ManeuverValueComponent(BRAWLER::ManeuverValueComponentType aType) { return valcmp[(int)aType - 1]; }
182 {
183 valcmp[(int)aType - 1] = value;
184 }
185
186 double RawManeuverValueComponent(BRAWLER::ManeuverValueComponentType aType) { return rawvalcmp[(int)aType - 1]; }
188 {
189 rawvalcmp[(int)aType - 1] = value;
190 }
191
192 double MinAlternativeValue() { return altval_min; }
193 void SetMinAlternativeValue(double val) { altval_min = val; }
194
197 // replaces "tnl_mult"
198 double TunnelVisionMultiplier(BRAWLER::ManeuverValueComponentType aType) { return tnl_mult[(int)aType - 1]; }
199
210
211
214 // section: small brawler computation methods that get replaced //////////
215 // FORMERLY PRIVATE - need access for scripts
216 bool SlowFlight(); // replaces "slow" from aeva3i and getslo()
217 double OffensiveMultiplier(); // replaces use of "offmus" and "offmlt", Set to "ATTACK" mode for now
218 double DefensiveMultiplier(); // replaces use of "defmus" and "defmlt"
219 bool BoreSight(); // replaces borsit() from borsit.f
220 // double OffBoreSightAngle(WsfPlatform* aRef, WsfPlatform* aTgt); //replaces use of "obang" set in obangs() called
221 // from minud/majud
222 double OffBoreSightAngle(UtEntity& aRef,
223 UtEntity& aTgt); // replaces use of "obang" set in obangs() called from minud/majud
224 double ProjectedTimeDelta(); // replaces use of "tproj3" - see modsel.f
225
226 double RollOverTopValue() { return valrot; }
227 void SetRollOverTopValue(double val) { valrot = val; }
228
229 double RollOverTopTime() { return timrot; }
230 void SetRollOverTopTime(double val) { timrot = val; }
231
232 BRAWLER::MissileModeState MissileMode() { return mMissileMode; }
233 void SetMissileMode(BRAWLER::MissileModeState mode) { mMissileMode = mode; }
234
235 UtVec3d EvasionDirection() { return mEvasionDirection; }
236 void SetEvasionDirection(UtVec3d dir) { mEvasionDirection = dir; }
237
238 double LastComputedEngagementValue(UtEntity& aTgt); // replaces use of "valeff"
239
240 double DegreeOfThreat(UtEntity& aTgt); // replaces use of "semmsl" or "mislse[]"
241 double DegreeOfThreatCompliment(UtEntity& aTgt) { return (1.0 - DegreeOfThreat(aTgt)); } // replaces use of "csmmsl"
242
243 // vec = directional unit vector, sflypp = ft/s
244 void SuggestVectoredFlight(UtVec3d vec, double val, double spd)
245 {
246 vecfpp = vec;
247 valfpp = val;
248 sflypp = spd;
249 }
250 UtVec3d DirectionVectoredFlight() { return vecfpp; } // directional unit vector
251 double ValueVectoredFlight() { return valfpp; }
252 double SpeedVectoredFlight() { return sflypp; } // ft/s
253
254 // bool DisEngage(); //replace "diseng" and evdisi()
255
256 bool Damaged(UtEntity& aRef); // replace use of "int damage[mac]"
257
258 double TargetAngleAboveHorizon(UtEntity& aTgt); // replaces "ppmohr" - used in mslenv.f (ovrhor)
259 virtual double SensorGimbalElevationLimit() = 0; // replaces "relmx"
260 virtual double SensorGimbalAzimuthLimit() = 0; // replaces "razmx"
261 double WeaponSimTimeOfIntercept(UtEntity& aThreat); // replaces "mislta" computed in as1tgt.f
262
263 double WeaponMinEnvelopeRange() { return 3000.0; } // replaces use of "ppmrmn" - computed mslenv.f (rmin) (MSLI.MSL)
264 double WeaponMaxEnvelopeRange() { return 45000.0; } // replaces use of "ppmrmx" - computed mslenv.f (rmax) (MSLI.MSL)
266 {
267 return BRAWLER::kndsrm;
268 } // replaces use of "ppmknd" //weapon type selected (assume missiles for now -> set to 1 (short range [aim-9] missile))
269 bool WeaponSeekerOnWhenFired() { return true; } // replace use of "on_at_lnch(i,plnch(mode)" //IR SEEKER ON AT LAUNCH
270 // bool WeaponSeekerType(BRAWLER::WeaponSeekerType aType) { return (aType == irskr); } //replaces use of "pp_skrs"
271 // //LBM - force to IR seeker for now
272 bool WeaponVerticalTrackCheck(UtEntity& aTgt); // replaces "ppmtrk" (envlvl_aim) (target above horizon or missile can
273 // track looking down)
274 // bool CommandGuidedWeapon() { return false; } //replaces use of "pp_comg"
275 double WeaponSteeringError(UtEntity& aTgt); // replaces use of "ppmse" - computed in mslenv.f (se) --> envgeo.f (se)
277 {
278 return 0.7;
279 } // replaces "ztamx" (units radians) //LBM - hard coded to: MSLI.MSL "ZTAMX" value
280
281 double RangeRate(UtEntity& aRef, UtEntity& aTgt); // replaces use of "rdotpr"
282 double ExpectedValueDestroyed(UtEntity& aRef, UtEntity& aTgt); // replaces "vkexp" calculated in majud.f
283 double ProbabilitySeen(UtEntity& looker, UtEntity& seen); // replaces "pseen" from pbseen.f
284 double ProbabilityOfSurvival(UtEntity& aRef, UtEntity* aTgt); // replaces "psrv" or "psrvfl" calculated in majud.f
285 double ProbabilityOfKill(UtEntity& killer, UtEntity& victim); // replaces "pkil"
286 double ForceRatio() { return fratio; }
287
290 virtual void UpdateMissileMode() = 0;
291
294 // section: brawler values from user input ///////////////////////////////
295
296 BrawlerMIND* GetMIND() { return &mMIND; }
297
302 double RangePercent(BRAWLER::WeaponType aType) { return 0.95; }
303
313 double AircraftValue(UtEntity& aRef) { return 10.0; } // replace valint[] for now as well
314
325 double CombatEffectiveness(UtEntity& aRef) { return cmbeff; }
326
332 double FlightAggressiveness() { return aggfac; }
333
340 double MaxWeaponSteeringError() { return 0.4; } // read from input file
341
348 double MaxWeaponAspectOffsetAngle() { return 3.0; } // read from input file (MSLI.MSL)
349
353 bool LookDownShootCapable() { return true; } // read from input file
354
357
358 virtual bool HaveWeapons();
359 bool Skip1v1();
360 bool NoAim();
361 bool InIntercept();
362 bool Ready();
363 bool OneVsOneOp();
364
365 double TimeAllowedPerSectorSearch() { return mTimeAllowedPerSectorSearch; }
366 void SetTimeAllowedPerSectorSearch(double val) { mTimeAllowedPerSectorSearch = val; }
367
368 static UtVec3d a_lim(const UtVec3d& x_in, const UtVec3d& v_in, const UtVec3d& a_in, double dt, double min_speed);
369
370 static void projw(const UtVec3d& xin,
371 const UtVec3d& vin,
372 const UtVec3d& a,
373 double dt,
374 UtVec3d& xout,
375 UtVec3d& vout,
376 UtVec3d& aout,
377 UtFortMat3d& rwout);
378
379 UtVec3d GetTargetRoutePoint() { return rtepp; };
380
381 void SetTargetRoutepointLLA(int aLat, int aLon, int aAlt_m);
382 void SetTargetRoutepointLLA(UtVec3d aLLA);
383
384
385 double Uniform() { return rnsq.Uniform<double>(); }
386
388 // VIRTUAL AERO QUERIES
389 //
390 // TODO - check if all (or which ones) are in body/wind axes
391 // TODO - check where intelligent lookups of "best" values are taking place
392 // (e.g. best alpha for sustained Gs)
393
394 // Forward Acceleration Functions
395 // This provides the maximum acceleration in the body-x direction. It includes use of afterburner (if available)
396 // and assumes that side-slip (beta) is negligible. It does not include any gravity effects.
397 // See perfrm.f 163, "almaxg"
398 virtual double MaxForwardAcceleration_fps2() = 0;
399
400 // This provides the minimum acceleration in the body-x direction. It assumes a fully retarded throttle control
401 // and full use of speed brakes (if available). It assumes that sideslip (beta) is negligible and does not include
402 // any gravity effects.
403 // See perfrm.f 166, "alming"
404 virtual double MinForwardAcceleration_fps2() = 0;
405
406 // This is the same as double MaxForwardAcceleration_fps2() but it includes the effect of gravity. Thus, for an
407 // aircraft in level flight, MaxForwardAccelerationWithGravity_fps2() will produce the same value as
408 // MaxForwardAcceleration_fps2(). For an climbing aircraft MaxForwardAccelerationWithGravity_fps2() will be less
409 // and for a diving aircraft it will be more than MaxForwardAcceleration_fps2().
410 // See perfrm.f 165, "almax"
411 // Ref: GravityWindAxis[0] + ((MaxGrossThrustBodyAxis - MagnitudeOfDrag - PropulsionDragAtMaxGrossThrustBodyAxis) / AirCraftMass)
413
414 // This is the same as MinForwardAcceleration_fps2() but it includes the effect of gravity. Thus, for an aircraft
415 // in level flight, MinForwardAccelerationWithGravity_fps2() will produce the same value as
416 // MinForwardAcceleration_fps2(). For an climbing aircraft MinForwardAccelerationWithGravity_fps2() will be less
417 // and for a diving aircraft it will be more than MinForwardAcceleration_fps2().
418 // See perfrm.f 167, "almin"
420
421 // Maximum Performance Turn Functions
422
423 // TODO - verify proper use of this method and the MaxLimitedInstantaneousGLoad_g() method
424 // This provides the maximum instantaneous g-load when performing a maximum performance turn. When performing this
425 // turn, the platform may not be able to maintain its speed.
426 // replaces gliftm() (only aero considered)
427 // Lift = DynamicPressure * SurfaceArea * CoefficientLiftMax / Weight
428 // TODO - verify which axes (wind axes right?)
429 virtual double MaxInstantaneousGLoad_g() = 0;
430
431 // This provides the minimum instantaneous turn radius when performing a maximum performance turn. When performing
432 // this turn, the platform may not be able to maintain its speed.
433 // Replaces "radmin"
434 virtual double MinInstantaneousTurnRadius_ft() = 0;
435
436 // This provides the maximum instantaneous turn rate when performing a maximum performance turn. When performing
437 // this turn, the platform may not be able to maintain its speed.
438 // Replaces use of "wmax" perfrm.f: max_ang_rate = gmxsu*grav/spdnow(me)
439 virtual double MaxInstantaneousTurnRate_rps() = 0;
440
441 // This provides the maximum sustained g-load when performing a maximum performance turn. When performing this
442 // turn, the platform will be able to maintain its speed if it uses full power (including afterburner if available).
443 // This function uses iterative methods to arrive at a solution.
444 // This replaces "gmxsut" and is based on susgmx = (liftLbs+thrust*sin(alfa))/weightLbs
445 virtual double MaxSustainedGLoad_g() = 0;
446
447 // This provides the minimum sustained turn radius when performing a maximum performance turn. When performing this
448 // turn, the platform will be able to maintain its speed if it uses full power (including afterburner if available).
449 // This function uses MaxSustainedGLoad_g() to arrive at a solution.
450 virtual double MinSustainedTurnRadius_ft() = 0;
451
452 // This provides the maximum instantaneous turn rate when performing a maximum performance turn. When performing
453 // this turn, the platform will be able to maintain its speed if it uses full power (including afterburner if
454 // available). This function uses MaxSustainedGLoad_g() to arrive at a solution.
455 virtual double MaxSustainedTurnRate_rps() = 0;
456
457 // Comfortable Turn Functions
458
459 // This provides the g-load when performing a "tactical turn".
460 // Under certain [safe] conditions this takes the value of MaxSustainedGLoad_g()
461 // Under more threatening conditions this takes the value of MaxInstantaneousGLoad_g()
462 // Replaces "gmxsu" - conditionally switches between either:
463 // MaxSustainedGLoad_g() or MaxInstantaneousGLoad_g()
464 virtual double MaxTacticalGLoad_g() = 0;
465
466 // This provides the minimum turn radius when performing a "tactical turn" (using gmxsu).
467 // calculation based off of the current MaxTacticalGLoad_g()
468 // Replaces "radmnp", set in perfrm: = fmachp*fmachp*vsme*vsme/(gmxsu*grav)
469 virtual double MinTacticalTurnRadius_ft() = 0;
470
471 // This provides the maximum turn rate when performing a "tactical turn".
472 // calculation based off of the current MaxTacticalGLoad_g()
473 virtual double MaxTacticalTurnRate_rps() = 0;
474
475 // Misc Performance Calculations
476
477 // This provides the best "corning speed", meaning the speed at which the highest turn rate can be achieved at
478 // the current altitude.
479 // This function uses iterative methods to arrive at a solution. The iterations stop after 10 passes or when the
480 // cornering speed bounds are within 0.01 mach of each other (approximately 10 ft/sec).
481 // Replaces use of "cornrv" calculated in perfrm.f by corner(), which searches for
482 // velocity between mach [0.1, 1.0] at current altitude that gives max possible turn rate.
483 // MaxTurnRate = sqrt( gl * gl - 1.0) / CornerVelocity where: gl = MaximumAvailableLift_g()
484 virtual double CorneringVelocity_fps() = 0;
485
486 // This provides *************************************
487 // replaces use of "erate" aproj3.f erate = (accel-gravVec[0])*speed)/grav
488 virtual double SpecificEnergyRate_fps() = 0;
489
490 // This provides *************************************
491 virtual double CalcTurnRate_rps(const double& aClMax,
492 const double& aSpeed_fps,
493 const double& aDynamicPressure_psf,
494 const double& aWingArea_ft2) = 0;
495
496 // Weights
497
498 // This returns the current gross weight of the platform, including fuel and weapons.
499 virtual double CurrentWeight_lbs() = 0;
500
501 // This returns the empty weight of the platform. It is a constant for a given type of platform.
502 virtual double EmptyWeight_lbs() = 0;
503
504 // This returns the current fuel weight of the platform
505 virtual double CurrentFuelWeight_lbs() = 0;
506
507 // This returns the design weight for performing a max-g (maximum performance) turn. If the aircraft is at a
508 // higher weight, it may not pull as many g's without over-stressing the airframe.
509 // This replaces use of "miss_mass" in Brawler.
510 virtual double DesignWeightForMaxG_lbs() = 0;
511
512 // Structural Limits
513
514 // This returns the structural g-limit for the airframe at its current weight. It is the maximum g's the aircraft
515 // can pull, at the current weight, without over-stressing the airframe.
516 // replaces table lookup of "gcap".
517 virtual double CurrentStructuralGLimit_g() = 0;
518
519 // This returns the structural g-limit for the airframe at the weight specified in DesignWeightForMaxG_lbs(). It
520 // is the maximum g's the aircraft can pull, at the design weight, without over-stressing the airframe.
521 // replaces table lookup of "gcap2".
523
524 // This returns the structure g-limit for the airframe when its weight is above the design limit. This is a
525 // reduced, "general value", and does not take into account the actual current platform weight.
527
528 // Data Functions
529
530 // This provides the current dynamic pressure for the platform.
531 virtual double DynamicPressure_psf() = 0;
532
533 // This provides the current mach for the platform.
534 virtual double Mach() = 0;
535
536 // This provides the maximum lift coefficient for the platform at the current conditions of mach and altitude.
537 virtual double GetMaxCL() = 0;
538
539 // This provides the maximum lift coefficient for the platform at the specified mach.
540 virtual double GetMaxCL(const double& aMach) = 0;
541
542 // This provides the maximum lift coefficient for the platform at the specified altitude and mach.
543 virtual double GetMaxCL(const double& aAlt_ft, const double& aMach) = 0;
544
545 // This provides the angle of attack (alpha) at maximum lift coefficient for the platform at the current conditions
546 // of mach and altitude.
547 virtual double GetAlphaAtMaxCL_deg() = 0;
548
549 // This provides the angle of attack (alpha) at maximum lift coefficient for the platform at the specified mach.
550 virtual double GetAlphaAtMaxCL_deg(const double& aMach) = 0;
551
552 // This provides the angle of attack (alpha) at maximum lift coefficient for the platform at the specified mach.
553 virtual double GetAlphaAtMaxCL_deg(const double& aAlt_ft, const double& aMach) = 0;
554
555 // ###########################################################################################
556
557 // TODO - verify proper use of this method and the MaxInstantaneousGLoad_g() method
558 // This provides the maximum instantaneous g-load when performing a maximum performance turn. When performing this
559 // turn, the platform may not be able to maintain its speed. NOTE: Limited by structural G limits.
560 // replaces "gmxin" and "gldmx()" (aero + structural limits considered)
561 virtual double MaxLimitedInstantaneousGLoad_g();
562
563 // returns ft/sec^2 version of: MaxLimitedInstantaneousGLoad_g().
564 // replace use of "amxin", (perfrm.f 105)
566
567 // Comments near where this function is used pertain to "LOS RATE". So, is this a turn rate?
568 // If so, the new function would be MaxInstantaneousTurnRate_rps().
569 // However, if it does pertain to line-of-sight rate, we currently lack any suitable replacement.
570 // replaces use of "wmax" perfrm.f: max_ang_rate = gmxsu*grav/spdnow(me)
571 virtual double MaxAngularRate_rps() = 0;
572
573 // Set this platform's job
574 void SetJob(BRAWLER::JobType aJob) { mMyJob = aJob; }
575
576 // Set this platform's mission
577 void SetMission(BRAWLER::MissionType aMission) { mMission = aMission; }
578
579 // Return this platform's job, as specified by the job type enum
580 BRAWLER::JobType Job() { return mMyJob; }
581
582 // Return this platform's mission, as specified by the mission type enum
583 BRAWLER::MissionType Mission() { return mMission; }
584
585 // Get this platforms route point value multiplier
586 double RoutePointValueMultiplier() { return vmsnpp; }
587
588 void SetFlightAggressiveness(double aFactor);
589 void SetCombatEffectiveness(double aEffect);
590 void SetForceRatio(double aRatio);
591
592 // TODO - PRBDAS accessor functions
593
594protected:
595 // TODO - override all position/orientation calls in UtEntity that return a value with units
596 // example: GetSpeed() should return brawler ft/sec (not wsf met/sec)
597
598 // nominal state (projected state forward) used for nominal queries
599 UtEntity mMyState; // my current (truth) state
600 UtEntity mMyNom; // my nominal state (simple projection)
601 UtEntity mTgNom; // target nominal state (simple projection)
602 UtEntity mMyPro; // maneuver projected state
603
604 void NominalProjection(double dt); // similar to svpred.f
605
606private:
607 BrawlerMIND mMIND;
608
611 double mTimeAllowedPerSectorSearch;
612
614 BRAWLER::MissileModeState mMissileMode;
615
617 int milevel;
618 int mkalt;
619 int micall;
620 int mlcall;
621
626 // bool skip_1v1;
627 bool tnl_reset;
628 double tnl_p_reset;
629 double pdraw;
631
632 double aggfac;
633 double cmbeff;
634 double fratio;
635
636 // LBM - miscellaneous values
637 // bool l1opp;// = true; //C --L1OPP IS TRUE IF A GENUINE 1V1 SITUATION EXISTS
638 // bool noaim;
639 // bool wepons;
640 // bool intrst;
641 // bool ready;
642 // bool lillum;
643 // bool diseng; //set by evdisi() in evdis.f called from aeva3i() in aeval3.f
644 // int ppmknd; //weapon type selected (assume missiles for now -> set to 1 (short range missile))
645 // set by selwpf() called from selwpn()
646
647 double valrot; //= 0.0;
648 double timrot; //= 0.0;
649
650 double tseen; //=0
651
652 int nalt;
653
654 // valhst.fi
655#define nvcp_used 20
656#define nvalcp 20
657 double vofutl; //[mac]
658 double vavutl; //[mac]
659 double valbar[20]; //[nvalcp]
660 int iacoff;
661 int mslmod;
662 double altval_min;
663 double s_w;
664 double s_v[20]; //[nvalcp]
665 double s_wv[20]; //[nvalcp]
666 double s_vv[20]; //[nvalcp]
667 double s_wvv[20]; //[nvalcp]
668
669 double rawvalcmp[20]; // holds all raw maneuver value components (no scaling or modifications)
670 // union {
671 double valcmp[20]; // holds all maneuver value components (no union)
672 // struct {
673 // double voffef; //offensive evaluation
674 // double vlospd; //low speed recovery evaluation
675 // double vform; //station keeping (formation)
676 // double compr; //route-point
677 // double valdfx; //defensive evaluation //VALDFX IS THE PROBABILITY OF SURVIVING FOR EACH HOSTILE IN THE LOCAL CELL
678 // CONVERTED TO THE NEGATIVE UTILITY OF NOT SURVIVING IN THE LOCAL CELL. double gaval; //ground avoidance double
679 // vvec; //vector following double villum; //illumination evaluation double vmusup; //mutual support double valevd;
680 // //evade evaluation double vmaim; //missile aiming evaluation double vdisng; //disengage evaluation double sepval;
681 // //separation double vescrt; //escort bomber double vsamz; //SAM avoidance double vavbdd; //bad aspect avoidance
682 // evaluation double hddval; //hard-deck double terrval; //terrain double vdew; //directed energy weapon
683 // double vtpt; //third part targeting
684 // };
685 // };
686
687 // mind2.fi
688 bool tnl_vis;
689 double tnl_mult[nvalcp];
690
691 // double tdseng;
692 // bool desdis; //= false; //LBM - set to "ATTACK" mode for now
693 // bool disbng;
694
695 // mindpr.fi
696 bool prbdas;
697
698
699 // ppost.fi
700 UtVec3d vecfpp;
701 double valfpp;
702 double sflypp;
703
704 // UtTable::Curve* mCLMaxVsMachTable;
705 // UtTable::Curve* mAlphaAtCLMaxVsMachTable;
706 double mDesignWeightForMaxG_lbs;
707 double mStructuralGLimit_g;
708 double mStructuralGLimitAboveDesignWeight_g;
709 double mSpeedbrakeCDA_sqft;
710
711 UtVec3d mEvasionDirection;
712
713 // typical brawler units:
714 // position = feet
715 // velocity = feet/sec
716 // accel = feet/sec^2
717 // weight = pounds
718 // lift = sometimes: Gs, other times: feet/sec^2
720
721 ut::Random rnsq;
722
723 BRAWLER::JobType mMyJob; // myjob
724 BRAWLER::MissionType mMission; // misn
725
726 double vmsnpp;
727
728 UtVec3d rtepp;
729};
730
731#endif
#define nvalcp
Definition BrawlerPlatform.hpp:656
Definition BrawlerMIND.hpp:26
virtual void UpdateMissileMode()=0
void SetRollOverTopTime(double val)
Definition BrawlerPlatform.hpp:230
double GetSpeed()
Definition BrawlerPlatform.cpp:550
virtual double SpecificEnergyRate_fps()=0
double TunnelVisionMultiplier(BRAWLER::ManeuverValueComponentType aType)
Definition BrawlerPlatform.hpp:198
virtual double MinSustainedTurnRadius_ft()=0
double RollOverTopTime()
Definition BrawlerPlatform.hpp:229
UtEntity mMyNom
Definition BrawlerPlatform.hpp:600
virtual double MaxInstantaneousGLoad_g()=0
UtVec3d VelocityECS()
Definition BrawlerPlatform.cpp:530
bool LookDownShootCapable()
Definition BrawlerPlatform.hpp:353
UtEntity mTgNom
Definition BrawlerPlatform.hpp:601
UtEntity & NominalState()
Definition BrawlerPlatform.hpp:132
virtual double CurrentStructuralGLimit_g()=0
UtVec3d ConvertWindtoNED(UtVec3d wind)
Definition BrawlerPlatform.cpp:600
virtual double GetMaxCL(const double &aAlt_ft, const double &aMach)=0
UtVec3d ConvertNEDtoECS(UtVec3d ned)
Definition BrawlerPlatform.cpp:580
void Init(UtEntity &state, ut::Random &random)
Definition BrawlerPlatform.cpp:157
BrawlerPlatform & operator=(const BrawlerPlatform &)=delete
UtFortMat3d GetNEDToECSRotation()
Definition BrawlerPlatform.cpp:610
void AdjustTunnelVisionMultipliers()
Definition BrawlerPlatform.cpp:451
double WeaponSeekerMaxAngle()
Definition BrawlerPlatform.hpp:276
virtual double EvaluateRates(UtVec3d &aAngularRates, UtVec3d &aLongitudinalAccel)=0
virtual double MaxLimitedInstantaneousGLoad_g()
Definition BrawlerPlatform.cpp:2621
BrawlerPlatform()
Definition BrawlerPlatform.cpp:29
double SpeedVectoredFlight()
Definition BrawlerPlatform.hpp:252
double DegreeOfThreat(UtEntity &aTgt)
Definition BrawlerPlatform.cpp:1108
void SuggestVectoredFlight(UtVec3d vec, double val, double spd)
Definition BrawlerPlatform.hpp:244
UtVec3d RelativeVelocityECS(UtEntity &aTgt)
Definition BrawlerPlatform.cpp:575
virtual double CurrentWeight_lbs()=0
double AircraftValue(UtEntity &aRef)
Definition BrawlerPlatform.hpp:313
virtual double Mach()=0
void SetTimeAllowedPerSectorSearch(double val)
Definition BrawlerPlatform.hpp:366
void SetMinAlternativeValue(double val)
Definition BrawlerPlatform.hpp:193
virtual double CalcTurnRate_rps(const double &aClMax, const double &aSpeed_fps, const double &aDynamicPressure_psf, const double &aWingArea_ft2)=0
BRAWLER::JobType Job()
Definition BrawlerPlatform.hpp:580
UtVec3d ConvertNEDtoWind(UtVec3d ned)
Definition BrawlerPlatform.cpp:585
void SetJob(BRAWLER::JobType aJob)
Definition BrawlerPlatform.hpp:574
virtual double MaxForwardAcceleration_fps2()=0
double MinAlternativeValue()
Definition BrawlerPlatform.hpp:192
virtual double MaxAngularRate_rps()=0
UtVec3d AccelerationNED()
Definition BrawlerPlatform.cpp:535
UtVec3d ConvertWindtoECS(UtVec3d wind)
Definition BrawlerPlatform.cpp:605
virtual double StructuralGLimitAtDesignWeight_g()=0
virtual double MaxSustainedGLoad_g()=0
double MaxWeaponAspectOffsetAngle()
Definition BrawlerPlatform.hpp:348
UtVec3d ConvertECStoWind(UtVec3d ecs)
Definition BrawlerPlatform.cpp:595
void SetMissileMode(BRAWLER::MissileModeState mode)
Definition BrawlerPlatform.hpp:233
virtual double SensorGimbalElevationLimit()=0
virtual UtEntity * GetThreat()=0
virtual double MaxTacticalGLoad_g()=0
virtual void InitializeStatistics()
Definition BrawlerPlatform.cpp:206
UtVec3d DirectionVectoredFlight()
Definition BrawlerPlatform.hpp:250
double ValueVectoredFlight()
Definition BrawlerPlatform.hpp:251
double WeaponMinEnvelopeRange()
Definition BrawlerPlatform.hpp:263
virtual void CalculateStatistics()
Definition BrawlerPlatform.cpp:342
BRAWLER::MissionType Mission()
Definition BrawlerPlatform.hpp:583
UtVec3d VelocityNED()
Definition BrawlerPlatform.cpp:525
double InherentBiasFaults(BRAWLER::InherentBiasFaultTypes aType)
Definition BrawlerPlatform.hpp:209
double CombatEffectiveness(UtEntity &aRef)
Definition BrawlerPlatform.hpp:325
virtual double EmptyWeight_lbs()=0
double FlightAggressiveness()
Definition BrawlerPlatform.hpp:332
virtual double CurrentFuelWeight_lbs()=0
virtual double GetTime()=0
virtual double GetAlphaAtMaxCL_deg()=0
virtual double DesignWeightForMaxG_lbs()=0
UtVec3d RelativePositionECS(UtEntity &aTgt)
Definition BrawlerPlatform.cpp:570
UtVec3d GetTargetRoutePoint()
Definition BrawlerPlatform.hpp:379
virtual double GetMaxCL()=0
BrawlerMIND * GetMIND()
Definition BrawlerPlatform.hpp:296
virtual double EvaluateVectorWithSpeed(UtVec3d &aVelocityVector, const double &aMaxGees, const double &aSpeed)=0
void SetRollOverTopValue(double val)
Definition BrawlerPlatform.hpp:227
virtual double DynamicPressure_psf()=0
UtVec3d RelativeVelocityNED(UtEntity &aTgt)
Definition BrawlerPlatform.cpp:565
UtEntity & State()
Definition BrawlerPlatform.hpp:129
void SetEvasionDirection(UtVec3d dir)
Definition BrawlerPlatform.hpp:236
virtual double CorneringVelocity_fps()=0
double MaximumInstantaneousLift_fps2()
Definition BrawlerPlatform.hpp:565
double RoutePointValueMultiplier()
Definition BrawlerPlatform.hpp:586
void SetProjectedState(UtEntity &state)
Definition BrawlerPlatform.hpp:136
virtual double GetMaxCL(const double &aMach)=0
virtual double EvaluateVectorWithThrottle(UtVec3d &aVelocityVector, const double &aMaxGees, const double &aThrottle)=0
virtual double MaxSustainedTurnRate_rps()=0
void SetNominalState(UtEntity &state)
Definition BrawlerPlatform.hpp:133
void NominalProjection(double dt)
Definition BrawlerPlatform.cpp:2266
double MaxWeaponSteeringError()
Definition BrawlerPlatform.hpp:340
double Uniform()
Definition BrawlerPlatform.hpp:385
double WeaponSimTimeOfIntercept(UtEntity &aThreat)
Definition BrawlerPlatform.cpp:1270
void SetRawManeuverValueComponent(BRAWLER::ManeuverValueComponentType aType, double value)
Definition BrawlerPlatform.hpp:187
double GetAlpha()
Definition BrawlerPlatform.cpp:555
virtual double EvaluateTurnInPlaneWithThrottle(UtVec3d &aPlane, const double &aGees, const double &aThrottle)=0
UtEntity & TargetNominalState()
Definition BrawlerPlatform.hpp:138
BRAWLER::MissileModeState MissileMode()
Definition BrawlerPlatform.hpp:232
virtual double FirstObservedTime(UtEntity *aTgt)
Definition BrawlerPlatform.hpp:120
BRAWLER::WeaponType WeaponType()
Definition BrawlerPlatform.hpp:265
virtual double MinForwardAccelerationWithGravity_fps2()=0
void SetMission(BRAWLER::MissionType aMission)
Definition BrawlerPlatform.hpp:577
static UtVec3d ConvertNEDtoLLA(UtVec3d ned)
Definition BrawlerPlatform.cpp:685
virtual double MinInstantaneousTurnRadius_ft()=0
virtual double EvaluateTurnInPlaneWithSpeed(UtVec3d &aPlane, const double &aGees, const double &aSpeed)=0
void SetManeuverValueComponent(BRAWLER::ManeuverValueComponentType aType, double value)
Definition BrawlerPlatform.hpp:181
virtual void UpdateStatistics(double value)
Definition BrawlerPlatform.cpp:301
double DegreeOfThreatCompliment(UtEntity &aTgt)
Definition BrawlerPlatform.hpp:241
UtVec3d RelativePositionNED(UtEntity &aTgt)
Definition BrawlerPlatform.cpp:560
UtVec3d PositionNED()
Definition BrawlerPlatform.cpp:520
UtVec3d AccelerationECS()
Definition BrawlerPlatform.cpp:540
virtual double LastConsciousnessEventTime()
Definition BrawlerPlatform.hpp:142
virtual int GetNumberThreats()
Definition BrawlerPlatform.hpp:127
UtVec3d ConvertECStoNED(UtVec3d ecs)
Definition BrawlerPlatform.cpp:590
double RangePercent(BRAWLER::WeaponType aType)
Definition BrawlerPlatform.hpp:302
void SetState(UtEntity &state)
Definition BrawlerPlatform.hpp:130
virtual double EvaluateHeadingSpeedAltitude(const double &aHeading, const double &aSpeed, const double &aAltitude, const double &aMaxGees, const double &aMaxClimb)=0
virtual ~BrawlerPlatform()=default
double RollOverTopValue()
Definition BrawlerPlatform.hpp:226
virtual double MaxForwardAccelerationWithGravity_fps2()=0
virtual double GetConsciousnessEventTime()
Definition BrawlerPlatform.hpp:141
double SlantRange(UtEntity &aTgt, double defaultRange=1000000/BRAWLER::ftnmi)
Definition BrawlerPlatform.cpp:821
bool WeaponSeekerOnWhenFired()
Definition BrawlerPlatform.hpp:269
void SetTargetNominalState(UtEntity &state)
Definition BrawlerPlatform.hpp:139
double TimeAllowedPerSectorSearch()
Definition BrawlerPlatform.hpp:365
virtual double GetAlphaAtMaxCL_deg(const double &aAlt_ft, const double &aMach)=0
UtVec3d OrientationNED()
Definition BrawlerPlatform.cpp:545
double RawManeuverValueComponent(BRAWLER::ManeuverValueComponentType aType)
Definition BrawlerPlatform.hpp:186
UtEntity mMyState
Definition BrawlerPlatform.hpp:599
double ForceRatio()
Definition BrawlerPlatform.hpp:286
virtual UtEntity * GetTarget()=0
virtual double SensorGimbalAzimuthLimit()=0
UtVec3d EvasionDirection()
Definition BrawlerPlatform.hpp:235
virtual double MaxInstantaneousTurnRate_rps()=0
virtual double MinForwardAcceleration_fps2()=0
double ManeuverValueComponent(BRAWLER::ManeuverValueComponentType aType)
Returns the value of the requested maneuver component.
Definition BrawlerPlatform.hpp:180
virtual double MindUpdate(double aSimTime)
Definition BrawlerPlatform.cpp:173
virtual double MaxTacticalTurnRate_rps()=0
double WeaponMaxEnvelopeRange()
Definition BrawlerPlatform.hpp:264
UtEntity mMyPro
Definition BrawlerPlatform.hpp:602
UtEntity & ProjectedState()
Definition BrawlerPlatform.hpp:135
virtual double MinTacticalTurnRadius_ft()=0
virtual double GetAlphaAtMaxCL_deg(const double &aMach)=0
virtual double StructuralGLimitAboveDesignWeight_g()=0
MissionType
Definition BrawlerUtil.hpp:109
MissileModeState
Definition BrawlerUtil.hpp:82
WeaponType
Definition BrawlerUtil.hpp:48
@ kndsrm
Definition BrawlerUtil.hpp:50
JobType
Definition BrawlerUtil.hpp:103
ManeuverValueComponentType
Definition BrawlerUtil.hpp:59
double const grav
Definition BrawlerUtil.hpp:30
double const ftnmi
Definition BrawlerUtil.hpp:36
InherentBiasFaultTypes
Definition BrawlerUtil.hpp:97
Copyrights Multiple, All Rights Reserved