Musing #75: Analysing the Valencia Formula E debacle

 


Some may call it exciting and others farcical. For a fledging series, Formula E certainly attracted the wrong kind of attention with the slipshod finish yesterday resulting in only 9 drivers being classified at the end. While it is easy to call out the FIA or Da Costa for the extra lap, the reality, as always, is more complex. This analysis thus aims to clarify the events as they unfolded.

The first big question that I came across on the web was about the big change in energy reduction percentage during the various SC periods. While there was only a 3% reduction during the 3-minute safety car (SC) at the 20-minute mark, the final 5-minute SC resulted in a 12% reduction. Well, this is quite easy to explain keeping in mind the starting available capacity of 52 kWh. Essentially, the percentage value displayed on the screen is a relative value whereas the absolute reduction is happening in terms of kWh, both to the usable energy as well as available energy.

At 20:38 remaining, we can see that the available energy is 61%.

Moments later, it drops to 58% after the reduction.


The reduction itself is 3 kWh for that SC period and a total of 9 kWh for the race.


This latter part is the most important as it indicates the total available energy after the reduction. Back of the envelope calculations for this scenario is as follows. Note that these calculations are based on the whole number figures displayed in the TV graphics while the actual numbers with the correct precision would be slightly different.

Usable energy before reduction: 46 kWh (52 - 6)
Available energy before reduction: 61% of 46 kWh = ~28 kWh

Usable energy after reduction: 43 kWh (52 - 9)
Available energy after reduction: 58% of 43 kWh = ~25 kWh (28 - 3)

Now let us take a look at the final SC. The available energy is 18% prior to reduction.

It drops to 6% after reduction.

The total energy reduction is 19 kWh in total and 5 kWh for that SC period.

The calculations now are as follows:

Usable energy before reduction: 38 kWh (52 - 14)
Available energy before reduction: 18% of 38 kWh = ~7 kWh

Usable energy after reduction: 33 kWh (52 - 19)
Available energy after reduction: 6% of 33 kWh = ~2 kWh (7 - 5)

As you can see above, the percentage value can be quite confusing for the viewer as both the numerator and the denominator change by the same amount and thus the change in the actual percentage value will be more drastic for lower energy values than the higher ones.

That explains the TV graphics but then why were the teams caught so unawares towards the end? For, let us go to the period just as the final SC came out.


At this point, Da Costa has 22% of 38 kWh usable energy i.e. 8.4 kWh. The fastest lap as can be seen in the office notice was about 1m 40s. It thus indicates that at this point, there was enough time to cover 5 laps.

However, when the SC came out at 5:38 remaining, there was still a part of the lap remaining. Luckily, Da Costa floored the car at about the same place after the SC, so we can easily make out the time needed to reach the finish line from that part of the track.


As can be seen from the images above, it takes about 25 seconds implying that Da Costa would have crossed the line with 5:13 remaining if there was no SC. Considering the fastest lap of the race, 3 laps would have taken around 5 minutes. Thus, if Da Costa was to complete 3 more laps in 1:44 to 1:45 minutes, he would have needed to complete only 4 laps to finish the race with about 8 kWh remaining which is perfectly feasible.

The problem then is that the SC pace was not enough to scrub off a lap and thus the cars still had to complete 4 laps to finish the race, around 2 laps under the SC and a little more than 2 laps at race pace. While the race pace target was 2 kWh/lap, under the SC, assuming a lap time of 2m 30s, the reduction would have been 2.5 kWh/lap. This implies that the cars lost around a kWh of energy behind the safety car due to the time elapsed and at the same time utilised closed to 1.5 kWh of energy following the SC.

Thus, while in race conditions, Da Costa was expected to have 4.4 kWh of energy at the point where he started the final run with 2 laps to go, in reality he had about 2 kWh. The only feasible option was to limit the race to one lap after the SC which he was unable to do so. At the same time, Mercedes seems to have a 5-lap target in mind before the SC and thus were keeping more energy in hand compared to Da Costa who was hoping to limit the race to 4 more laps at the time the final SC came out.

While it was a shambolic end to the race with the FIA shifting blame to Da Costa for not controlling the pace, the FIA is not without blame. They had never made a provision for such a scenario and the fixed reduction of 1 kWh/min applied by the FIA is excessive when the usable energy is low.

One way of tackling such a scenario could have been to reduce the energy allocation for a race lap over a SC lap duration (i.e. ~2 kWh reduction over a 2:30m SC lap). This results in a reduction rate of 0.8 kWh/minute. If this seems too low a reduction, then the rule can be changed to apply this limit only for the final 10 minutes of the race.

The other option could have been to not deduct the energy consumed by the car behind the SC which seems to be about 0.3 kWh/minute (can be calculated from the fact that usable energy reduced from 22% to 18% behind the 5-minute SC with 38 kWh available energy). However, this would result in a reduction rate of 0.7 kWh/minute and thus even more benevolent that the previous approach which is in fact more practical as it takes in to account the energy consumption by the race car and SC for a specific track.

Will this situation be addressed? That is anybody's guess as Formula E certainly seems to be quite disorganised at present. However, the solution to the problem is available as highlighted above and all it needs is the FIA to act on it. Most probably though, I think the teams will adjust the software to account for the SC loss going forward and we might see a slow but secure finish if such a scenario arises in the future.

Musing #58: Mutual Fund (SIP) Portfolio Overlap Analyser



Being from a finance background, I made it a point to invest in SIPs early on. Over the years, while the investment amount has increased steadily, the number of funds being invested in has remained more or less constant. Hence, I need not emphasis how important it is to know where exactly the money is going.

Too often, the choice of a fund is made simply on returns and diversification is achieved by selecting a different fund class. However, it provides no indication of the extent of value creation. I prefer to keep an eye out on what's happening with my portfolio and it is not only when selecting a new fund but also for keeping tabs on what's going on with the existing investments.


My search for websites/files providing this information yielded a few options that were quite limited in nature, dispensing basic overlap information between two or three funds. Unable to find the requisite information, I decided to go on my own and create an Excel workbook that provides overlap analysis for up to six funds. The other target I had set for myself was to do so without the use of VBA, so the only permission required is to access the external data source - moneycontrol.com.

The workbook is structured in to distinct sheets for input and detailed analysis. The 'Input' sheet is pretty straightforward and is essentially a two-step process requiring the funds and investment amount to be entered along with the selection of the fund that would form the basis of checking the overlap. It would be a good idea to read through the notes prior to using the workbook. The sheet has some safeguards built in to alert the user about inconsistent inputs, like missing investment values/funds and failure to refresh the 'base fund' selection. At the same time, it is robust enough to still function immaculately when any of the selected funds are deleted.


Note that although the sheet includes funds with equity holdings from various classes, some of them do not have their holdings listed on moneycontrol.com which may cause an error illustrated above. As such, there is nothing that can be done about it. Also, to state the obvious, the default funds selected in the sheet are for illustration and are not suggestive.


The 'Analysis' sheet provides the primary analysis of the portfolio. Besides listing the fund class and the equity holdings of each fund, it provides the percentage overlap of the base fund with all the other funds in the portfolio, both, in terms of the number of stocks and the value invested. The charts in turn provide 'Top 10' visualisations for individual stocks as well as the different sectors.


The 'Detail' sheet provides the tabular information that form the basis of the analysis and lists all the values as against only the Top 10 in the charts.


The 'MFx' sheets list the holdings of each fund, as retrieved from moneycontrol.com and is subsequently used for the overlap calculations.


Finally, the 'List' sheet is a list of the funds retrieved from moneycontrol.com and covers the various equity fund classes. It is easy to add any new funds to the list in the specified format and the information can be scraped en masse from the MoneyControl site.

As is often the case, I have created something to primarily fulfil my needs but with the intention of sharing it with other netizens. Consequently, I am open to any suggestions for improvement which you may leave in the comments section.

Link: Download from Google Drive

Musing #51: The philosophical difference between Formula 1 and Formula E


Compared to last year and the year before, I have decided to change tack and throw Formula E in to the mix this year. While the renders were shared in January, Formula E physically unveiled its Gen2 car at the Geneva Motor Show earlier today. I find it to be an attractive design, specifically as it is something that Formula 1 is unlikely to mimic anytime soon; unless its American owner, Liberty Media, manages to miraculously convince the teams that the show is more important than the performance.

