Add distance vs time graph
This commit is contained in:
26
eos/graph/fitDistanceTime.py
Normal file
26
eos/graph/fitDistanceTime.py
Normal 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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user