This commit is contained in:
Frank 2020-09-04 17:20:40 +02:00
parent cda1658541
commit 2e998dc315
8 changed files with 199 additions and 66 deletions

View File

@ -44,7 +44,7 @@
-- --
-- === -- ===
-- --
-- ![Banner Image](..\Presentations\AirWing\AIRWING_Main.jpg) -- ![Banner Image](..\Presentations\OPS\AirWing\_Main.png)
-- --
-- # The AIRWING Concept -- # The AIRWING Concept
-- --
@ -66,7 +66,7 @@
-- At this point the airwing does not have any assets (aircraft). In order to add these, one needs to first define SQUADRONS. -- At this point the airwing does not have any assets (aircraft). In order to add these, one needs to first define SQUADRONS.
-- --
-- VFA151=SQUADRON:New("F-14 Group", 8, "VFA-151 (Vigilantes)") -- VFA151=SQUADRON:New("F-14 Group", 8, "VFA-151 (Vigilantes)")
-- VFA151:AddMissionCapability({AUFTRAG.Type.GCCAP, AUFTRAG.Type.INTERCEPT}) -- VFA151:AddMissionCapability({AUFTRAG.Type.GCICAP, AUFTRAG.Type.INTERCEPT})
-- --
-- airwing:AddSquadron(VFA151) -- airwing:AddSquadron(VFA151)
-- --
@ -78,8 +78,8 @@
-- defined in the Mission Editor. -- defined in the Mission Editor.
-- --
-- -- F-14 payloads for CAP and INTERCEPT. Phoenix are first, sparrows are second choice. -- -- F-14 payloads for CAP and INTERCEPT. Phoenix are first, sparrows are second choice.
-- airwing:NewPayload(GROUP:FindByName("F-14 Payload AIM-54C"), 2, {AUFTRAG.Type.INTERCEPT, AUFTRAG.Type.GCCAP}, 80) -- airwing:NewPayload(GROUP:FindByName("F-14 Payload AIM-54C"), 2, {AUFTRAG.Type.INTERCEPT, AUFTRAG.Type.GCICAP}, 80)
-- airwing:NewPayload(GROUP:FindByName("F-14 Payload AIM-7M"), 20, {AUFTRAG.Type.INTERCEPT, AUFTRAG.Type.GCCAP}) -- airwing:NewPayload(GROUP:FindByName("F-14 Payload AIM-7M"), 20, {AUFTRAG.Type.INTERCEPT, AUFTRAG.Type.GCICAP})
-- --
-- This will add two AIM-54C and 20 AIM-7M payloads. -- This will add two AIM-54C and 20 AIM-7M payloads.
-- --
@ -909,7 +909,7 @@ end
-- @return #AIRWING self -- @return #AIRWING self
function AIRWING:CheckCAP() function AIRWING:CheckCAP()
local Ncap=self:CountMissionsInQueue({AUFTRAG.Type.GCCAP, AUFTRAG.Type.INTERCEPT}) local Ncap=self:CountMissionsInQueue({AUFTRAG.Type.GCICAP, AUFTRAG.Type.INTERCEPT})
for i=1,self.nflightsCAP-Ncap do for i=1,self.nflightsCAP-Ncap do
@ -917,7 +917,7 @@ function AIRWING:CheckCAP()
local altitude=patrol.altitude+1000*patrol.noccupied local altitude=patrol.altitude+1000*patrol.noccupied
local missionCAP=AUFTRAG:NewGCCAP(patrol.coord, altitude, patrol.speed, patrol.heading, patrol.leg) local missionCAP=AUFTRAG:NewGCICAP(patrol.coord, altitude, patrol.speed, patrol.heading, patrol.leg)
missionCAP.patroldata=patrol missionCAP.patroldata=patrol

View File

@ -21,7 +21,7 @@
-- --
-- === -- ===
-- --
-- ![Banner Image](..\Presentations\ARMYGROUP\ArmyGroup_Main.jpg) -- ![Banner Image](..\Presentations\OPS\ArmyGroup\_Main.png)
-- --
-- # The ARMYGROUP Concept -- # The ARMYGROUP Concept
-- --
@ -147,7 +147,7 @@ end
-- @return #ARMYGROUP self -- @return #ARMYGROUP self
function ARMYGROUP:SetSpeedCruise(Speed) function ARMYGROUP:SetSpeedCruise(Speed)
self.speedCruise=Speed and UTILS.KnotsToKmph(Speed) or self.speedmax*0.7 self.speedCruise=Speed and UTILS.KnotsToKmph(Speed) or self.speedMax*0.7
return self return self
end end
@ -264,7 +264,7 @@ function ARMYGROUP:onafterStatus(From, Event, To)
-- Info text. -- Info text.
local text=string.format("%s: Wp=%d/%d-->%d Speed=%.1f (%d) Heading=%03d ROE=%d Alarm=%d Formation=%s Tasks=%d Missions=%d", local text=string.format("%s: Wp=%d/%d-->%d Speed=%.1f (%d) Heading=%03d ROE=%d Alarm=%d Formation=%s Tasks=%d Missions=%d",
fsmstate, self.currentwp, #self.waypoints, self:GetWaypointIndexNext(), speed, UTILS.MpsToKnots(self.speed or 0), hdg, self.option.ROE, self.option.Alarm, self.option.Formation, nTaskTot, nMissions) fsmstate, self.currentwp, #self.waypoints, self:GetWaypointIndexNext(), speed, UTILS.MpsToKnots(self.speedWp or 0), hdg, self.option.ROE, self.option.Alarm, self.option.Formation, nTaskTot, nMissions)
self:I(self.lid..text) self:I(self.lid..text)
else else
@ -411,7 +411,7 @@ function ARMYGROUP:onafterUpdateRoute(From, Event, To, n, Speed, Formation)
self.option.Formation=wp.action self.option.Formation=wp.action
-- Current set speed in m/s. -- Current set speed in m/s.
self.speed=wp.speed self.speedWp=wp.speed
else else
@ -457,14 +457,14 @@ function ARMYGROUP:onafterUpdateRoute(From, Event, To, n, Speed, Formation)
-- Current waypoint. -- Current waypoint.
local current=self:GetCoordinate():WaypointGround(UTILS.MpsToKmph(self.speed), self.option.Formation) local current=self:GetCoordinate():WaypointGround(UTILS.MpsToKmph(self.speedWp), self.option.Formation)
table.insert(waypoints, 1, current) table.insert(waypoints, 1, current)
table.insert(waypoints, 1, current) -- Seems to be better to add this twice. Otherwise, the passing waypoint functions is triggered to early! table.insert(waypoints, 1, current) -- Seems to be better to add this twice. Otherwise, the passing waypoint functions is triggered to early!
if #waypoints>2 then if #waypoints>2 then
self:I(self.lid..string.format("Updateing route: WP %d-->%d-->%d (#%d), Speed=%.1f knots, Formation=%s", self:I(self.lid..string.format("Updateing route: WP %d-->%d-->%d (#%d), Speed=%.1f knots, Formation=%s",
self.currentwp, n, #self.waypoints, #waypoints-2, UTILS.MpsToKnots(self.speed), tostring(self.option.Formation))) self.currentwp, n, #self.waypoints, #waypoints-2, UTILS.MpsToKnots(self.speedWp), tostring(self.option.Formation)))
-- Route group to all defined waypoints remaining. -- Route group to all defined waypoints remaining.
self:Route(waypoints) self:Route(waypoints)
@ -595,6 +595,11 @@ function ARMYGROUP:onafterStop(From, Event, To)
self:UnHandleEvent(EVENTS.Dead) self:UnHandleEvent(EVENTS.Dead)
self:UnHandleEvent(EVENTS.RemoveUnit) self:UnHandleEvent(EVENTS.RemoveUnit)
-- Stop check timers.
self.timerCheckZone:Stop()
self.timerQueueUpdate:Stop()
-- Stop FSM scheduler.
self.CallScheduler:Clear() self.CallScheduler:Clear()
self:I(self.lid.."STOPPED! Unhandled events, cleared scheduler and removed from database.") self:I(self.lid.."STOPPED! Unhandled events, cleared scheduler and removed from database.")
@ -780,10 +785,10 @@ function ARMYGROUP:_InitGroup()
self.isUncontrolled=false self.isUncontrolled=false
-- Max speed in km/h. -- Max speed in km/h.
self.speedmax=self.group:GetSpeedMax() self.speedMax=self.group:GetSpeedMax()
-- Cruise speed in km/h -- Cruise speed in km/h
self.speedCruise=self.speedmax*0.7 self.speedCruise=self.speedMax*0.7
-- Group ammo. -- Group ammo.
self.ammo=self:GetAmmoTot() self.ammo=self:GetAmmoTot()
@ -833,7 +838,7 @@ function ARMYGROUP:_InitGroup()
-- Debug info. -- Debug info.
local text=string.format("Initialized Army Group %s:\n", self.groupname) local text=string.format("Initialized Army Group %s:\n", self.groupname)
text=text..string.format("Unit type = %s\n", self.actype) text=text..string.format("Unit type = %s\n", self.actype)
text=text..string.format("Speed max = %.1f Knots\n", UTILS.KmphToKnots(self.speedmax)) text=text..string.format("Speed max = %.1f Knots\n", UTILS.KmphToKnots(self.speedMax))
text=text..string.format("Speed cruise = %.1f Knots\n", UTILS.KmphToKnots(self.speedCruise)) text=text..string.format("Speed cruise = %.1f Knots\n", UTILS.KmphToKnots(self.speedCruise))
text=text..string.format("Elements = %d\n", #self.elements) text=text..string.format("Elements = %d\n", #self.elements)
text=text..string.format("Waypoints = %d\n", #self.waypoints) text=text..string.format("Waypoints = %d\n", #self.waypoints)

View File

@ -123,7 +123,7 @@
-- --
-- === -- ===
-- --
-- ![Banner Image](..\Presentations\CarrierAirWing\AUFTRAG_Main.jpg) -- ![Banner Image](..\Presentations\OPS\Auftrag\_Main.png)
-- --
-- # The AUFTRAG Concept -- # The AUFTRAG Concept
-- --
@ -190,9 +190,9 @@
-- --
-- An orbit mission can be created with the @{#AUFTRAG.NewORBIT}() function. -- An orbit mission can be created with the @{#AUFTRAG.NewORBIT}() function.
-- --
-- ## GCCAP -- ## GCICAP
-- --
-- An patrol mission can be created with the @{#AUFTRAG.NewGCCAP}() function. -- An patrol mission can be created with the @{#AUFTRAG.NewGCICAP}() function.
-- --
-- ## RECON -- ## RECON
-- --
@ -296,7 +296,7 @@ _AUFTRAGSNR=0
-- @field #string FERRY Ferry flight mission. -- @field #string FERRY Ferry flight mission.
-- @field #string INTERCEPT Intercept mission. -- @field #string INTERCEPT Intercept mission.
-- @field #string ORBIT Orbit mission. -- @field #string ORBIT Orbit mission.
-- @field #string GCCAP Similar to CAP but no auto engage targets. -- @field #string GCICAP Similar to CAP but no auto engage targets.
-- @field #string RECON Recon mission. -- @field #string RECON Recon mission.
-- @field #string RECOVERYTANKER Recovery tanker mission. Not implemented yet. -- @field #string RECOVERYTANKER Recovery tanker mission. Not implemented yet.
-- @field #string RESCUEHELO Rescue helo. -- @field #string RESCUEHELO Rescue helo.
@ -319,7 +319,7 @@ AUFTRAG.Type={
FERRY="Ferry Flight", FERRY="Ferry Flight",
INTERCEPT="Intercept", INTERCEPT="Intercept",
ORBIT="Orbit", ORBIT="Orbit",
GCCAP="Ground Controlled CAP", GCICAP="Ground Controlled CAP",
RECON="Recon", RECON="Recon",
RECOVERYTANKER="Recovery Tanker", RECOVERYTANKER="Recovery Tanker",
RESCUEHELO="Rescue Helo", RESCUEHELO="Rescue Helo",
@ -641,7 +641,7 @@ function AUFTRAG:NewORBIT_RACETRACK(Coordinate, Altitude, Speed, Heading, Leg)
return mission return mission
end end
--- Create a Ground Controlled CAP (GCCAP) mission. Flights with this task are considered for A2A INTERCEPT missions by the CHIEF class. They will perform a compat air patrol but not engage by --- Create a Ground Controlled CAP (GCICAP) mission. Flights with this task are considered for A2A INTERCEPT missions by the CHIEF class. They will perform a compat air patrol but not engage by
-- themselfs. They wait for the CHIEF to tell them whom to engage. -- themselfs. They wait for the CHIEF to tell them whom to engage.
-- @param #AUFTRAG self -- @param #AUFTRAG self
-- @param Core.Point#COORDINATE Coordinate Where to orbit. -- @param Core.Point#COORDINATE Coordinate Where to orbit.
@ -650,13 +650,13 @@ end
-- @param #number Heading Heading of race-track pattern in degrees. Default random in [0, 360) degrees. -- @param #number Heading Heading of race-track pattern in degrees. Default random in [0, 360) degrees.
-- @param #number Leg Length of race-track in NM. Default 10 NM. -- @param #number Leg Length of race-track in NM. Default 10 NM.
-- @return #AUFTRAG self -- @return #AUFTRAG self
function AUFTRAG:NewGCCAP(Coordinate, Altitude, Speed, Heading, Leg) function AUFTRAG:NewGCICAP(Coordinate, Altitude, Speed, Heading, Leg)
-- Create ORBIT first. -- Create ORBIT first.
local mission=AUFTRAG:NewORBIT_RACETRACK(Coordinate, Altitude, Speed, Heading, Leg) local mission=AUFTRAG:NewORBIT_RACETRACK(Coordinate, Altitude, Speed, Heading, Leg)
-- Mission type GCCAP. -- Mission type GCICAP.
mission.type=AUFTRAG.Type.GCCAP mission.type=AUFTRAG.Type.GCICAP
mission:_SetLogID() mission:_SetLogID()
@ -1341,8 +1341,8 @@ function AUFTRAG:NewAUTO(EngageGroup)
mission=AUFTRAG:NewFACA(Target,Designation,DataLink,Frequency,Modulation) mission=AUFTRAG:NewFACA(Target,Designation,DataLink,Frequency,Modulation)
elseif auftrag==AUFTRAG.Type.FERRY then elseif auftrag==AUFTRAG.Type.FERRY then
-- Not implemented yet. -- Not implemented yet.
elseif auftrag==AUFTRAG.Type.GCCAP then elseif auftrag==AUFTRAG.Type.GCICAP then
mission=AUFTRAG:NewGCCAP(Coordinate,Altitude,Speed,Heading,Leg) mission=AUFTRAG:NewGCICAP(Coordinate,Altitude,Speed,Heading,Leg)
elseif auftrag==AUFTRAG.Type.INTERCEPT then elseif auftrag==AUFTRAG.Type.INTERCEPT then
mission=AUFTRAG:NewINTERCEPT(Target) mission=AUFTRAG:NewINTERCEPT(Target)
elseif auftrag==AUFTRAG.Type.ORBIT then elseif auftrag==AUFTRAG.Type.ORBIT then
@ -3030,7 +3030,7 @@ function AUFTRAG:GetAssetByName(Name)
return nil return nil
end end
--- Count alive flight groups assigned for this mission. --- Count alive ops groups assigned for this mission.
-- @param #AUFTRAG self -- @param #AUFTRAG self
-- @return #number Number of alive flight groups. -- @return #number Number of alive flight groups.
function AUFTRAG:CountOpsGroups() function AUFTRAG:CountOpsGroups()
@ -3262,10 +3262,10 @@ function AUFTRAG:GetDCSMissionTask(TaskControllable)
-- Done below as also other mission types use the orbit task. -- Done below as also other mission types use the orbit task.
elseif self.type==AUFTRAG.Type.GCCAP then elseif self.type==AUFTRAG.Type.GCICAP then
-------------------- --------------------
-- GCCAP Mission -- -- GCICAP Mission --
-------------------- --------------------
-- Done below as also other mission types use the orbit task. -- Done below as also other mission types use the orbit task.
@ -3369,7 +3369,7 @@ function AUFTRAG:GetDCSMissionTask(TaskControllable)
if self.type==AUFTRAG.Type.ORBIT or if self.type==AUFTRAG.Type.ORBIT or
self.type==AUFTRAG.Type.CAP or self.type==AUFTRAG.Type.CAP or
self.type==AUFTRAG.Type.CAS or self.type==AUFTRAG.Type.CAS or
self.type==AUFTRAG.Type.GCCAP or self.type==AUFTRAG.Type.GCICAP or
self.type==AUFTRAG.Type.AWACS or self.type==AUFTRAG.Type.AWACS or
self.type==AUFTRAG.Type.TANKER then self.type==AUFTRAG.Type.TANKER then

View File

@ -53,7 +53,7 @@
-- --
-- === -- ===
-- --
-- ![Banner Image](..\Presentations\FlightGroup\FLIGHTGROUP_Main.jpg) -- ![Banner Image](..\Presentations\OPS\FlightGroup\_Main.png)
-- --
-- # The FLIGHTGROUP Concept -- # The FLIGHTGROUP Concept
-- --
@ -116,7 +116,7 @@ FLIGHTGROUP = {
homezone = nil, homezone = nil,
destzone = nil, destzone = nil,
actype = nil, actype = nil,
speedmax = nil, speedMax = nil,
rangemax = nil, rangemax = nil,
ceiling = nil, ceiling = nil,
fuellow = false, fuellow = false,
@ -2406,7 +2406,7 @@ function FLIGHTGROUP:onafterFuelCritical(From, Event, To)
end end
end end
--- On after Start event. Starts the FLIGHTGROUP FSM and event handlers. --- On after "Stop" event.
-- @param #FLIGHTGROUP self -- @param #FLIGHTGROUP self
-- @param #string From From state. -- @param #string From From state.
-- @param #string Event Event. -- @param #string Event Event.
@ -2439,11 +2439,14 @@ function FLIGHTGROUP:onafterStop(From, Event, To)
self:UnHandleEvent(EVENTS.Crash) self:UnHandleEvent(EVENTS.Crash)
self:UnHandleEvent(EVENTS.RemoveUnit) self:UnHandleEvent(EVENTS.RemoveUnit)
-- Stop check timers.
self.timerCheckZone:Stop() self.timerCheckZone:Stop()
self.timerQueueUpdate:Stop() self.timerQueueUpdate:Stop()
-- Stop FSM scheduler.
self.CallScheduler:Clear() self.CallScheduler:Clear()
-- Remove flight from data base.
_DATABASE.FLIGHTGROUPS[self.groupname]=nil _DATABASE.FLIGHTGROUPS[self.groupname]=nil
self:I(self.lid.."STOPPED! Unhandled events, cleared scheduler and removed from database.") self:I(self.lid.."STOPPED! Unhandled events, cleared scheduler and removed from database.")
@ -2530,13 +2533,13 @@ function FLIGHTGROUP:_InitGroup()
self.isLateActivated=self.template.lateActivation self.isLateActivated=self.template.lateActivation
-- Max speed in km/h. -- Max speed in km/h.
self.speedmax=group:GetSpeedMax() self.speedMax=group:GetSpeedMax()
-- Cruise speed limit 350 kts for fixed and 80 knots for rotary wings. -- Cruise speed limit 350 kts for fixed and 80 knots for rotary wings.
local speedCruiseLimit=self.ishelo and UTILS.KnotsToKmph(80) or UTILS.KnotsToKmph(350) local speedCruiseLimit=self.ishelo and UTILS.KnotsToKmph(80) or UTILS.KnotsToKmph(350)
-- Cruise speed: 70% of max speed but within limit. -- Cruise speed: 70% of max speed but within limit.
self.speedCruise=math.min(self.speedmax*0.7, speedCruiseLimit) self.speedCruise=math.min(self.speedMax*0.7, speedCruiseLimit)
-- Group ammo. -- Group ammo.
self.ammo=self:GetAmmoTot() self.ammo=self:GetAmmoTot()
@ -2602,7 +2605,7 @@ function FLIGHTGROUP:_InitGroup()
if self.verbose>=1 then if self.verbose>=1 then
local text=string.format("Initialized Flight Group %s:\n", self.groupname) local text=string.format("Initialized Flight Group %s:\n", self.groupname)
text=text..string.format("Unit type = %s\n", self.actype) text=text..string.format("Unit type = %s\n", self.actype)
text=text..string.format("Speed max = %.1f Knots\n", UTILS.KmphToKnots(self.speedmax)) text=text..string.format("Speed max = %.1f Knots\n", UTILS.KmphToKnots(self.speedMax))
text=text..string.format("Range max = %.1f km\n", self.rangemax/1000) text=text..string.format("Range max = %.1f km\n", self.rangemax/1000)
text=text..string.format("Ceiling = %.1f feet\n", UTILS.MetersToFeet(self.ceiling)) text=text..string.format("Ceiling = %.1f feet\n", UTILS.MetersToFeet(self.ceiling))
text=text..string.format("Tanker type = %s\n", tostring(self.tankertype)) text=text..string.format("Tanker type = %s\n", tostring(self.tankertype))

View File

@ -29,7 +29,7 @@
-- --
-- === -- ===
-- --
-- ![Banner Image](..\Presentations\NAVYGROUP\NavyGroup_Main.jpg) -- ![Banner Image](..\Presentations\OPS\NavyGroup\_Main.png)
-- --
-- # The NAVYGROUP Concept -- # The NAVYGROUP Concept
-- --
@ -462,7 +462,7 @@ function NAVYGROUP:onafterStatus(From, Event, To)
local turning=tostring(self:IsTurning()) local turning=tostring(self:IsTurning())
local alt=self.position.y local alt=self.position.y
local speed=UTILS.MpsToKnots(self.velocity) local speed=UTILS.MpsToKnots(self.velocity)
local speedExpected=UTILS.MpsToKnots(self.speed or 0) local speedExpected=UTILS.MpsToKnots(self.speedWp or 0)
local wpidxCurr=self.currentwp local wpidxCurr=self.currentwp
local wpuidCurr=0 local wpuidCurr=0
@ -628,7 +628,7 @@ function NAVYGROUP:onafterUpdateRoute(From, Event, To, n, Speed, Depth)
end end
-- Current set speed in m/s. -- Current set speed in m/s.
self.speed=wp.speed self.speedWp=wp.speed
-- Current set depth. -- Current set depth.
depth=wp.alt depth=wp.alt
@ -649,14 +649,14 @@ function NAVYGROUP:onafterUpdateRoute(From, Event, To, n, Speed, Depth)
end end
-- Current waypoint. -- Current waypoint.
local current=self:GetCoordinate():WaypointNaval(UTILS.MpsToKmph(self.speed), depth) local current=self:GetCoordinate():WaypointNaval(UTILS.MpsToKmph(self.speedWp), depth)
table.insert(waypoints, 1, current) table.insert(waypoints, 1, current)
if #waypoints>1 then if #waypoints>1 then
self:T(self.lid..string.format("Updateing route: WP %d-->%d-->%d (#%d), Speed=%.1f knots, Depth=%d m", self:T(self.lid..string.format("Updateing route: WP %d-->%d-->%d (#%d), Speed=%.1f knots, Depth=%d m",
self.currentwp, n, #self.waypoints, #waypoints-1, UTILS.MpsToKnots(self.speed), depth)) self.currentwp, n, #self.waypoints, #waypoints-1, UTILS.MpsToKnots(self.speedWp), depth))
-- Route group to all defined waypoints remaining. -- Route group to all defined waypoints remaining.
@ -935,6 +935,11 @@ function NAVYGROUP:onafterStop(From, Event, To)
self:UnHandleEvent(EVENTS.Dead) self:UnHandleEvent(EVENTS.Dead)
self:UnHandleEvent(EVENTS.RemoveUnit) self:UnHandleEvent(EVENTS.RemoveUnit)
-- Stop check timers.
self.timerCheckZone:Stop()
self.timerQueueUpdate:Stop()
-- Stop FSM scheduler.
self.CallScheduler:Clear() self.CallScheduler:Clear()
self:I(self.lid.."STOPPED! Unhandled events, cleared scheduler and removed from database.") self:I(self.lid.."STOPPED! Unhandled events, cleared scheduler and removed from database.")
@ -1117,10 +1122,10 @@ function NAVYGROUP:_InitGroup()
self.isUncontrolled=false self.isUncontrolled=false
-- Max speed in km/h. -- Max speed in km/h.
self.speedmax=self.group:GetSpeedMax() self.speedMax=self.group:GetSpeedMax()
-- Cruise speed: 70% of max speed. -- Cruise speed: 70% of max speed.
self.speedCruise=self.speedmax*0.7 self.speedCruise=self.speedMax*0.7
-- Group ammo. -- Group ammo.
self.ammo=self:GetAmmoTot() self.ammo=self:GetAmmoTot()
@ -1170,7 +1175,7 @@ function NAVYGROUP:_InitGroup()
-- Debug info. -- Debug info.
local text=string.format("Initialized Navy Group %s:\n", self.groupname) local text=string.format("Initialized Navy Group %s:\n", self.groupname)
text=text..string.format("Unit type = %s\n", self.actype) text=text..string.format("Unit type = %s\n", self.actype)
text=text..string.format("Speed max = %.1f Knots\n", UTILS.KmphToKnots(self.speedmax)) text=text..string.format("Speed max = %.1f Knots\n", UTILS.KmphToKnots(self.speedMax))
text=text..string.format("Speed cruise = %.1f Knots\n", UTILS.KmphToKnots(self.speedCruise)) text=text..string.format("Speed cruise = %.1f Knots\n", UTILS.KmphToKnots(self.speedCruise))
text=text..string.format("Elements = %d\n", #self.elements) text=text..string.format("Elements = %d\n", #self.elements)
text=text..string.format("Waypoints = %d\n", #self.waypoints) text=text..string.format("Waypoints = %d\n", #self.waypoints)

View File

@ -38,8 +38,9 @@
-- @field #number currentmission The ID (auftragsnummer) of the currently assigned AUFTRAG. -- @field #number currentmission The ID (auftragsnummer) of the currently assigned AUFTRAG.
-- @field Core.Set#SET_UNIT detectedunits Set of detected units. -- @field Core.Set#SET_UNIT detectedunits Set of detected units.
-- @field #string attribute Generalized attribute. -- @field #string attribute Generalized attribute.
-- @field #number speedmax Max speed in km/h. -- @field #number speedMax Max speed in km/h.
-- @field #number speedCruise Cruising speed in km/h. -- @field #number speedCruise Cruising speed in km/h.
-- @field #number speedWp Speed to the next waypoint in km/h.
-- @field #boolean passedfinalwp Group has passed the final waypoint. -- @field #boolean passedfinalwp Group has passed the final waypoint.
-- @field #number wpcounter Running number counting waypoints. -- @field #number wpcounter Running number counting waypoints.
-- @field #boolean respawning Group is being respawned. -- @field #boolean respawning Group is being respawned.
@ -81,7 +82,7 @@
-- --
-- === -- ===
-- --
-- ![Banner Image](..\Presentations\OPSGROUP\OpsGroup_Main.jpg) -- ![Banner Image](..\Presentations\OPS\OpsGroup\_Main.png)
-- --
-- # The OPSGROUP Concept -- # The OPSGROUP Concept
-- --
@ -427,7 +428,7 @@ end
-- @param #OPSGROUP self -- @param #OPSGROUP self
-- @return #number Cruise speed (>0) in knots. -- @return #number Cruise speed (>0) in knots.
function OPSGROUP:GetSpeedCruise() function OPSGROUP:GetSpeedCruise()
return UTILS.KmphToKnots(self.speedCruise or self.speedmax*0.7) return UTILS.KmphToKnots(self.speedCruise or self.speedMax*0.7)
end end
--- Set detection on or off. --- Set detection on or off.
@ -482,13 +483,81 @@ function OPSGROUP:GetName()
return self.groupname return self.groupname
end end
--- Get DCS GROUP object.
-- @param #OPSGROUP self
-- @return DCS#Group DCS group object.
function OPSGROUP:GetDCSGroup()
local DCSGroup=Group.getByName(self.groupname)
return DCSGroup
end
--- Get DCS GROUP object.
-- @param #OPSGROUP self
-- @return DCS#Group DCS group object.
function OPSGROUP:GetUnit(UnitNumber)
local DCSGroup=Group.getByName(self.groupname)
return DCSGroup
end
--- Get DCS GROUP object.
-- @param #OPSGROUP self
-- @param #number UnitNumber Number of the unit in the group. Default first unit.
-- @return DCS#Unit DCS group object.
function OPSGROUP:GetDCSUnit(UnitNumber)
local DCSGroup=self:GetDCSGroup()
if DCSGroup then
local unit=DCSGroup:getUnit(UnitNumber or 1)
return unit
end
return nil
end
--- Despawn group.
-- @param #OPSGROUP self
-- @return #OPSGROUP self
function OPSGROUP:DespawnGroup()
local DCSGroup=self:GetDCSGroup()
if DCSGroup then
DCSGroup:destroy()
end
return self
end
--- Despawn a unit.
-- @param #OPSGROUP self
-- @return #OPSGROUP self
function OPSGROUP:DespawnUnit(UnitName)
local DCSGroup=self:GetDCSGroup()
if DCSGroup then
DCSGroup:destroy()
end
return self
end
--- Get current 3D vector of the group. --- Get current 3D vector of the group.
-- @param #OPSGROUP self -- @param #OPSGROUP self
-- @return DCS#Vec3 Vector with x,y,z components. -- @return DCS#Vec3 Vector with x,y,z components.
function OPSGROUP:GetVec3() function OPSGROUP:GetVec3()
if self:IsAlive()~=nil then if self:IsExist() then
local vec3=self.group:GetVec3()
return vec3 local unit=self:GetDCSUnit()
if unit then
local vec3=unit:getPoint()
return vec3
end
end end
return nil return nil
end end
@ -520,11 +589,21 @@ end
-- @param #OPSGROUP self -- @param #OPSGROUP self
-- @return #number Velocity in m/s. -- @return #number Velocity in m/s.
function OPSGROUP:GetVelocity() function OPSGROUP:GetVelocity()
if self:IsAlive()~=nil then if self:IsExist() then
local vel=self.group:GetVelocityMPS()
return vel local unit=self:GetDCSUnit(1)
if unit then
local velvec3=unit:getVelocity()
local vel=UTILS.VecNorm(velvec3)
return vel
end
else else
self:E(self.lid.."WARNING: Group is not alive. Cannot get velocity!") self:E(self.lid.."WARNING: Group does not exist. Cannot get velocity!")
end end
return nil return nil
end end
@ -533,12 +612,30 @@ end
-- @param #OPSGROUP self -- @param #OPSGROUP self
-- @return #number Current heading of the group in degrees. -- @return #number Current heading of the group in degrees.
function OPSGROUP:GetHeading() function OPSGROUP:GetHeading()
if self:IsAlive()~=nil then
local heading=self.group:GetHeading() if self:IsExist() then
return heading
local unit=self:GetDCSUnit()
if unit then
local pos=unit:getPosition()
local heading=math.atan2(pos.x.z, pos.x.x)
if heading<0 then
heading=heading+ 2*math.pi
end
heading=math.deg(heading)
return heading
end
else else
self:E(self.lid.."WARNING: Group is not alive. Cannot get heading!") self:E(self.lid.."WARNING: Group does not exist. Cannot get heading!")
end end
return nil return nil
end end
@ -615,6 +712,29 @@ function OPSGROUP:SelfDestruction(Delay, ExplosionPower)
end end
--- Check if group is exists.
-- @param #OPSGROUP self
-- @return #boolean If true, the group exists or false if the group does not exist. If nil, the DCS group could not be found.
function OPSGROUP:IsExist()
local DCSGroup=self:GetDCSGroup()
if DCSGroup then
local exists=DCSGroup:isExist()
return exists
end
return nil
end
--- Check if group is activated.
-- @param #OPSGROUP self
-- @return #boolean If true, the group exists or false if the group does not exist. If nil, the DCS group could not be found.
function OPSGROUP:IsActive()
end
--- Check if group is alive. --- Check if group is alive.
-- @param #OPSGROUP self -- @param #OPSGROUP self
-- @return #boolean *true* if group is exists and is activated, *false* if group is exist but is NOT activated. *nil* otherwise, e.g. the GROUP object is *nil* or the group is not spawned yet. -- @return #boolean *true* if group is exists and is activated, *false* if group is exist but is NOT activated. *nil* otherwise, e.g. the GROUP object is *nil* or the group is not spawned yet.
@ -1001,7 +1121,7 @@ function OPSGROUP:GetExpectedSpeed()
if self:IsHolding() then if self:IsHolding() then
return 0 return 0
else else
return self.speed or 0 return self.speedWp or 0
end end
end end
@ -2804,7 +2924,7 @@ function OPSGROUP:InitWaypoints()
local speedknots=UTILS.MpsToKnots(wp.speed) local speedknots=UTILS.MpsToKnots(wp.speed)
if index==1 then if index==1 then
self.speed=wp.speed self.speedWp=wp.speed
end end
self:AddWaypoint(coordinate, speedknots, index-1, nil, false) self:AddWaypoint(coordinate, speedknots, index-1, nil, false)

View File

@ -52,7 +52,7 @@
-- --
-- === -- ===
-- --
-- ![Banner Image](..\Presentations\Squadron\SQUADRON_Main.jpg) -- ![Banner Image](..\Presentations\OPS\Squadron\_Main.png)
-- --
-- # The SQUADRON Concept -- # The SQUADRON Concept
-- --
@ -838,12 +838,12 @@ function SQUADRON:RecruitAssets(Mission, Npayloads)
-- Asset is already on a mission. -- Asset is already on a mission.
--- ---
-- Check if this asset is currently on a GCCAP mission (STARTED or EXECUTING). -- Check if this asset is currently on a GCICAP mission (STARTED or EXECUTING).
if self.airwing:IsAssetOnMission(asset, AUFTRAG.Type.GCCAP) and Mission.type==AUFTRAG.Type.INTERCEPT then if self.airwing:IsAssetOnMission(asset, AUFTRAG.Type.GCICAP) and Mission.type==AUFTRAG.Type.INTERCEPT then
-- Check if the payload of this asset is compatible with the mission. -- Check if the payload of this asset is compatible with the mission.
-- Note: we do not check the payload as an asset that is on a GCCAP mission should be able to do an INTERCEPT as well! -- Note: we do not check the payload as an asset that is on a GCICAP mission should be able to do an INTERCEPT as well!
self:I(self.lid.."Adding asset on GCCAP mission for an INTERCEPT mission") self:I(self.lid.."Adding asset on GCICAP mission for an INTERCEPT mission")
table.insert(assets, asset) table.insert(assets, asset)
end end

View File

@ -32,7 +32,7 @@
-- --
-- === -- ===
-- --
-- ![Banner Image](..\Presentations\WingCommander\TARGET_Main.jpg) -- ![Banner Image](..\Presentations\OPS\Target\_Main.pngs)
-- --
-- # The TARGET Concept -- # The TARGET Concept
-- --