Add bunch of experimental graphs related to bumping
This commit is contained in:
@@ -23,6 +23,27 @@ import math
|
|||||||
from graphs.data.base import SmoothPointGetter
|
from graphs.data.base import SmoothPointGetter
|
||||||
|
|
||||||
|
|
||||||
|
class Time2DistanceGetter(SmoothPointGetter):
|
||||||
|
|
||||||
|
def _getCommonData(self, miscParams, src, tgt):
|
||||||
|
return {
|
||||||
|
'maxSpeed': src.getMaxVelocity(),
|
||||||
|
'mass': src.item.ship.getModifiedItemAttr('mass'),
|
||||||
|
'agility': src.item.ship.getModifiedItemAttr('agility')}
|
||||||
|
|
||||||
|
def _calculatePoint(self, x, miscParams, src, tgt, commonData):
|
||||||
|
time = x
|
||||||
|
maxSpeed = commonData['maxSpeed']
|
||||||
|
mass = commonData['mass']
|
||||||
|
agility = commonData['agility']
|
||||||
|
# Definite integral of:
|
||||||
|
# https://wiki.eveuniversity.org/Acceleration#Mathematics_and_formulae
|
||||||
|
distance_t = maxSpeed * time + (maxSpeed * agility * mass * math.exp((-time * 1000000) / (agility * mass)) / 1000000)
|
||||||
|
distance_0 = maxSpeed * 0 + (maxSpeed * agility * mass * math.exp((-0 * 1000000) / (agility * mass)) / 1000000)
|
||||||
|
distance = distance_t - distance_0
|
||||||
|
return distance
|
||||||
|
|
||||||
|
|
||||||
class Time2SpeedGetter(SmoothPointGetter):
|
class Time2SpeedGetter(SmoothPointGetter):
|
||||||
|
|
||||||
def _getCommonData(self, miscParams, src, tgt):
|
def _getCommonData(self, miscParams, src, tgt):
|
||||||
@@ -45,27 +66,36 @@ class Time2MomentumGetter(Time2SpeedGetter):
|
|||||||
|
|
||||||
def _calculatePoint(self, x, miscParams, src, tgt, commonData):
|
def _calculatePoint(self, x, miscParams, src, tgt, commonData):
|
||||||
mass = commonData['mass']
|
mass = commonData['mass']
|
||||||
speed = super()._calculatePoint(x=x, miscParams=miscParams, src=src, tgt=tgt, commonData=commonData)
|
speed = Time2SpeedGetter._calculatePoint(
|
||||||
|
self, x=x, miscParams=miscParams,
|
||||||
|
src=src, tgt=tgt, commonData=commonData)
|
||||||
momentum = speed * mass
|
momentum = speed * mass
|
||||||
return momentum
|
return momentum
|
||||||
|
|
||||||
|
|
||||||
class Time2DistanceGetter(SmoothPointGetter):
|
class Time2BumpSpeedGetter(Time2SpeedGetter):
|
||||||
|
|
||||||
def _getCommonData(self, miscParams, src, tgt):
|
|
||||||
return {
|
|
||||||
'maxSpeed': src.getMaxVelocity(),
|
|
||||||
'mass': src.item.ship.getModifiedItemAttr('mass'),
|
|
||||||
'agility': src.item.ship.getModifiedItemAttr('agility')}
|
|
||||||
|
|
||||||
def _calculatePoint(self, x, miscParams, src, tgt, commonData):
|
def _calculatePoint(self, x, miscParams, src, tgt, commonData):
|
||||||
time = x
|
bumperMass = commonData['mass']
|
||||||
maxSpeed = commonData['maxSpeed']
|
bumperSpeed = Time2SpeedGetter._calculatePoint(
|
||||||
mass = commonData['mass']
|
self, x=x, miscParams=miscParams,
|
||||||
agility = commonData['agility']
|
src=src, tgt=tgt, commonData=commonData)
|
||||||
# Definite integral of:
|
tgtMass = miscParams['tgtMass']
|
||||||
# https://wiki.eveuniversity.org/Acceleration#Mathematics_and_formulae
|
# S. Santorine, Ship Motion in EVE-Online, p3, Collisions & Bumping section
|
||||||
distance_t = maxSpeed * time + (maxSpeed * agility * mass * math.exp((-time * 1000000) / (agility * mass)) / 1000000)
|
# https://docs.google.com/document/d/1rwVWjTvzVdPEFETf0vwm649AFb4bgRBaNLpRPaoB03o
|
||||||
distance_0 = maxSpeed * 0 + (maxSpeed * agility * mass * math.exp((-0 * 1000000) / (agility * mass)) / 1000000)
|
tgtSpeed = (2 * bumperSpeed * bumperMass) / (bumperMass + tgtMass)
|
||||||
distance = distance_t - distance_0
|
return tgtSpeed
|
||||||
return distance
|
|
||||||
|
|
||||||
|
class Time2BumpDistanceGetter(Time2BumpSpeedGetter):
|
||||||
|
|
||||||
|
def _calculatePoint(self, x, miscParams, src, tgt, commonData):
|
||||||
|
tgtMass = miscParams['tgtMass']
|
||||||
|
tgtInertia = miscParams['tgtInertia']
|
||||||
|
tgtSpeed = Time2BumpSpeedGetter._calculatePoint(
|
||||||
|
self, x=x, miscParams=miscParams,
|
||||||
|
src=src, tgt=tgt, commonData=commonData)
|
||||||
|
# S. Santorine, Ship Motion in EVE-Online, p3, Collisions & Bumping section
|
||||||
|
# https://docs.google.com/document/d/1rwVWjTvzVdPEFETf0vwm649AFb4bgRBaNLpRPaoB03o
|
||||||
|
tgtDistance = tgtSpeed * tgtMass * tgtInertia
|
||||||
|
return tgtDistance
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
|
|
||||||
from graphs.data.base import FitGraph, XDef, YDef, Input
|
from graphs.data.base import FitGraph, XDef, YDef, Input
|
||||||
from .getter import Time2SpeedGetter, Time2DistanceGetter, Time2MomentumGetter
|
from .getter import Time2SpeedGetter, Time2DistanceGetter, Time2MomentumGetter, Time2BumpSpeedGetter, Time2BumpDistanceGetter
|
||||||
|
|
||||||
|
|
||||||
class FitMobilityGraph(FitGraph):
|
class FitMobilityGraph(FitGraph):
|
||||||
@@ -31,15 +31,25 @@ class FitMobilityGraph(FitGraph):
|
|||||||
yDefs = [
|
yDefs = [
|
||||||
YDef(handle='speed', unit='m/s', label='Speed'),
|
YDef(handle='speed', unit='m/s', label='Speed'),
|
||||||
YDef(handle='distance', unit='km', label='Distance'),
|
YDef(handle='distance', unit='km', label='Distance'),
|
||||||
YDef(handle='momentum', unit='Mt⋅m/s', label='Momentum')]
|
YDef(handle='momentum', unit='Mt⋅m/s', label='Momentum'),
|
||||||
inputs = [Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=10, defaultRange=(0, 30))]
|
YDef(handle='bumpSpeed', unit='m/s', label='Bump speed'),
|
||||||
|
YDef(handle='bumpDistance', unit='km', label='Bump distance')]
|
||||||
|
inputs = [
|
||||||
|
Input(handle='time', unit='s', label='Time', iconID=1392, defaultValue=10, defaultRange=(0, 30)),
|
||||||
|
# Default values in target fields correspond to a random carrier/fax
|
||||||
|
Input(handle='tgtMass', unit='kt', label='Target mass', iconID=76, defaultValue=1300, defaultRange=(100, 2500), conditions=[(None, ('bumpSpeed', 'm/s')), (None, ('bumpDistance', 'km'))], secondaryTooltip='Defined in kilotons, or millions of kilograms'),
|
||||||
|
Input(handle='tgtInertia', unit=None, label='Target inertia factor', iconID=1401, defaultValue=0.015, defaultRange=(0.03, 0.1), conditions=[(None, ('bumpDistance', 'km'))], secondaryTooltip='Inertia Modifier attribute value of the target ship')]
|
||||||
srcExtraCols = ('Speed', 'Agility')
|
srcExtraCols = ('Speed', 'Agility')
|
||||||
|
|
||||||
# Calculation stuff
|
# Calculation stuff
|
||||||
|
_normalizers = {('tgtMass', 'kt'): lambda v, src, tgt: None if v is None else v * 10 ** 6}
|
||||||
_getters = {
|
_getters = {
|
||||||
('time', 'speed'): Time2SpeedGetter,
|
('time', 'speed'): Time2SpeedGetter,
|
||||||
('time', 'distance'): Time2DistanceGetter,
|
('time', 'distance'): Time2DistanceGetter,
|
||||||
('time', 'momentum'): Time2MomentumGetter}
|
('time', 'momentum'): Time2MomentumGetter,
|
||||||
|
('time', 'bumpSpeed'): Time2BumpSpeedGetter,
|
||||||
|
('time', 'bumpDistance'): Time2BumpDistanceGetter}
|
||||||
_denormalizers = {
|
_denormalizers = {
|
||||||
('distance', 'km'): lambda v, src, tgt: v / 1000,
|
('distance', 'km'): lambda v, src, tgt: v / 1000,
|
||||||
('momentum', 'Mt⋅m/s'): lambda v, src, tgt: v / 10 ** 9}
|
('momentum', 'Mt⋅m/s'): lambda v, src, tgt: v / 10 ** 9,
|
||||||
|
('bumpDistance', 'km'): lambda v, src, tgt: v / 1000}
|
||||||
|
|||||||
Reference in New Issue
Block a user