Electric Vehicles Not Quite Ready For Road Trips

Recently, I took my wife’s XC40 Recharge on a road trip from Franklin, TN to Davie, FL (about 898 miles as originally planned). We had chosen the XC40 even though it had a shorter range than many EVs because it was really meant to only be an around town car. This worked perfectly until I needed to get the car down to FL and balked at the cost to have it shipped. As I have a history of somewhat crazy road trips, I figured why not!

I planned my trip using PlugShare’s Trip Planner, which was a pretty handy tool for just such an occasion. I later found out that I was a bit generous in my range estimates when choosing my charger locations, and I forgot that charging can be pretty slow from 0-20% and 80-100%. I also underestimated the range anxiety I had when trying to stretch it out to a farther station since I often would be left with almost no backup choice if the charger was occupied or not working. Generally, I turned out to have pretty good luck though.

Time (CT)ActivityLocationChargeNotes
6:12DepartedFranklin, TN88%
7:20ArrivedManchester, GA50%
7:56Departed88%
10:00ArrivedChattanooga, TN55%Not originally planned, but was going to be too close for comfort so stopped for a short boost at a smaller charger.
10:27Departed67%
12:16ArrivedMarietta, GA19%Saw my first Hummer EV here! Guy said his boss had just gotten one too. Almost wished I had a business card to give him so I could get into his line of work.
13:02Departed83%
14:43ArrivedCordele, GA12%
15:20Departed74%
16:35ArrivedValdosta, GA28%
16:59Departed69%
18:45ArrivedGainesville, FL11%Around this point I realized that the turnpike stations were far enough away that I’d be in big trouble if one was out of order, and reviews made that seem likely. Had to opt-out of the turnpike to a route that adds about 40 minutes.
19:24Departed78%
21:00ArrivedOrmond Beach, FL30%
21:24Departed62%
22:19ArrivedCocoa, FL21%
22:59Departed93%
00:06ArrivedPort St. Lucie, FL34%
00:40Departed82%
02:07ArrivedDavie, FL19%If I had caught one or two more lights, I would have been right at 20 hours. New solo road trip record!

Nearly all the chargers I stopped at were from Electrify America, and it was very rare that they were full or non-functioning. I did get a few that didn’t seem to be able to hit the peak charge rate that I was hoping for, but almost all were outside Walmart or Target so each was a chance to stretch my legs and replenish snacks and drinks. Don’t have to refrain from liquids when the car will have you stopping in not too long anyway!

I should have done better to leave closer to 100% initially, which probably would have gotten things started on a better foot. I also may have been able to better swing some longer drives/charges, but as this was my first long EV road trip, I still didn’t have a great feel on whether it would be better to optimize charging speed focusing on 20-80% but have more stops vs. endure some slower charging but get closer to 100% to kick off longer legs. Still, it was a heck of an experience, and I got to see a lot of cool EVs in the wild that I hadn’t yet seen. Can’t say I’ll be signing up for another one any time soon though!

Journey Into Data Science

While I have been working as a Data Scientist for a bit now, my actual job duties have not yet included what many would traditionally call Data Science. As a means to broaden my horizons, I thought it would be interesting to explore the Open Source Data Science Masters that I had read about a while ago.

It is basically a collection of self-paced tools for learning and exploring Data Science. While called a “Masters”, it is not actually associated with a degree. Just an open source alternative meant to give people a lot of the exposure to core Data Science concepts in an accessible (and free!) venue.

I made my own fork of the Github repository, so I may make a branch to track any changes, notes, results, etc. that I generate while working through it. I will also be documenting my journey here. Hopefully there will be relevant and interesting things for me to report, but at the very least it seemed like a decent place to track my progress through the program.

Be Careful With Column Types in Spark Filters

One basic premise of Spark seems to be to “hide” exceptions for the most part and just keep things running as much as possible. This can lead to some unexpected results as there is no indicator that things have gone awry, but indeed they have! I came across this simple example recently and thought I would share.

Say you are reading a table into a dataframe and wanting to filter out some of the results, but you assumed the types in the columns were correct so you didn’t check. You can encounter a situation like this:

val my_df = spark.read.table("database.my_table")
  .select('id,'name)

display(my_df)
idname
12345Sue
22334John
Kassandra
66787Phillip

So in the result set, we see three normal id values and one empty (i.e. “”) id. We know our id column is supposed to be a String, but this table was accidentally generated having it as an Integer (easy enough to happen if you rely on inferSchema). Then we can see behavior like this when trying to count the non-empty id rows.

