MATLAB Strategies
STK Premium (Air) or STK Enterprise
You can obtain the necessary licenses for this tutorial by contacting AGI Support at support@agi.com or 1-800-924-7244.
Capabilities Covered
This lesson covers the following STK Capabilities:
- Aviator Pro
- STK Integration
Problem Statement
There are four Basic Maneuver strategies that allow you to use MATLAB Aerospace Toolbox functions to define the force modeling of the aircraft:
- MATLAB - 3D Guidance
- MATLAB - Full 3D
- MATLAB - Horizontal Plane
- MATLAB - Vertical Plane
About the Strategies
Horizontal and Vertical Plane Strategies
The Horizontal Plane and Vertical Plane strategies both use a control law that is defined by a MATLAB function to model the aircraft's motion in their respective planes. You can allow MATLAB to manage airspeed for the Vertical Plane strategy or you can define the airspeed control manually.
Airspeed
Select a method to define the aircraft's airspeed for the maneuver from the drop-down menu and define any related properties for it.
The Min Speed Limits and Max Speed Limits properties control the behavior of STK's Aviator capability if the aircraft violates the minimum or maximum airspeed during the maneuver; select Constrain if Violated to force the aircraft to obey the limit and continue the maneuver (possibly violating physical laws), Stop if Violated to stop the maneuver at the minimum or maximum airspeed, or Error if Violated to make the procedure invalid.
Full 3D
The Full 3D strategy uses a MATLAB function to define the entire force model of the aircraft's motion. The strategy offers the same airspeed options as the Vertical Plane strategy.
3D Guidance
The 3D Guidance strategy, like the Full 3D strategy, uses a MATLAB function to define the entire force model and offers the same airspeed options. In addition, this strategy allows you to define guidance properties that describe the goal of the maneuver.
Target
Select an object in the scenario that the aircraft will pursue during the maneuver. To define position and velocity strategies for the target object, click Pos/Vel Strategies. The following strategies are available:
- NoisyBrgRng - A noisy bearing and range strategy.
- NoisySurfTgtPosVel - A strategy that periodically generates noisy position, speed, and course updates for a constant altitude target.
In the In the Tgt Pos/Vel Resolution field, define the frequency of sampling of the target object's position and velocity; interpolation of the object's position will be performed between sample points.
The lowest recommended value for Tgt Pos/Vel Resolution is 0.1 sec, but the lowest possible value is 0.001 sec. At the lowest value, Aviator will use the native position and velocity of the target object; this can result in dramatically slow performance when the target object is another Aviator aircraft, since STK is performing double integration calculations in such a case.
Stop Time to Go
Select Use Stop Constraint to apply a "time to go" stopping condition, which will end the procedure at a specified length of time before the intercept occurs; enter the desired value in the Stop Time to Go field.
Stop Slant Range
Select Use Stop Constraint to apply a range from target stopping condition, which will end the procedure at a specified range before the intercept occurs; enter the desired value in the Stop Time to Go field.
Closure Mode
Select a rule that defines the closure requirement for the maneuver.
- Not Set - the maneuver will continue whether or not the aircraft is closing with the target.
- Closure Required - the maneuver will stop if closure stops for any reason.
- High Off Boresight(HOBS) - the maneuver will stop if closure stops, unless the aircraft is within the HOBs Max Angle Off and HOBs Angle Tolerance values; for example, this mode allows you to perform a guidance maneuver to a target that is initially behind the aircraft.
Examples
This section provides an example function file and input definition for each of the strategies.
Horizontal Plane Motion
Example Function
function outputData = FlightTestHorizPlane(inputData) % FlightTestHorizPlane - sample for use with Aviator Horizontal Plane Basic Maneuver strategy if inputData.FirstCall disp('FlightTestHorizPlane inputs:'); disp(inputData); end maxTOF = 240.0; t = inputData.Time; tGo = maxTOF - t; dTurnRate = -pi/60; outputData(1) = tGo; outputData(2) = dTurnRate; return;
Input Definition
Time: 0 TimeEpSec: 0 Lat: -0.0010 Lon: -0.0010 Altitude: 10668 AltitudeRate: 0 GroundSpeed: 240.8853 TrueHeading: 2.7804e-22 TrueCourse: 2.9549e-22 Headwind: 0 Crosswind: 0 TAS True Airspeed: the speed that the aircraft is moving relative to the airmass that it is flying in.: 240.8853 EAS Equivalent Airspeed: the airspeed at sea level (International Standard Atmosphere) at which the dynamic pressure is equal to the dynamic pressure at the aircraft's current true airspeed and altitude.: 134.2107 CAS Calibrated Airspeed: the speed reported by the airspeed indicator, corrected for position and instrument error.: 142.4015 Mach The ratio of the aircraft's speed and the speed of sound at the aircraft's altitude, with local atmospheric conditions.: 0.8121 Q: 1.1033e+04 LHToBodyQuat: [4x1 double] ControlTimeConstant: 1 TotalWeight: 2.1083e+04 FuelWeight: 6.5317e+03 FirstCall: 1 AuxState: []
Vertical Plane Motion
Example Function
function outputData = FlightTestVertPlane(inputData) % FlightTestVertPlane - sample for use with Aviator Vertical Plane Basic Maneuver strategy if inputData.FirstCall disp('FlightTestVertPlane inputs:'); disp(inputData); end maxTOF = 240.0; dTargetAltRate = inputData.TAS / 2.0 * sin(pi * inputData.Time / 30.0); dAltRateError = dTargetAltRate - inputData.AltitudeRate; dAltRateDot = dAltRateError / 1.0; TASDot = 0.0; tGo = maxTOF - inputData.Time; outputData(1) = tGo; outputData(2) = dAltRateDot; outputData(3) = TASDot; return;
Input Definition
FlightTestVertPlane inputs: Time: 0 TimeEpSec: 0 Lat: -0.0010 Lon: -0.0010 Altitude: 10668 AltitudeRate: 0 GroundSpeed: 240.8853 TrueHeading: 2.7804e-22 TrueCourse: 2.9549e-22 Headwind: 0 Crosswind: 0 TAS: 240.8853 EAS: 134.2107 CAS: 142.4015 Mach: 0.8121 Q: 1.1033e+04 LHToBodyQuat: [4x1 double] ControlTimeConstant: 1 TotalWeight: 2.1083e+04 FuelWeight: 6.5317e+03 TASDot: 0 FirstCall: 1 AuxState: []
Full 3D
Example Function
function outputData = FlightTest3D(inputData); % FlightTest3D - sample for use with Aviator 3D Basic Maneuver strategy if inputData.FirstCall disp('FlightTest3D inputs:'); disp(inputData); end LHToBodyMtx = atbQuatToMtx(inputData.LHToBodyQuat); lhZ = [0;0;1]; bodyZ = LHToBodyMtx * lhZ; bodyZDotLHZ = dot(bodyZ, lhZ); timeToGo = inf; loadFactor = 0 - 2 * bodyZDotLHZ; % g rollRate = pi / 36; % 5 deg/sec TASDot = 0.0; outputData(1) = timeToGo; outputData(2) = loadFactor; outputData(3) = rollRate; outputData(4) = TASDot; return;
Input Definition
FlightTest3D inputs: Time: 0 TimeEpSec: 0 Lat: -0.0010 Lon: -0.0010 Altitude: 10668 AltitudeRate: 0 GroundSpeed: 240.8853 TrueHeading: 2.7804e-22 TrueCourse: 2.9549e-22 Headwind: 0 Crosswind: 0 TAS: 240.8853 EAS: 134.2107 CAS: 142.4015 Mach: 0.8121 Q: 1.1033e+04 LHToBodyQuat: [4x1 double] ControlTimeConstant: 1 TotalWeight: 2.1083e+04 FuelWeight: 6.5317e+03 TASDot: 0 FirstCall: 1 AuxState: []
3D Guidance
Example Function
function outputData = FlightTest3DGuidance(inputData) % FlightTest3DGuidance - sample for use with Aviator 3D Guidance Basic Maneuver strategy if inputData.FirstCall disp('FlightTest3DGuidance inputs:'); disp(inputData); end GFactor = 9.8606; R = inputData.FlatTgtPosition - inputData.FlatVehPosition; Rdot = inputData.FlatTgtVelocity - inputData.FlatVehVelocity; rSquared = norm(R)^2; NavConstant = 3.0; rollRate = 0; normalLoadFactor = 1.0; perpLoadFactor = 0.0; TASDot = 0.0; maxLoadFactor = 3.0; if (rSquared > eps) W = cross(R, Rdot) / rSquared; Alh = cross(NavConstant * W, inputData.FlatVehVelocity); Alh = Alh / GFactor + [0;0;1]; AlhMag = norm(Alh); if (AlhMag > maxLoadFactor) Alh = Alh * maxLoadFactor / AlhMag; normalLoadFactor = maxLoadFactor; else normalLoadFactor = AlhMag; end % rotate Alh into body frame ... LHToBodyMtx = atbQuatToMtx(inputData.LHToBodyQuat); Abody = LHToBodyMtx * Alh; angleOff = atan2(Abody(2), -Abody(3)); rollRate = angleOff / inputData.ControlTimeConstant; end tGo = inf; outputData(1) = tGo; outputData(2) = rollRate; outputData(3) = normalLoadFactor; outputData(4) = perpLoadFactor; outputData(5) = TASDot; return;
Input Definition
FlightTest3DGuidance inputs: Time: 0 TimeEpSec: 0 Lat: -0.0010 Lon: -0.0010 Altitude: 10668 AltitudeRate: 0 GroundSpeed: 240.8853 TrueHeading: 2.7804e-22 TrueCourse: 2.9549e-22 Headwind: 0 Crosswind: 0 TAS: 240.8853 EAS: 134.2107 CAS: 142.4015 Mach: 0.8121 Q: 1.1033e+04 ControlTimeConstant: 1 TotalWeight: 2.1083e+04 FuelWeight: 6.5317e+03 LHToBodyQuat: [4x1 double] FlatVehPosition: [3x1 double] FlatVehVelocity: [3x1 double] FlatTgtPosition: [3x1 double] FlatTgtVelocity: [3x1 double] FlatTgtAccel: [3x1 double] ECFToBodyQuat: [4x1 double] ECFVehPosition: [3x1 double] ECFVehVelocity: [3x1 double] ECFTgtPosition: [3x1 double] ECFTgtVelocity: [3x1 double] ECFTgtAccel: [3x1 double] VehPosInTgtBodyFrame: [3x1 double] TASDot: 0 FirstCall: 1 AuxState: []