More actions
No edit summary |
|||
| Line 163: | Line 163: | ||
\end{align} | \end{align} | ||
</math> | </math> | ||
==Implementation== | |||
The following python code is one possible implementation of the above. It attempts to generate the same data as presented by CCP in the forums. It matches with their numbers, except for 50 AU titan warps, which are one second out. | |||
<pre> | |||
import math | |||
AU_IN_M=149597870700 | |||
def get_distance(dist): | |||
if dist > 1e9: | |||
return (dist / AU_IN_M, "AU") | |||
else: | |||
return (dist/1000, "KM") | |||
# Warp speed in AU/s, subwarp speed in m/s, distance in m | |||
def calculate_time_in_warp(max_warp_speed, max_subwarp_speed, warp_dist): | |||
k_accel = max_warp_speed | |||
k_decel = min(max_warp_speed / 3, 2) | |||
warp_dropout_speed = min(max_subwarp_speed / 2, 100) | |||
max_ms_warp_speed = max_warp_speed * AU_IN_M | |||
accel_dist = max_ms_warp_speed / k_accel | |||
decel_dist = max_ms_warp_speed / k_decel | |||
minimum_dist = accel_dist + decel_dist | |||
cruise_time = 0 | |||
if minimum_dist > warp_dist: | |||
max_ms_warp_speed = warp_dist * k_accel * k_decel / (k_accel + k_decel) | |||
else: | |||
cruise_time = (warp_dist - minimum_dist) / max_ms_warp_speed | |||
accel_time = math.log(max_ms_warp_speed / k_accel) / k_accel | |||
decel_time = math.log(max_ms_warp_speed / warp_dropout_speed) / k_decel | |||
total_time = cruise_time + accel_time + decel_time | |||
distance = get_distance(warp_dist) | |||
return total_time | |||
distances = [150e3, 1e9, AU_IN_M * 1, AU_IN_M * 2, AU_IN_M * 5, AU_IN_M * 10, AU_IN_M * 20, AU_IN_M * 50, AU_IN_M * 100, AU_IN_M * 200] | |||
speeds = [1.36, 1.5, 2, 2.2, 2.5, 2.75, 3, 3.3, 4.5, 5, 5.5, 6, 8] | |||
result = {} | |||
for speed in speeds: | |||
for dist in distances: | |||
result[(dist, speed)] = calculate_time_in_warp(speed, 200, dist) | |||
print("{:9s}".format(""), end="") | |||
for speed in speeds: | |||
print("{:9.2f}".format(speed), end="") | |||
last_dist = 1e999 | |||
for x,y in sorted(result.keys()): | |||
dist = get_distance(x) | |||
if (y < last_dist): | |||
print("\n{:7.5n} {:s}".format(dist[0],dist[1]), end="") | |||
last_dist = y | |||
print("{:9.0f}".format(math.ceil(result[x,y])), end="") | |||
print() | |||
</pre> | |||