Add cap amount graph

This commit is contained in:
DarkPhoenix
2019-05-12 14:40:57 +03:00
parent ac132cbb92
commit 672141cffc
3 changed files with 108 additions and 1 deletions

View 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