As of now it can be seen that from trivandrum to ERS the sleeper coaches are in front followed by the AC coaches at the rear (S-1,S-2..... till S-12 followed by B1-B2-B3-B4-B5-A1-A2) From Ernakulam due to engine reversal, the order reverses and the AC coaches are in front (SLR-GN-A2-A1-B5-B4....PC, S-12,S-11 till S-1 and Gen).
I think it needs to be mentioned TVC to ERS and ERS to Delhi (NDLS) separately for better understanding. But there have been a few occasions when the order has also changed from TVC but most of the time it is as mentioned here .