Add cap amount graph
This commit is contained in:
24
eos/graph/fitCapRegenRelative.py
Normal file
24
eos/graph/fitCapRegenRelative.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import math
|
||||
from logbook import Logger
|
||||
|
||||
from eos.graph import Graph
|
||||
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class FitCapRegenRelativeGraph(Graph):
|
||||
|
||||
defaults = {"percentage": '0-100'}
|
||||
|
||||
def __init__(self, fit, data=None):
|
||||
Graph.__init__(self, fit, self.calcRegen, data if data is not None else self.defaults)
|
||||
self.fit = fit
|
||||
|
||||
def calcRegen(self, data):
|
||||
perc = data["percentage"]
|
||||
maxCap = self.fit.ship.getModifiedItemAttr('capacitorCapacity')
|
||||
regenTime = self.fit.ship.getModifiedItemAttr('rechargeRate') / 1000
|
||||
currentCap = maxCap * perc / 100
|
||||
regen = 10 * maxCap / regenTime * (math.sqrt(currentCap / maxCap) - currentCap / maxCap)
|
||||
return regen
|
||||
Reference in New Issue
Block a user