Add speed vs time graph

This commit is contained in:
DarkPhoenix
2019-05-12 15:46:50 +03:00
parent 74444d56c4
commit d777999af4
7 changed files with 117 additions and 6 deletions

View File

@@ -12,12 +12,13 @@ class FitCapAmountTimeGraph(Graph):
defaults = {"time": 0}
def __init__(self, fit, data=None):
Graph.__init__(self, fit, self.calcRegen, data if data is not None else self.defaults)
Graph.__init__(self, fit, self.calcAmount, data if data is not None else self.defaults)
self.fit = fit
def calcRegen(self, data):
def calcAmount(self, data):
time = data["time"]
maxCap = self.fit.ship.getModifiedItemAttr('capacitorCapacity')
regenTime = self.fit.ship.getModifiedItemAttr('rechargeRate') / 1000
cap = maxCap * (1 + math.e ** ((5 * -time) / regenTime) * -1) ** 2
# https://wiki.eveuniversity.org/Capacitor#Capacitor_recharge_rate
cap = maxCap * (1 + math.exp(5 * -time / regenTime) * -1) ** 2
return cap

View File

@@ -20,5 +20,6 @@ class FitCapRegenAmountGraph(Graph):
maxCap = self.fit.ship.getModifiedItemAttr('capacitorCapacity')
regenTime = self.fit.ship.getModifiedItemAttr('rechargeRate') / 1000
currentCap = maxCap * perc / 100
# https://wiki.eveuniversity.org/Capacitor#Capacitor_recharge_rate
regen = 10 * maxCap / regenTime * (math.sqrt(currentCap / maxCap) - currentCap / maxCap)
return regen

View File

@@ -12,16 +12,17 @@ class FitShieldAmountTimeGraph(Graph):
defaults = {"time": 0}
def __init__(self, fit, data=None):
Graph.__init__(self, fit, self.calcRegen, data if data is not None else self.defaults)
Graph.__init__(self, fit, self.calcAmount, data if data is not None else self.defaults)
self.fit = fit
import gui.mainFrame
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
def calcRegen(self, data):
def calcAmount(self, data):
time = data["time"]
maxShield = self.fit.ship.getModifiedItemAttr('shieldCapacity')
regenTime = self.fit.ship.getModifiedItemAttr('shieldRechargeRate') / 1000
shield = maxShield * (1 + math.e ** ((5 * -time) / regenTime) * -1) ** 2
# https://wiki.eveuniversity.org/Capacitor#Capacitor_recharge_rate (shield is similar to cap)
shield = maxShield * (1 + math.exp(5 * -time / regenTime) * -1) ** 2
useEhp = self.mainFrame.statsPane.nameViewMap["resistancesViewFull"].showEffective
if self.fit.damagePattern is not None and useEhp:
shield = self.fit.damagePattern.effectivify(self.fit, shield, 'shield')

View File

@@ -41,6 +41,7 @@ class FitShieldRegenAmountGraph(Graph):
maxShield = self.fit.ship.getModifiedItemAttr('shieldCapacity')
regenTime = self.fit.ship.getModifiedItemAttr('shieldRechargeRate') / 1000
currentShield = maxShield * perc / 100
# https://wiki.eveuniversity.org/Capacitor#Capacitor_recharge_rate (shield is similar to cap)
regen = 10 * maxShield / regenTime * (math.sqrt(currentShield / maxShield) - currentShield / maxShield)
useEhp = self.mainFrame.statsPane.nameViewMap["resistancesViewFull"].showEffective
if self.fit.damagePattern is not None and useEhp:

25
eos/graph/fitSpeedTime.py Normal file
View File

@@ -0,0 +1,25 @@
import math
from logbook import Logger
from eos.graph import Graph
pyfalog = Logger(__name__)
class FitSpeedTimeGraph(Graph):
defaults = {"time": 0}
def __init__(self, fit, data=None):
Graph.__init__(self, fit, self.calcSpeed, data if data is not None else self.defaults)
self.fit = fit
def calcSpeed(self, data):
time = data["time"]
maxSpeed = self.fit.ship.getModifiedItemAttr('maxVelocity')
mass = self.fit.ship.getModifiedItemAttr('mass')
agility = self.fit.ship.getModifiedItemAttr('agility')
# https://wiki.eveuniversity.org/Acceleration#Mathematics_and_formulae
speed = maxSpeed * (1 - math.exp((-time * 10 ** 6) / (agility * mass)))
return speed