Module AI_A2A

AI -- (R2.2) - Models the process of air operations for airplanes.

This is a class used in the AI_A2A_Dispatcher.


Author: FlightControl


Global(s)

AI_A2A

AI_A2A class, extends Fsm#FSM_CONTROLLABLE

The AI_A2A class implements the core functions to operate an AI Group A2A tasking.

Type AI_A2A

AI_A2A.CheckStatus
AI_A2A:ClearTargetDistance()
AI_A2A.DisengageRadius
AI_A2A:GetDispatcher()
AI_A2A.HomeAirbase
AI_A2A.IdleCount
AI_A2A:New(AIGroup)

Creates a new AI_A2A object

AI_A2A:OnAfterRTB(Controllable, From, Event, To)

OnAfter Transition Handler for Event RTB.

AI_A2A:OnAfterRefuel(Controllable, From, Event, To)

Refuel Handler OnAfter for AI_A2A

AI_A2A:OnAfterStart(From, Event, To)

Start Handler OnAfter for AI_A2A

AI_A2A:OnAfterStatus(Controllable, From, Event, To)

OnAfter Transition Handler for Event Status.

AI_A2A:OnAfterStop(Controllable, From, Event, To)

OnAfter Transition Handler for Event Stop.

AI_A2A:OnBeforeRTB(Controllable, From, Event, To)

OnBefore Transition Handler for Event RTB.

AI_A2A:OnBeforeRefuel(Controllable, From, Event, To)

Refuel Handler OnBefore for AI_A2A

AI_A2A:OnBeforeStart(From, Event, To)

Start Handler OnBefore for AI_A2A

AI_A2A:OnBeforeStatus(Controllable, From, Event, To)

OnBefore Transition Handler for Event Status.

AI_A2A:OnBeforeStop(Controllable, From, Event, To)

OnBefore Transition Handler for Event Stop.

AI_A2A:OnCrash(EventData)
AI_A2A:OnEjection(EventData)
AI_A2A:OnEnterReturning(Controllable, From, Event, To)

OnEnter Transition Handler for State Returning.

AI_A2A:OnEnterStopped(Controllable, From, Event, To)

OnEnter Transition Handler for State Stopped.

AI_A2A:OnLeaveReturning(Controllable, From, Event, To)

OnLeave Transition Handler for State Returning.

AI_A2A:OnLeaveStopped(Controllable, From, Event, To)

OnLeave Transition Handler for State Stopped.

AI_A2A:OnPilotDead(EventData)
AI_A2A.PatrolCeilingAltitude
AI_A2A.PatrolDamageThreshold
AI_A2A.PatrolFloorAltitude
AI_A2A.PatrolFuelThresholdPercentage
AI_A2A.PatrolManageDamage
AI_A2A.PatrolManageFuel
AI_A2A.PatrolMaxSpeed
AI_A2A.PatrolMinSpeed
AI_A2A.PatrolOutOfFuelOrbitTime
AI_A2A:RTB()

Synchronous Event Trigger for Event RTB.

AI_A2A.RTBHold(AIGroup, Fsm)
AI_A2A.RTBRoute(AIGroup, Fsm)
AI_A2A:Refuel()

Refuel Trigger for AI_A2A

AI_A2A.Resume(AIGroup, Fsm)
AI_A2A:SetAltitude(PatrolFloorAltitude, PatrolCeilingAltitude)

Sets the floor and ceiling altitude of the patrol.

AI_A2A:SetDamageThreshold(PatrolDamageThreshold)

When the AI is damaged beyond a certain treshold, it is required that the AI returns to the home base.

AI_A2A:SetDisengageRadius(DisengageRadius)

Sets the disengage range, that when engaging a target beyond the specified range, the engagement will be cancelled and the plane will RTB.

AI_A2A:SetDispatcher(Dispatcher)
AI_A2A:SetFuelThreshold(PatrolFuelThresholdPercentage, PatrolOutOfFuelOrbitTime)

When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.

AI_A2A:SetHomeAirbase(HomeAirbase)

Sets the home airbase.

AI_A2A:SetSpeed(PatrolMinSpeed, PatrolMaxSpeed)

Sets (modifies) the minimum and maximum speed of the patrol.

AI_A2A:SetStatusOff()

Set the status checking off.

AI_A2A:SetTanker(TankerName)

Sets to refuel at the given tanker.

AI_A2A:SetTargetDistance(Coordinate)
AI_A2A:Start()

Start Trigger for AI_A2A

AI_A2A:Status()

Synchronous Event Trigger for Event Status.

AI_A2A:Stop()

Synchronous Event Trigger for Event Stop.

AI_A2A.TankerName
AI_A2A:__RTB(Delay)

Asynchronous Event Trigger for Event RTB.

AI_A2A:__Refuel(Delay)

Refuel Asynchronous Trigger for AI_A2A

AI_A2A:__Start(Delay)

Start Asynchronous Trigger for AI_A2A

