Hi Mark
You can't reliably predict the TSPEED value 100% of the time I'm afraid - you can maybe get 99.5% accuracy, but you're likely to fail quite drastically under certain conditions.
TRUST has an algorithm which sets the TSPEED to N, and then O, if there's already a train called with the TSPEED of M which starts from the same STANOX at the same time. Trying to replicate this algorithm will be at best tricky.
One example: last Tuesday, for example, three 2D06s were due to leave from an origin in STANOX 'area' (not sure if that's quite the right term) 88xxx and were called thus:
03:26:46 W81375 - 0526 Gravesend - Charing Cross as 882D06M518
03:40:47 W81379 - 0540 Orpington - London Victoria as 882D06N518
03:42:46 L05097 - 0542 Hastings - Eastbourne as 882D06O518
If schedule L05097 is manually called at 0310 so it can be cancelled from origin, then it will have a TSPEED of M, and the other two N and O. Or, if it were manually called at 0330, it would have a TSPEED of N.
There are some other instances too which I'd have to look up. Of course, it's up to you whether you want to try to re-implement the algorithm - only you know what the impact of getting it wrong will be.
Peter