local function GetRand(MAX)
    return math.random(1, MAX)
end

local function GetVolts(Amps, Ohms)
    return Amps * Ohms -- Amps times Resitance = Volts/Voltage
end

local function GetWattsHour(Amps, Volts)
    return Amps * Volts -- Amps times Volts = Watts-hour
end

local function GetMilliAmpHour(Amps) -- FROMULA: (Wh)*1000/(V) =(mAh) or Wattage/hour * 1000 divided by Volts
    local Volts = GetVolts(Amps, GetRand(120))
    local Wattage = GetWattsHour(Amps, Volts)

    return Wattage * 1000 / Volts
end

local function GetPercentage(Value)
    return math.floor((Value * 100) + 0.5)
end

local function GetNormalChargeCapacity()
    return GetMilliAmpHour(GetRand(100))
end

local function GetMaximumFCC()
    return GetMilliAmpHour(GetRand(100))
end

local last_value_NormalChargeCapacity = GetNormalChargeCapacity()
local last_value_MaximumFCC = GetMaximumFCC()

local last_value_BatteryHealth = last_value_NormalChargeCapacity / last_value_MaximumFCC

local function ConvertMaxPercentage(Value)
    local last_value_TARGET = 1.0000001
    
    if Value >= last_value_TARGET then
        print("NUMBER GREATER THAN TARGET (" .. last_value_TARGET .. "); RETURNING\n")

        print("NOR_CC: " .. last_value_NormalChargeCapacity)
        print("MAX_FCC: " .. last_value_MaximumFCC)
        print("LAST_VAL: " .. Value)
        
        return
    else
        print("CONVERTING...")

        print("NOR_CC: " .. last_value_NormalChargeCapacity)
        print("MAX_FCC: " .. last_value_MaximumFCC)
            
        print("LAST_VAL: " .. Value)
        print("CONV: " .. Value * 100)


        print(GetPercentage(Value) .. "%")
        
        return Value
    end
end

ConvertMaxPercentage(last_value_BatteryHealth)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: