diff --git a/Moose Development/Moose/Ops/Airboss.lua b/Moose Development/Moose/Ops/Airboss.lua index ba5f1e3a3..1d2adfbd2 100644 --- a/Moose Development/Moose/Ops/Airboss.lua +++ b/Moose Development/Moose/Ops/Airboss.lua @@ -12123,16 +12123,18 @@ function AIRBOSS:_LSOgrade( playerData ) local GIC, nIC = self:_Flightdata2Text( playerData, AIRBOSS.GroovePos.IC ) local GAR, nAR = self:_Flightdata2Text( playerData, AIRBOSS.GroovePos.AR ) + -- VTOL approach, which is graded differently (currently only Harrier). + local vtol=playerData.actype==AIRBOSS.AircraftCarrier.AV8B + -- Put everything together. local G = GXX .. " " .. GIM .. " " .. " " .. GIC .. " " .. GAR - -- Count number of minor, normal and major deviations. + -- Count number of minor/small nS, normal nN and major/large deviations nL. local N=nXX+nIM+nIC+nAR - local Nv=nXX+nIM local nL=count(G, '_')/2 local nS=count(G, '%(') local nN=N-nS-nL - local nNv=Nv-nS-nL + -- Groove time 15-18.99 sec for a unicorn. Or 60-65 for V/STOL unicorn. local Tgroove=playerData.Tgroove @@ -12148,34 +12150,64 @@ function AIRBOSS:_LSOgrade( playerData ) G = "Unicorn" else - -- Add AV-8B Harrier devation allowances due to lower groundspeed and 3x conventional groove time, this allows to maintain LSO tolerances while respecting the deviations are not unsafe.--Pene testing - -- Large devaitions still result in a No Grade, A Unicorn still requires a clean pass with no deviation. - if nL > 1 and playerData.actype==AIRBOSS.AircraftCarrier.AV8B then - -- Larger deviations ==> "No grade" 2.0 points. - grade="--" - points=2.0 - elseif nNv >= 1 and playerData.actype==AIRBOSS.AircraftCarrier.AV8B then - -- Only average deviations ==> "Fair Pass" Pass with average deviations and corrections. - grade="(OK)" - points=3.0 - elseif nNv < 1 and playerData.actype==AIRBOSS.AircraftCarrier.AV8B then - -- Only minor average deviations ==> "OK" Pass with minor deviations and corrections. (test nNv<=1 and) - grade="OK" - points=4.0 - elseif nL > 0 then - -- Larger deviations ==> "No grade" 2.0 points. - grade="--" - points=2.0 - elseif nN> 0 then - -- No larger but average deviations ==> "Fair Pass" Pass with average deviations and corrections. - grade="(OK)" - points=3.0 - else - -- Only minor corrections - grade="OK" - points=4.0 - end + if vtol then + -- Add AV-8B Harrier devation allowances due to lower groundspeed and 3x conventional groove time, this allows to maintain LSO tolerances while respecting the deviations are not unsafe.--Pene testing + -- Large devaitions still result in a No Grade, A Unicorn still requires a clean pass with no deviation. + + -- Normal laning part at the beginning + local Gb = GXX .. " " .. GIM + + -- Number of deviations that occurred at the the beginning of the landing (XX or IM). These are graded like in non-VTOL landings, i.e. on deviations is + local N=nXX+nIM + local nL=count(Gb, '_')/2 + local nS=count(Gb, '%(') + local nN=N-nS-nL + + + -- VTOL part of the landing + local Gv = GIC .. " " .. GAR + + -- Number of deviations that occurred at the the end (VTOL part) of the landing (IC or AR). + local Nv=nIC+nAR + local nLv=count(Gv, '_')/2 + local nSv=count(Gv, '%(') + local nNv=Nv-nSv-nLv + + if nL>0 or nLv>1 then + -- Larger deviations at XX or IM or at least one larger deviation IC or AR==> "No grade" 2.0 points. + -- In other words, we allow one larger deviation at IC+AR + grade="--" + points=2.0 + elseif nN>0 or nNv>1 or nLv==1 then + -- Average deviations at XX+IM or more than one normal deviation IC or AR ==> "Fair Pass" Pass with average deviations and corrections. + grade="(OK)" + points=3.0 + else + -- Only minor corrections + grade="OK" + points=4.0 + end + + else + + -- This is a normal (non-VTOL) landing. + + if nL > 0 then + -- Larger deviations ==> "No grade" 2.0 points. + grade="--" + points=2.0 + elseif nN> 0 then + -- No larger but average/normal deviations ==> "Fair Pass" Pass with average deviations and corrections. + grade="(OK)" + points=3.0 + else + -- Only minor corrections ==> "Okay pass" 4.0 points. + grade="OK" + points=4.0 + end + + end end -- Replace" )"( and "__" diff --git a/Moose Development/Moose/Utilities/Utils.lua b/Moose Development/Moose/Utilities/Utils.lua index 98425d7c8..259f6d223 100644 --- a/Moose Development/Moose/Utilities/Utils.lua +++ b/Moose Development/Moose/Utilities/Utils.lua @@ -825,6 +825,64 @@ UTILS.tostringLL = function( lat, lon, acc, DMS) end end +--[[acc: +in DM: decimal point of minutes. +In DMS: decimal point of seconds. +position after the decimal of the least significant digit: +So: +42.32 - acc of 2. +]] +UTILS.tostringLLM2KData = function( lat, lon, acc) + + local latHemi, lonHemi + if lat > 0 then + latHemi = 'N' + else + latHemi = 'S' + end + + if lon > 0 then + lonHemi = 'E' + else + lonHemi = 'W' + end + + lat = math.abs(lat) + lon = math.abs(lon) + + local latDeg = math.floor(lat) + local latMin = (lat - latDeg)*60 + + local lonDeg = math.floor(lon) + local lonMin = (lon - lonDeg)*60 + + -- degrees, decimal minutes. + latMin = UTILS.Round(latMin, acc) + lonMin = UTILS.Round(lonMin, acc) + + if latMin == 60 then + latMin = 0 + latDeg = latDeg + 1 + end + + if lonMin == 60 then + lonMin = 0 + lonDeg = lonDeg + 1 + end + + local minFrmtStr -- create the formatting string for the minutes place + if acc <= 0 then -- no decimal place. + minFrmtStr = '%02d' + else + local width = 3 + acc -- 01.310 - that's a width of 6, for example. + minFrmtStr = '%0' .. width .. '.' .. acc .. 'f' + end + + -- 024 23'N or 024 23.123'N + return latHemi..string.format('%02d:', latDeg) .. string.format(minFrmtStr, latMin), lonHemi..string.format('%02d:', lonDeg) .. string.format(minFrmtStr, lonMin) + +end + -- acc- the accuracy of each easting/northing. 0, 1, 2, 3, 4, or 5. UTILS.tostringMGRS = function(MGRS, acc) --R2.1