AI_A2A:__Status(Delay)

Asynchronous Event Trigger for Event Status.

AI_A2A:__Stop(Delay)

Asynchronous Event Trigger for Event Stop.

AI_A2A:onafterDead()
AI_A2A:onafterHold(AIGroup, From, Event, To, HoldTime)
AI_A2A:onafterHome(AIGroup, From, Event, To)
AI_A2A:onafterRTB(AIGroup, From, Event, To)
AI_A2A:onafterRefuel(AIGroup, From, Event, To)
AI_A2A:onafterStart(Controllable, From, Event, To)

Defines a new patrol route using the Process_PatrolZone parameters and settings.

AI_A2A:onafterStatus()
AI_A2A:onbeforeStatus()

Global(s)

#AI_A2A AI_A2A

AI_A2A class, extends Fsm#FSM_CONTROLLABLE

The AI_A2A class implements the core functions to operate an AI Group A2A tasking.

AI_A2A constructor

2. AI_A2A is a FSM

Process

2.1. AI_A2A States

  • None ( Group ): The process is not started yet.
  • Patrolling ( Group ): The AI is patrolling the Patrol Zone.
  • Returning ( Group ): The AI is returning to Base.
  • Stopped ( Group ): The process is stopped.
  • Crashed ( Group ): The AI has crashed or is dead.

2.2. AI_A2A Events

  • Start ( Group ): Start the process.
  • Stop ( Group ): Stop the process.
  • Route ( Group ): Route the AI to a new random 3D point within the Patrol Zone.
  • RTB ( Group ): Route the AI to the home base.
  • Detect ( Group ): The AI is detecting targets.
  • Detected ( Group ): The AI has detected new targets.
  • Status ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB.

3. Set or Get the AI controllable

Type AI_A2A

Extends Core.Fsm#FSM_CONTROLLABLE

Field(s)

#boolean AI_A2A.CheckStatus
AI_A2A:ClearTargetDistance()
AI_A2A.DisengageRadius
AI_A2A:GetDispatcher()
AI_A2A.HomeAirbase
AI_A2A.IdleCount
AI_A2A:New(AIGroup)

Creates a new AI_A2A object

Parameter

Return value

#AI_A2A:

AI_A2A:OnAfterRTB(Controllable, From, Event, To)

OnAfter Transition Handler for Event RTB.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_A2A:OnAfterRefuel(Controllable, From, Event, To)

Refuel Handler OnAfter for AI_A2A

Parameters

AI_A2A:OnAfterStart(From, Event, To)

Start Handler OnAfter for AI_A2A

Parameters

  • #string From :

  • #string Event :

  • #string To :

AI_A2A:OnAfterStatus(Controllable, From, Event, To)

OnAfter Transition Handler for Event Status.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_A2A:OnAfterStop(Controllable, From, Event, To)

OnAfter Transition Handler for Event Stop.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_A2A:OnBeforeRTB(Controllable, From, Event, To)

OnBefore Transition Handler for Event RTB.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#boolean: Return false to cancel Transition.

AI_A2A:OnBeforeRefuel(Controllable, From, Event, To)

Refuel Handler OnBefore for AI_A2A

Parameters

Return value

#boolean:

AI_A2A:OnBeforeStart(From, Event, To)

Start Handler OnBefore for AI_A2A

Parameters

  • #string From :

  • #string Event :

  • #string To :

Return value

#boolean:

AI_A2A:OnBeforeStatus(Controllable, From, Event, To)

OnBefore Transition Handler for Event Status.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#boolean: Return false to cancel Transition.

AI_A2A:OnBeforeStop(Controllable, From, Event, To)

OnBefore Transition Handler for Event Stop.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#boolean: Return false to cancel Transition.

AI_A2A:OnCrash(EventData)

Parameter

AI_A2A:OnEjection(EventData)

Parameter

AI_A2A:OnEnterReturning(Controllable, From, Event, To)

OnEnter Transition Handler for State Returning.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_A2A:OnEnterStopped(Controllable, From, Event, To)

OnEnter Transition Handler for State Stopped.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

AI_A2A:OnLeaveReturning(Controllable, From, Event, To)

OnLeave Transition Handler for State Returning.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#boolean: Return false to cancel Transition.

AI_A2A:OnLeaveStopped(Controllable, From, Event, To)

OnLeave Transition Handler for State Stopped.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#boolean: Return false to cancel Transition.

AI_A2A:OnPilotDead(EventData)

Parameter

AI_A2A.PatrolCeilingAltitude
AI_A2A.PatrolDamageThreshold
AI_A2A.PatrolFloorAltitude
AI_A2A.PatrolFuelThresholdPercentage
#boolean AI_A2A.PatrolManageDamage
#boolean AI_A2A.PatrolManageFuel
AI_A2A.PatrolMaxSpeed
AI_A2A.PatrolMinSpeed
AI_A2A.PatrolOutOfFuelOrbitTime
AI_A2A:RTB()

Synchronous Event Trigger for Event RTB.

AI_A2A.RTBHold(AIGroup, Fsm)

Parameters

AI_A2A.RTBRoute(AIGroup, Fsm)

Parameters

AI_A2A:Refuel()

Refuel Trigger for AI_A2A

AI_A2A.Resume(AIGroup, Fsm)

Parameters

AI_A2A:SetAltitude(PatrolFloorAltitude, PatrolCeilingAltitude)

Sets the floor and ceiling altitude of the patrol.

Parameters

  • Dcs.DCSTypes#Altitude PatrolFloorAltitude : The lowest altitude in meters where to execute the patrol.

  • Dcs.DCSTypes#Altitude PatrolCeilingAltitude : The highest altitude in meters where to execute the patrol.

Return value

#AI_A2A: self

AI_A2A:SetDamageThreshold(PatrolDamageThreshold)

When the AI is damaged beyond a certain treshold, it is required that the AI returns to the home base.

However, damage cannot be foreseen early on. Therefore, when the damage treshold is reached, the AI will return immediately to the home base (RTB). Note that for groups, the average damage of the complete group will be calculated. So, in a group of 4 airplanes, 2 lost and 2 with damage 0.2, the damage treshold will be 0.25.

Parameter

  • #number PatrolDamageThreshold : The treshold in percentage (between 0 and 1) when the AI is considered to be damaged.

Return value

#AI_A2A: self

AI_A2A:SetDisengageRadius(DisengageRadius)

Sets the disengage range, that when engaging a target beyond the specified range, the engagement will be cancelled and the plane will RTB.

Parameter

  • #number DisengageRadius : The disengage range.

Return value

#AI_A2A: self

AI_A2A:SetDispatcher(Dispatcher)

Parameter

  • Dispatcher :

AI_A2A:SetFuelThreshold(PatrolFuelThresholdPercentage, PatrolOutOfFuelOrbitTime)

When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.

Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated. When the fuel treshold is reached, the AI will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_A2A. Once the time is finished, the old AI will return to the base.

Parameters

  • #number PatrolFuelThresholdPercentage : The treshold in percentage (between 0 and 1) when the AIControllable is considered to get out of fuel.

  • #number PatrolOutOfFuelOrbitTime : The amount of seconds the out of fuel AIControllable will orbit before returning to the base.

Return value

#AI_A2A: self

AI_A2A:SetHomeAirbase(HomeAirbase)

Sets the home airbase.

Parameter

Return value

#AI_A2A: self

AI_A2A:SetSpeed(PatrolMinSpeed, PatrolMaxSpeed)

Sets (modifies) the minimum and maximum speed of the patrol.

Parameters

Return value

#AI_A2A: self

AI_A2A:SetStatusOff()

Set the status checking off.

Return value

#AI_A2A: self

AI_A2A:SetTanker(TankerName)

Sets to refuel at the given tanker.

Parameter

  • Wrapper.Group#GROUP TankerName : The group name of the tanker as defined within the Mission Editor or spawned.

Return value

#AI_A2A: self

AI_A2A:SetTargetDistance(Coordinate)

Parameter

  • Coordinate :

AI_A2A:Start()

Start Trigger for AI_A2A

AI_A2A:Status()

Synchronous Event Trigger for Event Status.

AI_A2A:Stop()

Synchronous Event Trigger for Event Stop.

AI_A2A.TankerName
AI_A2A:__RTB(Delay)

Asynchronous Event Trigger for Event RTB.

Parameter

  • #number Delay : The delay in seconds.

AI_A2A:__Refuel(Delay)

Refuel Asynchronous Trigger for AI_A2A

Parameter

  • #number Delay :

AI_A2A:__Start(Delay)

Start Asynchronous Trigger for AI_A2A

Parameter

  • #number Delay :

AI_A2A:__Status(Delay)

Asynchronous Event Trigger for Event Status.

Parameter

  • #number Delay : The delay in seconds.

AI_A2A:__Stop(Delay)

Asynchronous Event Trigger for Event Stop.

Parameter

  • #number Delay : The delay in seconds.

AI_A2A:onafterDead()
AI_A2A:onafterHold(AIGroup, From, Event, To, HoldTime)

Parameters

AI_A2A:onafterHome(AIGroup, From, Event, To)

Parameters

AI_A2A:onafterRTB(AIGroup, From, Event, To)

Parameters

AI_A2A:onafterRefuel(AIGroup, From, Event, To)

Parameters

AI_A2A:onafterStart(Controllable, From, Event, To)

Defines a new patrol route using the Process_PatrolZone parameters and settings.

Parameters

  • Wrapper.Controllable#CONTROLLABLE Controllable : The Controllable Object managed by the FSM.

  • #string From : The From State string.

  • #string Event : The Event string.

  • #string To : The To State string.

Return value

#AI_A2A: self

AI_A2A:onafterStatus()
AI_A2A:onbeforeStatus()