Yes, S340, 940, T-15 are all the same size 40K cell.
940 is an extended life version of the 340 cell. Supposed to have more rare earth coating and cell hours.
340 is Haywards new marketing terminology for their old T-15 cells.
I think the 340/940 cells have chips in them to identify as Hayward OEM cells