Add distance vs time graph

This commit is contained in:
DarkPhoenix
2019-05-12 16:26:02 +03:00
parent d777999af4
commit c9b60f2c65
4 changed files with 109 additions and 1 deletions

View File

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

View File

@@ -21,5 +21,5 @@ class FitSpeedTimeGraph(Graph):
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)))
speed = maxSpeed * (1 - math.exp((-time * 1000000) / (agility * mass)))
return speed