A rare-event study of frequency regulation and contingency services from grid-scale batteries