It's dependent on your Bremshundertstel (brake percent), so the result of how powerful the train brakes are and how heavy the train is. You take the Bremsgewicht (brake weight), divide it by the trains total weight and divide that by 100. 65-110 is middle train type (M), 111 and upwards is upper (O). The Bremsgewicht is the result of adding up the individual Bremsgewichte of the locos and cars, usually printed somewhere on the side. But that's just a rough overview, determining train type is a bit more complicated – you can have a slow timetable that has you drive as lower train type even though your brakes are good enough for middle, for example. Rule of thumb: passenger trains are O, freight is M, heavy freight is U.