Created
February 17, 2017 14:07
-
-
Save the-mace/4b28a75e5897937afcc686597dec15e0 to your computer and use it in GitHub Desktop.
Tesla Charge Time Calculation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calculate_charge_time(self, log, starting_range, kwh_needed, cold_pack=False, charger_type="supercharger"): | |
''' | |
Data via TMC thread: | |
super: { | |
efficiency: 0.93, | |
chargeRate1: 114.1, | |
chargeRate2: 50.4, // kW/hour | |
dropoff: 150, // dropoff distance in miles | |
image: IMAGES[MODEL]["super"] | |
} | |
https://teslamotorsclub.com/tmc/threads/model-x-subsite-updates.9573/page-19 | |
''' | |
miles_to_add = (kwh_needed * 1000.0) / self.rated_wh_mile | |
log.debug(" miles to add: %d", miles_to_add) | |
log.debug(" starting range: %d (%.1f%%)", starting_range, 100.0*starting_range/self.max_range) | |
log.debug(" ending range: %d (end at %.1f%%)", miles_to_add + starting_range, | |
100*(miles_to_add + starting_range)/self.max_range) | |
if starting_range > 150: | |
m = (1 / (50.4 * 1000 / 60)) * miles_to_add * self.rated_wh_mile | |
elif starting_range + miles_to_add <= 150: | |
m = (1 / (114.1 * 1000 / 60)) * miles_to_add * self.rated_wh_mile | |
else: | |
m = (1 / (114.1 * 1000 / 60)) * (150 - starting_range) * self.rated_wh_mile | |
m += (1 / (50.4 * 1000 / 60)) * (miles_to_add - (150 - starting_range)) * self.rated_wh_mile | |
log.debug(" minutes to charge: %d", m) | |
if cold_pack: | |
m *= 1.4 | |
return m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment