In spring 2022, after having been in one too many discussions about batteries, energy storage, and renewable share in energy grids, I decided to write a Twitter đź§µ on the subject, trying to collect what I have learned in the decade before that. I think it's high time I transferred this to mastodon, as long as I still can at least read Twitter.
Also, there are a few things I wanted to improve on that thread, so this is my chance.
The TL;DR:
i) Due the need to do primary control (frequency response), a 100% renewable grid is impossible. You need either combustion engines or batteries to run your grid.
ii) Batteries are not great for storing significant amounts of energy, but they are very well suited for frequency response.

Disclaimer: While I have been writing code in this domain for a decade, I am not an electrical engineer and mostly only learned what I needed on the job. Electrical engineering is complicated, people spend years studying it, and there is no way I could cram everything needed into this thread even if I knew it all—which I absolutely do not. So I have to oversimplify things.
Dear electrical engineers, reading this might physically hurt you. I am sorry.

Now let's get started!

Traditionally, electrical power is provided by big rotating masses. Steam, oil, diesel, or gas generators turn coils in magnetic fields, which creates an AC current in the coils. Their turning speed determines the grid's frequency.
If too much energy is drawn from them, they slow down, if it is too little, they speed up. But machines have used centrifugal governors to regulate their speed at least since Watt invented his steam engine, so controlling rotation speed is a solved problem:
Increase fuel usage when the frequency is going down, reduce it if it is going up, so you always provide exactly the power needed. This is generally called primary control (or frequency response): an immediate response to demand fluctuations, fast enough to be practically instantaneous. What's more, communicating this throughout the grid by means of frequency allows generators to orchestrate power distribution: All producers see how it changes and can contribute to the best of their abilities.
Now let's add a bunch of photo-voltaic (PV) panels with AC inverters to the mix. Those are *variable* power providers: Their output changes according to *supply*, not to *demand*. Supply depends on latitude, time of day/year, cloud cover, and other factors. PV inverters (usually) cannot *create* a grid. Other ("grid-forming") generators need to have done this first. ("Grid-following") PV inverters can then sync to that existing grid, adapting their frequency and phasing to it.
The PV panels provide as much power as they can and leave the rotating masses to sort out the rest. But this is fine only if you have a relatively small amount of this unregulated power in your grid, and the rotating fossil fuel generators can compensate for any fluctuations in consumption *and* PV supply.
If your PV supply varies between, say, 20% and 60% of your demand, then your generators need to provide between 40–80% of the energy. Things might get complicated then.
On a sunny day, only 40% of your fossil fuel generator capacity is needed, but if some dark clouds come by, you might suddenly need 80% of it. And you need to be prepared, because cloud cover changes within minutes or seconds.
However, rotating generators might need considerable time to startup and shutdown, so in order for a generator to quickly take over, it needs to already be running. But they usually have a minimum power output, and that might be considerable.
The minimum power of all your generators might well be higher than 40% of your demand.
You could curtail the output of your PV panels so that they can never produce more than what your idling generators do not provide for the current demand. But then you throw away power provided by the sun for free ("excess renewables") and use fossil fuel instead.
Or you could turn off some of the generators, thereby risking not having enough generators running in standby to compensate for sudden fluctuations.
And combustion engines have their ideal operating point. You usually want to run them close to where they are most efficient, and stress and wear is lowest, to minimize their costs. And there's more complications…
So you need to balance a lot of variables and the solution depends on many factors: What are the exact numbers we are talking here? What risks can we take? Is this the power supply for a weekend home? Or for a whole metropolitan area, with hospitals, traffic lights, and subways?
Enter batteries. Here, we use the term for electro-chemical assets which can both consume (charging) and produce (discharging) power. But they charge/discharge DC, so, like with PV power, you need to connect a string of batteries to your (AC) grid through an inverter which converts between AC/DC. The combination of a string of batteries and an inverter is often called an "AC battery" and usually controlled as a singular asset.
Like combustion generators, battery inverters are grid-forming.
Important properties are their lifetime (energy capacity decrease after a number of charging/discharging cycles), the amount of energy they can store, the power they can charge/discharge with, and their power/energy ratio, the C rate. The properties of the inverter and the battery chemistry are responsible for all these factors. Currently, mostly Lithium ion batteries are connected to grids. They provide high C rates and less energy capacity decrease per charge cycle than other batteries.
As long as batteries have capacity to charge or discharge, they can do either with any power (up to their maximum power) you need, so they can actually replace your generators, create and maintain a grid, and control their power according to demand. So you can actually turn off those fossil fuel monsters!
And by charging, batteries can provide "negative power". Your minimum idling power is now negative, which means you can suck up excess PV power, and feed it back into the grid later!
But you cannot charge a fully charged 5MWh battery any further and will only ever get <5MWh out of it. And once discharged, you need electricity to charge it again, rather than just refilling a tank. Plus, batteries have a much lower energy density than fossil fuel. The latter is why most batteries are not well suited for storing considerable amounts of energy: A 10MWh battery plant is the size of a school's gym, while a 1MW diesel generator and 10h worth of fuel easily fit into 1–2 containers.
So you need to keep some of your generators as backup because fossil fuel can be stored cheaply and almost without losses. But you get to turn them off for long stretches, significantly reducing fossil fuel use and mechanical wear on them. Hence, by using batteries, you can increase the renewable share in your grid, thereby helping to save this planet. And to top it all off you also save money!
In fact, there are many companies making a profit by selling this technology to other companies.
Let me reiterate: By putting up wind and PV farms, and hooking up battery power plants to our grid, we could significantly reduce our fossil fuel usage *at a profit* within just a few years. This is proven technology, which has been in the field for *many* years, and comes at a relatively low safety risk. (Compare this to nuclear power plants, which are rather expensive, take a decade or two to build, and take whole nations as backup to get insured because of the risk of a meltdown.)
@sbi hmh to be fair nuclear power has also been here for decades. And with battery density also come higher risks of electrical fire, which is pretty scary.
@corsac I'd rather have a hundred local fires where lithium batteries burn indistinguishably, than one more Fukushima.
That, however, is irrelevant since we cannot install enough nuclear power in time anyway. Building a NPP from scratch takes 20 years nowadays. Until we will have increased the current amount of installed nuclear power by a significant factor (thereby increasing the chance of another disastrous incident, BTW), it will be too late to avert the catastrophe we are heading into.
@sbi except it’s not an either: nuclear power and batteries don't really play the same role in the grid, are they? Anyway I wasn’t trying to convince you, and if we’re on the "what I prefer" trend we’re out of the engineering thread and I don’t think arguing there makes much sense.