Renewable energy growth has exploded in recent years, thanks to plummeting costs: solar panels cost 1/100th of what they did in 1980, leading to a 200% increase in deployed capacity in the last five years alone. Wind has a similar story; the result is that in the USA, new solar and wind are cheaper than any new fossil-fuel powered generation , and continuing to get cheaper.
But, with this cost-and-climate saving revolution in electicity production come some challenges; for instance, there is so much renewable energy on the grid in California that wholesale prices frequently go negative in the spring(when the sun is bright and air conditioning loads are relatively small). It's hard to make money if, when you're producing the most, what you are selling is at it's absolute cheapest.
Enter batteries. Cost declines of 74% since 2012, and continuing. Grid storage, a $1 billion/year market in 2017, is projected to grow to 13 billion/year in 2025.
But how cheap do batteries need to be to make money storing energy during the daily lows and selling into the highs? How much capacity relative to their charge rate do they need to make the most money? This NPM module takes battery characteristics and real-world wholesale electricity prices and outputs when to buy, when to sell, and how much money could be made.
details here
in the Day Ahead Market (DAM), electricity is sold in hour-long increments, 24 hours in advance.
For the first hour of capacity, it's quite obvious - sell at the top of every peak, buy at the bottom of every valley.
For the second hour of capacity, you can't buy and sell at those same high's and lows, because your charge rate doesn't allow it (if it did, you'd have a bigger battery with a 1 hour capacity). So you go to the next best hours.
Put together, it looks like this: