For many years we've had an entry on the games tasklist item for "A realistic train-driving simulator." I've found two projects that might satisfy this requirement: http://www.openttd.org/ (which is GPL licensed) and http://openbve.trainsimcentral.co.uk/ which is public domain. Both take different approaches to the idea of simulating train traffic, and both look pretty interesting in their own ways.