my_df.filter('id =!= "").count // Count non-empty ids

// res1: Long: 0

While this is likely because the comparison itself is invalid (=!= “” isn’t a valid Integer check), spark just chugs along without any obvious warnings and gives a result, albeit one that is most definitely not correct! So not only does one need to be careful with their schemas, but don’t rely on Spark to warn you about or catch your mistakes either!

Chrysler Pacifica Hybrid – My First 5000-ish Miles

In December, my lease on my Ford Fusion Energi was over, so it was time again for car shopping. The sedan wasn’t the best from a kid-carrying perspective, and our Subaru Outback (Suzie) has felt a bit cramped the last couple of road trips. So I was hoping to find a new road trip car with more space, but also find something electric or at least hybrid (preferably plug-in).

It turns out that those criteria pretty much narrowed down my list for me. It seemed most large SUVs that I knew had hybrid versions don’t appear to still be produced (e.g. I’ve seen Tahoe hybrids driving around). They also were all just typical hybrids, and I was hoping for a plug-in version. The Model X is called an SUV, but not only is it ridiculously expensive, but I’m not sure that it would actually give us more space than Suzie.

That pretty much left the Pacifica. As a minivan, it definitely is more spacious than Suzie, plus the full electric range is 33 miles (improving from the ~22 in the Fusion). Additionally, it is still eligible for the EV tax credit, which as far as I could tell, actually makes it cost less at the end of the day than the comparable gas version. So that’s what we decided to go for!

Charged up and ready to go!

So far she has been pretty great. It has been a game changer to have power doors for the kids and the liftgate. Who knew that was so frickin’ handy!? My only real complaint thus far has been regarding the electronics. I’ve had several instances where the entertainment cluster just didn’t turn on, which meant no radio, etc. Super annoying! One time it stayed off for over a day and I ended up having to just pull the fuse to reset it. She also really has a thing for NPR, haha. I mostly listen to SiriusXM, but most times I get in she turns back to FM, which is set on NPR. Sometimes I just want to listen to Music Chrissy! Geesh!

We’ve definitely been seeing the benefits of the plug-in hybrid as well. From our old house, I used about 15% of the battery to get to work , but closer to 25% from the new place. So theoretically, I should be able to commute to work for at least 2 days without charging and still not use any gas. Typically, I’d plug in every night, so I never really got very low. And with 33 miles, I had plenty of freedom to run errands and such and still not use any gas on a normal day.

We picked her up on January 2nd, and the first time I put gas in was on March 13th, which was only needed because we left on a road trip! Her highway mileage hasn’t been too impressive (~28 mpg), but I’ve been tracking and she’s averaged about 49.5 mpg over her first 5300-ish miles. Not too shabby when it included road trips to Bristol and Miami (and I forgot my cable when we went to Miami so I was in normal hybrid mode the whole week and didn’t get to start with 33 electric miles on the way home). And that first tank would have been pretty crazy if we hadn’t had to go on the road trip. I think I was still at half a tank and had already gone over 1300 miles!

DateMilesGallonsMileage
3/141351.310.636127.0
3/15334.510.33432.4
3/15217.69.1823.7
3/17388.314.60626.6
3/19171.35.73229.9
3/19279.110.44826.7
3/20373.613.61127.4
3/304567.26362.8
3/3135312.51228.2
5/191417.313.609104.1

I’m not sure I’ll keep tracking so meticulously, but it will definitely be fun to keep living the electric car life as much as I can!

Colorizing Bash Output

When I developed this, a great majority of my professional development was in Perl.  Additionally, we have had a focus on building more robust unit test scripts for the code that is written.  Especially as the tests have started growing pretty large, I started looking for ways to make the test output a bit more readable.  Since these are built using existing perl packages like Test::More, I am somewhat limited in my customization choices.  When looking for possibilities, most of the answers that I found were code that you could add to your script to do the colorization.  Unless I wanted to build custom versions of the packages we use, that wasn’t the best option.

I also looked into multitail since I had used that for colorizing some log outputs, but it never seemed well suited for taking the output of a single-run script.  Not only is scrolling around a bit awkward, but it doesn’t tend to like to leave the output available after the run. Multitail does ok if you first redirect the output to a file, then multitail that file, but that is a bit more difficult to swing if you don’t want be switching between windows (plus it leaves a file that you’ll need to clean up at some point).

What I ended up going with was this script.  The nice thing about it is that it could be pretty easily tailored for whatever script for which you wanted to colorize the output. As it is currently written, it makes the output of Perl’s Test::More .t files a lot clearer and nicer to look at!

To use it, I run something like perl test.t 2>&1 | ./colorize.sh which results in output like this.

I’m sure that I could do some more customization, but I was pretty happy with how it turned out. It colorizes the different statements that we tend to have, and catches kill signals so your colors will reset to normal if you kill the run before it finishes. If I do make any updates, I’ll add them to the snippet.