Electric vehicles could be cost-competitive with internal combustion-powered cars within five years and batteries that store power from solar panels could become commonplace by 2030 if current investments in those technologies continue, British researchers estimate.

A new tool produced by Imperial College London uses data on the prices and installed capacity of battery storage to project how quickly their prices would reach levels that would compete with other energy sources. The findings, published today in the journal Nature Energy, suggest electric cars will match gasoline engines’ costs per mile sometime between 2022 and 2034 — and a solar-battery combination could be as cheap as today’s retail electric bills between 2027 and 2040.

The program allows researchers to plug in existing data to project when developing technologies to become cost-effective, co-author Iain Staffell, of Imperial’s Center for Environmental Policy, said in a statement on the study.

"This tool allows us to combat one of the biggest uncertainties in the future energy system,” Staffell said.

With the world trying to reduce its output of planet-warming carbon dioxide and other gases from fossil fuels, the ability to store energy from solar, wind, or hydroelectric power would allow for wider use of those carbon-free but intermittent sources. That prospect is driving extensive research into battery technology and increased interest in electric vehicles.

Industry giant General Motors and upstart Tesla are now offering battery-electric EVs with a 200-plus-mile range and a starting price tag under $40,000. Nissan is working on an upgraded version of its popular Leaf with a longer range, and Volvo recently announced that it would leave behind solely gas-powered vehicles after 2019.

Tesla is also getting into the home solar business, offering photovoltaic panels combined with a home-sized battery pack to store electricity for a rainy day.

Investors pumped nearly $350 billion into clean energy projects in 2015, with the money devoted to finding those solutions growing by an average of nearly 16 percent a year since 2004, the Imperial study calculated. Most of that was spent on wind and solar power, with about 3 percent — roughly $10 billion — percent going into battery research and development.

Developing home power systems might require between $175 billion and $510 billion to get to the point where consumers have installed 1 trillion watts of battery-storage capacity, the authors estimate. By comparison, the Tesla Powerwall has a capacity of about 14 kilowatts (14,000 watts).

But renewable technology is already dominating new electrical power installations as solar and wind power becomes cheaper, the United Nations reported in April. New solar capacity grew by about a third over 2015, though the money invested in those projects fell by a third.

And with Germany spending about $9 billion on renewable energy in 2015, and China devoting more than $100 billion, spending $500 billion-plus on an individual technology by 2040 “appears reasonable,” the Imperial study concludes.

“With this analysis tool we can quantify when energy storage becomes competitive and identify where to invest to make it happen, thereby minimizing investor and policy uncertainty," Oliver Schmidt, the study’s lead author, said in the statement.