This brings me to the point of why Formula E finds it favourable to adopt such a radically different design compared to Formula 1, marketing reasons aside. I cannot profess to be an aerodynamicist but over two decades of following motorsports has led me to be more appreciative of its technical aspects. Also, it feels satisfying to be able to tap in to my years of studying physics and engineering, and leverage it to satisfy the curiosity of a random commenter on the Internet.

Formula 1 is considered to be the epitome of motorsports and rightly so. It is all about harnessing the ultimate performance from the machine and achieving the ultimate lap time, much of which is accomplished by being fast through the turns. Hence, F1 cars are set up to have the highest possible downforce so that the turns can be taken as fast as possible while ensuring that the high drag that comes with it doesn't impact the straightline speed as much.

Unfortunately, most of the downforce in modern F1 cars is generated using aerodynamic structures and appendages which leaves a significant disturbed air flow for the car following behind. A consequence of this approach is the poor racing that we see in F1 these days. The much-maligned Drag Reduction System (DRS) overcomes this specific obstacle for the following car, though it seems the wider cars and even more intricate aerodynamic structures have rendered it less powerful (and thankfully so).

On the contrary, Formula E being a spec chassis series, isn't focused on ultimate performance. The philosophy here is to accelerate quickly out of the corners using the instant torque from the electric motors, reach the top speed as quickly as possible down the straights and then coast for the remainder of the straights, before breaking hard while already cornering to aid the charging of batteries using the Kinetic Energy Recovery System (KERS). The power absorbed by drag increases with the cube of speed increase, so less drag results in less energy expense over a lap, while ensuring higher top speeds along the straights. The less disturbed air of a low drag/downforce setup certainly helps the following car but a side benefit of this, coupled with the low-grip, all-weather Michelin tyres, and instant torque is that the cars are incredibly difficult to handle around the corners due to which we see a lot more driver errors in Formula E compared to F1's cornering on rails.

I hope Season 5 of Formula E brings in better uninterrupted racing, made possible by having a single car complete the race. However, I hope that some strategic element of a pit-stop is retained, e.g., allowing for quick, short recharges for additional power at the expense of lost time. Formula 1 and E aside, 2018 is looking to be another cracking year for motorsports with a competitive MotoGP field littered with manufacturers and the the new low-downforce IndyCar.

Musing #49: IMDb Movie Selector


The process of selecting a movie is far less enjoyable that the act of watching it. Hence, I created an app in Qlik Sense to select a movie on the basis of any of the following criteria:

  • Rating
  • Year
  • Runtime
  • Votes
  • Genre
  • Principal Cast
  • Release Year
  • Title Type
  • Adult Content
It uses the dataset files provided by IMDb on their website, which is not to say that it is without issues. However, I have done my best to remove illegible values from each of the columns. There are some interesting insights immediately visible on the loading of the app like:
  • As of Jan 27, IMDb has 4.78 million titles listed with a total of 794.5 million votes
  • The rating curve is a right-tail distribution indicating titles tend to be rated higher than lower
  • The average score of all titles is 6.94, so anything rated 7+ should be considered better than average
  • Drama and Comedy constitute the bulk of titles by far
  • The number of titles has been increasing exponentially over the decades, but it has exploded in this century
There are of course a lot more insights to glean out of this data, so if you are intending to use the app, you need to download the following 4 files from the aforementioned IMDb website. These are updated on a daily basis, so make sure to grab the latest ones whenever you are using the app.
  • title.basics.tsv.gz
  • title.principals.tsv.gz
  • title.ratings.tsv.gz 
  • name.basics.tsv.gz
Each of these files, on extraction, will contain a data.tsv file which is in a tab-separated format. For this app, I renamed each of these files as per the source (eg. title.basics.tsv) and loaded them from 'D:\Data\IMDB' folder. So, if you are doing things differently, be sure to adjust the data library path and file names in the data load editor.

I would have loved to host this app on the web but my server certainly isn't up to the task of handling the work load. Hence, feel free to download the qvf, dataset files and set about on your own journey of discovery. I will leave you with a couple more screenshots indicating the look and usage of this app.


Musing #45: Creating a visual dashboard using Qlik Sense


Lately, I have been in to Qlik Sense and was looking to create a single page dashboard for publicly available information. The most logical place to head to was Kaggle and keeping in line with my previous post concerning US-India, I decided to go with the H1-B Visa Petition data set.