## EV charge pricing per State in US

Continuing from my previous post ( http://blogs.perl.org/users/itcharlie/2021/04/calculating-ev-battery-charge-with-perl.html ) I learned that residential electricity charges are calculated using an electricity supply rate per kWh and a electric delivery rate per kWh which actually increases the total EV charge prices that I have calculated in my previous post. My current bill states that my electric supply rate is at 6.9057 cents per kWh and my delivery rate is 11.1785 cents per kWh making it a total of 18.0842 cents per kWh which is 5 cents more than my original post at $ 0.13 cents per kWh.

I was curious to calculate the average cost per state in US so I did some research online and found a site that would give me average electric charges per State in US from January 2021 ( https://paylesspower.com/blog/electric-rates-by-state/ ) and I was able to copy the table of data into a tab delimited file : https://github.com/itcharlie/ev-calc-pricing/blob/main/electric_rates.txt

I created a new copy of my perl script ( https://github.com/itcharlie/ev-calc-pricing/blob/main/generate*ev*charge*price*report.pl ) where I read the tab delimited file like so:

```
my $state_rates_fh;
my %electric_rate;
open( $state_rates_fh, "<", "electric_rates.txt" )
or die "Unable to open file: $!\n";
while (<$state_rates_fh> ) {
my @line_data = split('\t', $_);
$electric_rate{ $line_data[0] } = $line_data[1] ;
}
```

` `

and generate total pricing per state.
```
foreach my $state (sort keys %electric_rate ) {
my $total_price = $cars{'EV'}->{$ev_brand}->{$model}->{‘battery_size’} * ( $electric_rate{$state} / 100 ) ;
say “$state: \$ ” . sprintf(“%.2f” , $total_price);
}
```

which resulted as the following output :
0-100% battery charge price by State: -------------------------------------------------- Alabama : $ 10.15 Alaska : $ 17.48 Arizona : $ 9.59 Arkansas : $ 7.72 California : $ 17.57 Colorado : $ 9.95 Connecticut : $ 17.46 Delaware : $ 9.65 District Of Columbia : $ 10.05 Florida : $ 9.55 Georgia : $ 8.97 Hawaii : $ 25.05 Idaho : $ 8.24 ...

From this data I learned that Oklahoma has the cheapest electric rates and it would take a total of $7.31 dollars in electricity to charge a 2021 Tesla Model 3 with an all electric range of 353 miles. Using the same car as an example, Hawaii is the most expensive state with a total of $25.05 dollars in electricity charge.

Thank you for your time and I hope you enjoyed this post.

## Leave a comment