Module PatrolZone

This module contains the PATROLZONE class.


1) #PATROLZONE class, extends Base#BASE

The #PATROLZONE class implements the core functions to patrol a Zone by air units. The PATROLZONE class will guide the airplanes towards the patrolzone. The patrol algorithm works that for each airplane patrolling, upon arrival at the patrol zone, a random point is selected as the route point within the 3D space, within the given boundary limits. The airplane will fly towards the random point using a randomly selected speed within given boundary limits. Upon arrival at the random point, a new random point will be selected within the patrol zone within boundary limits. This cycle will continue until a fuel treshold has been reached by the airplane. When the fuel treshold has been reached, the airplane will fly towards the nearest friendly airbase and will land.

1.1) PATROLZONE constructor:

PATROLZONE.New(): Creates a new PATROLZONE object.

1.2) Modify the PATROLZONE parameters:

The following methods are available to modify the parameters of a PATROLZONE object:

1.3) Manage the out of fuel in the PATROLZONE:

When the PatrolGroup is out of fuel, it is required that a new PatrolGroup is started, before the old PatrolGroup 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 PatrolGroup will continue for a given time its patrol task in orbit, while a new PatrolGroup is targetted to the PATROLZONE. Once the time is finished, the old PatrolGroup will return to the base. Use the method PATROLZONE.ManageFuel() to have this proces in place.


API CHANGE HISTORY

The underlying change log documents the API changes. Please read this carefully. The following notation is used:

  • Added parts are expressed in bold type face.
  • Removed parts are expressed in italic type face.

Hereby the change log:

2016-08-17: PATROLZONE:New( PatrolSpawn, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed ) replaces PATROLZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed )

2016-07-01: Initial class and API.


AUTHORS and CONTRIBUTIONS

Contributions:

  • DutchBaron: Testing.

Authors:

  • FlightControl: Design & Programming

Global(s)

PATROLZONE
_NewPatrolRoute(PatrolGroup)

Type PATROLZONE

PATROLZONE.ClassName
PATROLZONE:ManageFuel(PatrolFuelTresholdPercentage, PatrolOutOfFuelOrbitTime)

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

PATROLZONE:New(PatrolSpawn, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed)

Creates a new PATROLZONE object, taking a Group object as a parameter.

PATROLZONE:NewPatrolRoute()

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

PATROLZONE.PatrolCeilingAltitude

The highest altitude in meters where to execute the patrol.

PATROLZONE.PatrolFloorAltitude

The lowest altitude in meters where to execute the patrol.

PATROLZONE.PatrolFuelTresholdPercentage
PATROLZONE.PatrolGroup

The Group patrolling.

PATROLZONE.PatrolGroupTemplateName
PATROLZONE.PatrolManageFuel
PATROLZONE.PatrolMaxSpeed

The maximum speed of the Group in km/h.

PATROLZONE.PatrolMinSpeed

The minimum speed of the Group in km/h.

PATROLZONE.PatrolOutOfFuelMonitor
PATROLZONE.PatrolOutOfFuelOrbitTime
PATROLZONE.PatrolZone

The Zone where the patrol needs to be executed.

PATROLZONE:SetAltitude(PatrolFloorAltitude, PatrolCeilingAltitude)

Sets the floor and ceiling altitude of the patrol.

PATROLZONE:SetGroup(PatrolGroup)

Set the Group to act as the Patroller.

PATROLZONE:SetSpeed(PatrolMinSpeed, PatrolMaxSpeed)

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

Global(s)

#PATROLZONE PATROLZONE
_NewPatrolRoute(PatrolGroup)

Parameter

Type PatrolZone

Type PATROLZONE

PATROLZONE class

Field(s)

#string PATROLZONE.ClassName
PATROLZONE:ManageFuel(PatrolFuelTresholdPercentage, PatrolOutOfFuelOrbitTime)

When the PatrolGroup is out of fuel, it is required that a new PatrolGroup is started, before the old PatrolGroup 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 PatrolGroup will continue for a given time its patrol task in orbit, while a new PatrolGroup is targetted to the PATROLZONE. Once the time is finished, the old PatrolGroup will return to the base.

Parameters

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

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

Return value

#PATROLZONE: self

PATROLZONE:New(PatrolSpawn, PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude, PatrolMinSpeed, PatrolMaxSpeed)

Creates a new PATROLZONE object, taking a Group object as a parameter.

The GROUP needs to be alive.

Parameters

  • Spawn#SPAWN PatrolSpawn : The SPAWN object to spawn new group objects when required due to the fuel treshold.

  • Zone#ZONE_BASE PatrolZone : The Zone where the patrol needs to be executed.

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

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

  • DCSTypes#Speed PatrolMinSpeed : The minimum speed of the Group in km/h.

  • DCSTypes#Speed PatrolMaxSpeed : The maximum speed of the Group in km/h.

Return value

#PATROLZONE: self

Usage:

-- Define a new PATROLZONE Object. This PatrolArea will patrol a group within PatrolZone between 3000 and 6000 meters, with a variying speed between 600 and 900 km/h.
PatrolZone = ZONE:New( 'PatrolZone' )
PatrolSpawn = SPAWN:New( "Patrol Group" )
PatrolArea = PATROLZONE:New( PatrolSpawn, PatrolZone, 3000, 6000, 600, 900 )
PATROLZONE:NewPatrolRoute()

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

Return value

#PATROLZONE: self

DCSTypes#Altitude PATROLZONE.PatrolCeilingAltitude

The highest altitude in meters where to execute the patrol.

DCSTypes#Altitude PATROLZONE.PatrolFloorAltitude

The lowest altitude in meters where to execute the patrol.

PATROLZONE.PatrolFuelTresholdPercentage
Group#GROUP PATROLZONE.PatrolGroup

The Group patrolling.

PATROLZONE.PatrolGroupTemplateName
#boolean PATROLZONE.PatrolManageFuel
DCSTypes#Speed PATROLZONE.PatrolMaxSpeed

The maximum speed of the Group in km/h.

DCSTypes#Speed PATROLZONE.PatrolMinSpeed

The minimum speed of the Group in km/h.

PATROLZONE.PatrolOutOfFuelMonitor
PATROLZONE.PatrolOutOfFuelOrbitTime
Zone#ZONE_BASE PATROLZONE.PatrolZone

The Zone where the patrol needs to be executed.

PATROLZONE:SetAltitude(PatrolFloorAltitude, PatrolCeilingAltitude)

Sets the floor and ceiling altitude of the patrol.

Parameters

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

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

Return value

#PATROLZONE: self

PATROLZONE:SetGroup(PatrolGroup)

Set the Group to act as the Patroller.

Parameter

Return value

#PATROLZONE: self

PATROLZONE:SetSpeed(PatrolMinSpeed, PatrolMaxSpeed)

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

Parameters

Return value

#PATROLZONE: self