Urgent.News

What's breaking now, across thousands of outlets.

Tech

Building an EV-vs-petrol cost model: total cost of ownership in the browser

An electric car that costs $10,000 more than its petrol equivalent breaks even after 8.6 years at 12,000 miles a year — and never breaks even at all if you charge it mostly at public fast chargers. Both facts fall out of one small model, and the second one is the reason "EVs are cheaper to run" needs a qualifier. The sticker price is the worst way to compare two cars. What matters is total cost…

An electric vehicle (EV) that costs $10,000 more than a petrol car with similar capabilities only breaks even after 8.6 years if driven an average of 12,000 miles per year. However, this cost advantage disappears if the EV is frequently charged using public fast chargers. The misconception arises because people often focus on the initial sticker price rather than the total cost of ownership, which includes purchase price and expenses related to operating the car over its lifetime.

The model is based on three simple functions to calculate the annual cost of each car type: annualCost(miles, fuelPerMile, maintenance) = miles * fuelPerMile + maintenance. The totalCost(price, years, miles, fuelPerMile, maintenance) = price + years * annualCost(miles, fuelPerMile, maintenance) captures the total cost over a specified number of years.

The main divergence between EVs and petrol cars is fuel consumption: EVs use electricity per mile, calculated as electricity price divided by vehicle efficiency (miles per kilowatt-hour), while petrol cars use fuel price per mile, calculated as fuel price divided by fuel economy (miles per gallon). Using average US figures of $0.16 per kWh for electricity and $3.50 per gallon for petrol, the EV's fuel cost per mile is $0.0457, whereas the petrol car's is $0.1094 per mile, making the EV cheaper to fuel by a significant margin.

Illustrating this with an example: a $38,000 EV versus a $28,000 petrol car driven 12,000 miles annually results in an annual fuel cost saving of $763.93 for the EV versus $1,312.50 for the petrol car. Adding a relatively low maintenance cost differential of $400 per year, the EV saves $1,163.93 per year against the petrol car. When accounting for a $10,000 higher purchase price, the EV pays a premium for 8.59 years (around 103,100 miles) before becoming cheaper.

After eight years, the EV is still $688.57 behind the petrol car, but at ten years, the EV overtakes, becoming $1,639.29 cheaper overall.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

How to Compress a Video Without Uploading It (Free, Right in Your Browser)

You filmed a 90 second clip on your phone and it is 180 MB. Your email limit is 25 MB, the chat app will squash it into mush, and the class portal says "file too large".

  • Compress videos in browser without uploading, using H.264 codec
  • Adjust quality (CRF), resolution, and frame rate to reduce size
  • OpenFile toolkit runs ffmpeg in browser via WebAssembly for compression

I built a world history map where every ruler links to a source

Most history maps show the borders. I wanted one that also says who was in charge, and where that claim came from. You drag a year slider from 1000 BC to today, the borders move, and you can click any…

  • Map identifies rulers and sources for each region from 1000 BC to present
  • Each ruler and claim linked to source URL and quote in code
  • Static map generated beforehand, minimal loading via single TopoJSON per year

Your JSON is valid and your invoice is wrong

Imagine a perfectly reasonable backend refactor. client.name becomes customer.legalName . The new shape is clearer. The JSON parses. The application tests are green. Then someone opens an invoice.

  • Bitavu API converts JSON to PDF documents
  • Missing customer field in generated invoice
  • Guard function needed for required fields

More from Tuesday 3 November →