Advanced Microgrid Solutions has landed the world's largest retailer as a partner: Wal-Mart.

On Tuesday, the San Francisco-based startup announced it is working with the retail giant to install behind-the-meter batteries at stores to balance on-site energy and provide megawatts of flexibility to utilities, starting with 40 megawatt-hours of projects at 27 Southern California locations. 

Under the terms of the deal, “AMS will design, install and operate advanced energy storage systems" at the stores for no upfront cost, while providing grid services and on-site energy savings. The financing was made possible by partners such as Macquarie Capital, which pledged $200 million to the startup’s pipeline last year. 

For Wal-Mart, the systems bring the ability to shave expensive peaks, smooth out imbalances in on-site generation and consumption, and help it meet a goal of powering half of its operations with renewable energy by 2025. Advanced Microgrid Solutions will manage its batteries in conjunction with building load -- as well as on-site solar or other generation -- to create what it calls a “hybrid electric building” able to keep its own energy costs to a minimum, while retaining flexibility for utility needs. 

The utility in this case is Southern California Edison, a long-time AMS partner, which “will be able to tap into these advanced energy storage systems to reduce demand on the grid as part of SCE's groundbreaking grid modernization project,” according to Tuesday’s statement. This references the utility’s multibillion-dollar grid modernization plan, which is now before state regulators. 

Advanced Microgrid Solutions has a longstanding set of plans with Southern California Edison. In 2014, the startup won its first big contract with SCE to bring 50 megawatts of flexible capacity resource on-line by the end of the decade, as part of the utility’s groundbreaking local capacity procurement. Macquarie Capital acquired the project in August 2016, and last month announced the close of non-recourse project financing with CIT Bank to fund its rollout over the next 12 to 24 months.  

Last year, AMS won a 40-megawatt contract for SCE’s Preferred Resources Pilot, or PRP, an attempt by the utility to procure efficiency, demand response, solar and storage to help mitigate grid issues on two Orange County substations. It’s working with property owner Irvine Company to deploy 10 megawatts of capacity across 24 office buildings, and with the Irvine Ranch Water District to bring 34 megawatt-hours of batteries to 11 sites across its Orange County service territory.

AMS is also a participant in California’s Demand Response Auction Mechanism, or DRAM pilot, which has contracted a dozen or so companies with more than 125 megawatts of demand-side capacity that utilities are hoping will meet part of their capacity needs. Other partners include Skyscraper One Maritime Plaza, California State University, Shell Energy North America and the Inland Empire Utilities Agency. 

Advanced Microgrid Solutions has also ventured outside its home state, starting in Maine, where it’s participating in a U.S.-Canada microgrid technology test with startup Opus One Solutions. While Tuesday’s announcement didn’t name a battery partner, AMS has used Tesla Powerpacks for most of its work in California so far. As of mid-2016 the company had 2.5 megawatt-hours in operation, and 35 megawatt-hours in permitting and construction scheduled to be on-line by the end of 2016. 

The startup has received equity funding from CEO Susan Kennedy’s former boss, Arnold Schwarzenegger, as well as DBL Investments and Engie, the large French electricity and gas provider that’s been making a lot of distributed energy-related investments of late. 

Wal-Mart leads the country in corporate adoption of solar, with 142 megawatts installed as of 2015, a lot of that in California. It’s also taking a lead on energy storage deployments, with 17 projects, all in the state of California, including six 200-kilowatt/400-kilowatt-hour solar-tied batteries that are now serving time-of-use shifting and peak demand shaving.

Wal-Mart has also installed onsite generation at 350 of its stores, in large part to allow them to stay open and running during blackouts -- although grid resiliency was not specifically highlighted as a use case in Tuesday’s announcement.