Skip to content

Instantly share code, notes, and snippets.

@elden1337
Created July 19, 2023 20:16
Show Gist options
  • Save elden1337/fc0ade487fd12557dff7f7fa6a96efc2 to your computer and use it in GitHub Desktop.
Save elden1337/fc0ade487fd12557dff7f7fa6a96efc2 to your computer and use it in GitHub Desktop.
Peaqev total costs vs other types of smart charging
prices = [0.34, 0.34, 0.32, 0.33, 0.36, 0.38, 0.5, 0.57, 0.58, 0.57, 0.56, 0.54, 0.52, 0.51, 0.51, 0.52, 0.54, 0.57, 0.59, 0.61, 0.61, 0.6, 0.58, 0.52]
allowed_peak = 3 #how much is set in peaqev
other_consumption = 1.2
charged_kwh = 200
charge_days = 20
max_total_charge = 11
peak_price = 36.25 #gothenburg
#---------------------------------------
per_diem = charged_kwh / charge_days
average_price_month = sum(prices) / len(prices)
tuples = list(tuple(enumerate(prices)))
tuples.sort(key=lambda x: x[1])
print(f"Average price is: {round(average_price_month,2)}kr/kWh.")
print(f"Charge amount is: {charged_kwh}kWh for {charge_days} days total.")
print(f"The initial peak is {other_consumption}kW @ {peak_price}kr/kWh.")
print("----------")
#smart
smart_peak = 0
smart_cost = 0
for i in range(charge_days):
day_charge = 0
smart_peak = max_total_charge + other_consumption
j = 0
while day_charge < per_diem:
day_charge += max_total_charge
smart_cost += max_total_charge * tuples[j][1]
j += 1
smart_peak = smart_peak*peak_price
smart_sum = smart_cost + smart_peak
print(f"Case 1: 'Smart'. Cost: {int(smart_sum)}kr. that's {round(smart_sum/charged_kwh,2)}kr/kWh. Elprice is {round(smart_cost/charged_kwh,2)}kr/kWh. New peak is {smart_peak/peak_price}kW")
#smart_with_discount (gives you half your average other consumption as maximum per-kwh price)
smart_with_discount_peak = 0
smart_with_discount_cost = 0
for i in range(charge_days):
day_charge = 0
smart_with_discount_peak = max_total_charge + other_consumption
j = 0
while day_charge < per_diem:
day_charge += max_total_charge
smart_with_discount_cost += max_total_charge * tuples[j][1]
j += 1
smart_with_discount_cost = min(smart_with_discount_cost, (average_price_month*charged_kwh)/2)
smart_with_discount_peak = smart_with_discount_peak*peak_price
smart_with_discount_sum = smart_with_discount_cost + smart_with_discount_peak
print(f"Case 2: 'Smart with discounted monthly avg'. Cost: {int(smart_with_discount_sum)}kr. that's {round(smart_with_discount_sum/charged_kwh,2)}kr/kWh. Elprice is {round(smart_with_discount_cost/charged_kwh,2)}kr/kWh. New peak is {smart_with_discount_peak/peak_price}kW")
#fixed6A (smart hourly charge and fix your amps to 6A
fixed_peak = 0
fixed_cost = 0
fixed_peak = other_consumption + 4.3
for i in range(charge_days):
day_charge = 0
j = 0
while day_charge < per_diem:
_charge = fixed_peak
day_charge += _charge
fixed_cost += _charge * tuples[j][1]
j += 1
fixed_peak = fixed_peak*peak_price
fixed_sum = fixed_cost + fixed_peak
print(f"Case 3: 'Fixed charging at 6A'. Cost: {int(fixed_sum)}kr. that's {round(fixed_sum/charged_kwh,2)}kr/kWh. Elprice is {round(fixed_cost/charged_kwh,2)}kr/kWh. New peak is {fixed_peak/peak_price}kW")
#peaq
peaq_cost = 0
peaq_peak = allowed_peak
for i in range(charge_days):
day_charge = 0
j = 0
while day_charge < per_diem:
_charge = allowed_peak - other_consumption
day_charge += _charge
peaq_cost += _charge * tuples[j][1]
j += 1
peaq_peak = peaq_peak*peak_price
peaq_sum = peaq_cost + peaq_peak
print(f"Case 4: 'PeaqEV'. Cost: {int(peaq_sum)}kr. that's {round(peaq_sum/charged_kwh,2)}kr/kWh. Elprice is {round(peaq_cost/charged_kwh,2)}kr/kWh. New peak is {allowed_peak}kW")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment