mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Ops
This commit is contained in:
parent
114032a743
commit
dee7307adc
@ -1604,8 +1604,9 @@ function AIRWING:onafterAssetSpawned(From, Event, To, group, asset, request)
|
||||
flightgroup:SwitchRadio(radioFreq, radioModu)
|
||||
end
|
||||
|
||||
-- Set RTB on fuel critical.
|
||||
flightgroup:SetFuelCriticalThreshold()
|
||||
if squadron.fuellow then
|
||||
flightgroup:SetFuelCriticalThreshold(squadron.fuellow)
|
||||
end
|
||||
|
||||
---
|
||||
-- Mission
|
||||
|
||||
@ -1425,7 +1425,7 @@ end
|
||||
-- @param #AUFTRAG self
|
||||
-- @param #number Nrepeat Number of repeats. Default 0.
|
||||
-- @return #AUFTRAG self
|
||||
function AUFTRAG:SetRepeatOnFailure(Nrepeat)
|
||||
function AUFTRAG:SetRepeat(Nrepeat)
|
||||
self.Nrepeat=Nrepeat or 0
|
||||
return self
|
||||
end
|
||||
@ -2599,19 +2599,25 @@ function AUFTRAG:onafterSuccess(From, Event, To)
|
||||
self.status=AUFTRAG.Status.SUCCESS
|
||||
self:T(self.lid..string.format("New mission status=%s", self.status))
|
||||
|
||||
if self.repeatedSuccess>=self.NrepeatSuccess then
|
||||
local repeatme=self.repeatedFailure<self.NrepeatFailure or self.repeated<self.Nrepeat
|
||||
|
||||
-- Stop mission.
|
||||
self:I(self.lid..string.format("Mission SUCCESS! Number of max repeats reached [%d>=%d] ==> Stopping mission!", self.repeatedSuccess, self.NrepeatSuccess))
|
||||
self:Stop()
|
||||
if repeatme then
|
||||
|
||||
-- Increase counter.
|
||||
self.repeatedSuccess=self.repeatedSuccess+1
|
||||
|
||||
-- Number of repeats.
|
||||
local N=math.max(self.NrepeatSuccess, self.Nrepeat)
|
||||
|
||||
-- Repeat mission.
|
||||
self:I(self.lid..string.format("Mission SUCCESS! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.repeated+1, N))
|
||||
self:Repeat()
|
||||
|
||||
else
|
||||
|
||||
self.repeatedSuccess=self.repeatedSuccess+1
|
||||
|
||||
-- Repeat mission.
|
||||
self:I(self.lid..string.format("Mission SUCCESS! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.repeatedSuccess, self.NrepeatSuccess))
|
||||
self:Repeat()
|
||||
-- Stop mission.
|
||||
self:I(self.lid..string.format("Mission SUCCESS! Number of max repeats %d reached ==> Stopping mission!", self.repeated+1))
|
||||
self:Stop()
|
||||
|
||||
end
|
||||
|
||||
@ -2629,19 +2635,21 @@ function AUFTRAG:onafterFailed(From, Event, To)
|
||||
|
||||
local repeatme=self.repeatedFailure<self.NrepeatFailure or self.repeated<self.Nrepeat
|
||||
|
||||
if self.repeatedFailure>=self.NrepeatFailure then
|
||||
if repeatme then
|
||||
|
||||
-- Increase counter.
|
||||
self.repeatedFailure=self.repeatedFailure+1
|
||||
|
||||
-- Number of repeats.
|
||||
local N=math.max(self.NrepeatFailure, self.Nrepeat)
|
||||
|
||||
-- Repeat mission.
|
||||
self:I(self.lid..string.format("Mission FAILED! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.repeated+1, N))
|
||||
self:Repeat()
|
||||
|
||||
|
||||
else
|
||||
|
||||
-- Stop mission.
|
||||
self:I(self.lid..string.format("Mission FAILED! Number of max repeats %d reached ==> Stopping mission!", self.repeated+1))
|
||||
self:Stop()
|
||||
|
||||
|
||||
@ -226,6 +226,7 @@ function FLIGHTGROUP:New(group)
|
||||
self.lid=string.format("FLIGHTGROUP %s | ", self.groupname)
|
||||
|
||||
-- Defaults
|
||||
self:SetVerbosity(3)
|
||||
self:SetFuelLowThreshold()
|
||||
self:SetFuelLowRTB()
|
||||
self:SetFuelCriticalThreshold()
|
||||
|
||||
@ -3227,22 +3227,15 @@ function OPSGROUP:TurnOffTACAN()
|
||||
|
||||
end
|
||||
|
||||
|
||||
--- Set default ICLS parameters.
|
||||
--- Get current TACAN parameters.
|
||||
-- @param #OPSGROUP self
|
||||
-- @param #number Channel ICLS channel.
|
||||
-- @param #string Morse Morse code. Default "XXX".
|
||||
-- @param #string UnitName Name of the unit acting as beacon.
|
||||
-- @param #string Band ICLS mode. Default is "X" for ground and "Y" for airborne units.
|
||||
-- @return #OPSGROUP self
|
||||
function OPSGROUP:SetDefaultICLS(Channel, Morse, UnitName)
|
||||
|
||||
self.iclsDefault={}
|
||||
self.iclsDefault.Channel=Channel
|
||||
self.iclsDefault.Morse=Morse or "XXX"
|
||||
self.iclsDefault.BeaconName=UnitName
|
||||
|
||||
return self
|
||||
-- @return #number TACAN channel.
|
||||
-- @return #string TACAN Morse code.
|
||||
-- @return #string TACAN band ("X" or "Y").
|
||||
-- @return #boolean TACAN is On (true) or Off (false).
|
||||
-- @return #string UnitName Name of the unit acting as beacon.
|
||||
function OPSGROUP:GetTACAN()
|
||||
return self.tacan.Channel, self.tacan.Morse, self.tacan.Band, self.tacan.On, self.tacan.BeaconName
|
||||
end
|
||||
|
||||
--- Activate/switch ICLS beacon settings.
|
||||
|
||||
@ -41,9 +41,7 @@
|
||||
-- @field #string attribute Generalized attribute of the squadron template group.
|
||||
-- @field #number tankerSystem For tanker squads, the refuel system used (boom=0 or probpe=1). Default nil.
|
||||
-- @field #number refuelSystem For refuelable squads, the refuel system used (boom=0 or probpe=1). Default nil.
|
||||
-- @field #number TACANmin TACAN min channel.
|
||||
-- @field #number TACANmax TACAN max channel.
|
||||
-- @field #table TACANused Table of used TACAN channels.
|
||||
-- @field #table tacanChannel List of TACAN channels available to the squadron.
|
||||
-- @field #number radioFreq Radio frequency in MHz the squad uses.
|
||||
-- @field #number radioModu Radio modulation the squad uses.
|
||||
-- @extends Core.Fsm#FSM
|
||||
@ -84,9 +82,7 @@ SQUADRON = {
|
||||
engageRange = nil,
|
||||
tankerSystem = nil,
|
||||
refuelSystem = nil,
|
||||
TACANmin = nil,
|
||||
TACANmax = nil,
|
||||
TACANused = {},
|
||||
tacanChannel = {},
|
||||
}
|
||||
|
||||
--- SQUADRON class version.
|
||||
@ -399,7 +395,7 @@ end
|
||||
-- @param #SQUADRON self
|
||||
-- @param #number LowFuel Low fuel threshold in percent. Default 25.
|
||||
-- @return #SQUADRON self
|
||||
function SQUADRON:SetLowFuelThreshold(LowFuel)
|
||||
function SQUADRON:SetFuelLowThreshold(LowFuel)
|
||||
self.fuellow=LowFuel or 25
|
||||
return self
|
||||
end
|
||||
|
||||
@ -289,10 +289,10 @@ function PROFILER.showTable(data, f, runTimeGame)
|
||||
-- Calls per second.
|
||||
local cps=t.count/runTimeGame
|
||||
|
||||
if (cps>=PROFILER.lowCpsThres) then
|
||||
if cps>=PROFILER.lowCpsThres then
|
||||
|
||||
-- Output
|
||||
local text=string.format("%30s: %8d calls %8.1f/sec - Time %8.3f sec (%.3f %%) %s line %s", t.func, t.count, cps, t.tm, t.tm/runTimeGame*100, tostring(t.src), tostring(t.line))
|
||||
local text=string.format("%30s: %8d calls %8.1f/sec - Time Total %8.3f sec (%.3f %%) - Per call %5.3f sec %s line %s", t.func, t.count, cps, t.tm, t.tm/runTimeGame*100, t.tm/t.count, tostring(t.src), tostring(t.line))
|
||||
PROFILER._flog(f, text)
|
||||
|
||||
end
|
||||
@ -456,6 +456,19 @@ function PROFILER.showInfo(runTimeGame, runTimeOS)
|
||||
PROFILER._flog(f,"")
|
||||
PROFILER.showTable(t, f, runTimeGame)
|
||||
|
||||
-- Sort by number of calls.
|
||||
table.sort(t, function(a,b) return a.tm/a.count>b.tm/b.count end)
|
||||
|
||||
-- Detailed data.
|
||||
PROFILER._flog(f,"")
|
||||
PROFILER._flog(f,"************************************************************************************************************************")
|
||||
PROFILER._flog(f,"")
|
||||
PROFILER._flog(f,"--------------------------------------")
|
||||
PROFILER._flog(f,"---- Data Sorted by Time per Call ----")
|
||||
PROFILER._flog(f,"--------------------------------------")
|
||||
PROFILER._flog(f,"")
|
||||
PROFILER.showTable(t, f, runTimeGame)
|
||||
|
||||
-- Sort by number of calls.
|
||||
table.sort(t, function(a,b) return a.count>b.count end)
|
||||
|
||||
@ -463,9 +476,9 @@ function PROFILER.showInfo(runTimeGame, runTimeOS)
|
||||
PROFILER._flog(f,"")
|
||||
PROFILER._flog(f,"************************************************************************************************************************")
|
||||
PROFILER._flog(f,"")
|
||||
PROFILER._flog(f,"------------------------------")
|
||||
PROFILER._flog(f,"---- Data Sorted by Calls ----")
|
||||
PROFILER._flog(f,"------------------------------")
|
||||
PROFILER._flog(f,"------------------------------------")
|
||||
PROFILER._flog(f,"---- Data Sorted by Total Calls ----")
|
||||
PROFILER._flog(f,"------------------------------------")
|
||||
PROFILER._flog(f,"")
|
||||
PROFILER.showTable(t, f, runTimeGame)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user