6

I work in a control center for a train company in the UK. Our trains work in either direction but only one end has first class carriages. Because trains on our network reverse quite a lot it is difficult for us to track and advertise where first class will be.

Is it possible to create a device using a digital compass that will identify whether the train is travelling North or South and that can push this information via a GPRS transmitter so that it can be read on a PC? The device would be positioned at the first class end of the train with North pointing forwards. In theory If the compass direction is north and pin also north we would know that first class would be north facing. If the compass read out was south first class would be south facing.

I presume the main difficulties with this would be transmitting the information being read from the compass. Can anybody offer a solution?

  • This 'problem' can be removed by placing the first class carriages in the centre of the train. Perhaps then the train operating company can concentrate on fair reduction and reducing over-crowding in the lesser classes. – paulkayuk Mar 13 '13 at 14:35

4 Answers4

3

This could be very easily prototyped in it's entirety with a smartphone - you have the sensor, the programmable platform, and the radio network link.

Doing it that way with cheap off the shelf hardware matching a widespread developer skillset will let you explore the idea and start to discover what unanticipated issues might be lurking.

For example, you haven' been very clear about when the measurement will be taken. If the train is still in the station, it's possible the station tracks aren't really pointing in the direction of the journey. A solution based on data pulled out of your scheduling system should be weighed as well.

Chris Stratton
  • 33,282
  • 3
  • 43
  • 89
  • Thanks for the answer. You raise a valid point, not all stations tracks are facing in North/South directions. However, if the readings were taken at the start of service from origin stations the results could be used to calculate formations of trains for the rest of the day. – Daniel Autiero Mar 11 '13 at 18:44
  • Chris, how easy would it be to create an app that could send its facing direction in degrees to a another location? Most of the google results seem very technical, although programming isn't something I am familiar with. – Daniel Autiero Mar 11 '13 at 22:09
  • It would not be particularly hard. Most of the challenge would be figuring out the rules for what/when it should send, and figuring out what to send it to. For example, email (takes a little doing to have that be entirely non-interactive), or coming up with a server it can post to. You might even look at some of the analytics platforms which do things like fill information into google docs spreadsheets. For initial testing, another possibility I had mentioned would be to just log data for a week to the device's storage, and then retrieve it - that way you wouldn't even need a data plan. – Chris Stratton Mar 11 '13 at 22:21
  • I suppose with so many apps uploading data to the all powerful cloud these days it would be fairly straight forward for a software developer. Perhaps I will contact some. In the mean time a weeks experiment using an old smartphone will go ahead. Thank you again. – Daniel Autiero Mar 11 '13 at 22:28
3

GPS would be my choice (over compass and accelerometer). At least, it could be a good backup plan if the compass doesn't work. I don't know how easy it is for you to have a GPS antenna with an adequate view of the sky.

1st GPS receiver in the 1st class car. 2nd GPS receiver on the other end of the train. This will provide all the information for identifying the direction and orientation of the train. If the 1st receiver is in point A and the 2nd receiver gets there, say, 3 seconds later, then the sought 1st class car is at the front of the train.

Like compass and accelerometer, the GPS approach is also easy to prototype with a smartphone.

Nick Alexeev
  • 37,739
  • 17
  • 97
  • 230
  • Thank you. Another great solution. GPS locators are relatively cheap and many come with software so this could be the cheapest option as well as being effective. – Daniel Autiero Mar 11 '13 at 19:18
1

The problem with a compass is that it only tells you which direction the carriage is facing. It doesn't tell you which direction it is going in, or which end of the train it is at. You need additional information to do that.

Take the London Kings Cross to Glasgow Central route. In both locations the train will be pointing virtually North/South, and the trains simply reverse back down the line - I don't recall the last time first class wasn't at the near end of the platform at Kings Cross. The compass doesn't help you here without additional information, namely a timetable or where the train has just come from.

The reason I say this is that all announcements I have heard on the platform or train all refer to front/rear. It seems far easier to just know front/rear than infer it from additional information such as a timetable (which can't be relied on in the UK) or live scheduling information (which seems to vary from TOC to TOC - SouthWestTrains is always correct, FGW have to override automated announcements manually all of the time).

You need to know which direction the train is moving in, which is very different. The complex solution to this is GPS. You could use one unit (only useful once the train is moving) or two units (useful when stationary) to do this. It seems like a lot of work.

Easier than this would be an accelerometer, but again, this will only work once the train is moving.

How would I suggest doing it? A small box with a GPRS modem in each driving cab. The driver presses a button during his pre-departure checks. Depending on which one is pressed, you know which end is the front. The issue with it is that you have to rely on the driver, and implementing a fleet-wide additional step to checks may be hard. You could try detecting the presence of the driver in other ways - PIR might work (fails if the guard sits in the non-driving cab). I doubt you'd be able to link into the trains systems to detect where the driver was.

Cybergibbons
  • 1,934
  • 1
  • 16
  • 21
  • Please explain in your example why knowing which way the first class carriage is pointed is insufficient to know which end of the train it is at, given knowledge of the orientation of the track and the assumption that it's always to be found at one end or the other? The situation you don't recall ever having changed does seem to be precisely what the poster is trying to indicate the possible daily variation of for their particular line. – Chris Stratton Mar 11 '13 at 20:17
  • The carriage in both situations is pointing North. In Kings Cross, the carriage is at the rear. At Glasgow it is at the front. Both stations have track running North/South. How do I tell the difference? – Cybergibbons Mar 11 '13 at 20:21
  • The desire isn't to tell which station it is at, but to tell which end of the train it is at, and therefore which end of the platform it will be at in a given station. For it to swap ends of the train on this north/south track, it would have to end up pointing in the other direction (or else the train decoupled and recoupled with the cars placed differently) – Chris Stratton Mar 11 '13 at 20:24
  • Ok - take this example. At Kings Cross, the compass shows North with the carriage at the rear. At Glasgow, on the same train, the compass shows North. The train is now at the mid-point, Grantham. The compass shows North. Is the carriage at the front or rear of the train? – Cybergibbons Mar 11 '13 at 20:34
  • That's not the right question. The goal is to tell people where to walk/wait, so the question is which end of the platform, relative not to the motion of the train but to the geography of the station. – Chris Stratton Mar 11 '13 at 20:38
  • So now the train needs to be aware of the geography of the station - how does it do that with a compass? – Cybergibbons Mar 11 '13 at 20:39
  • It's not the train that needs to know, but rather the station, because that is where the people the information will be announced to are - they will be told that the first class carriage will be at the north or south end of the platform today. – Chris Stratton Mar 11 '13 at 20:39
  • There's now two trains at Grantham, one at platform 1 and the other at platform 2. Both compasses are pointing North. Which end of the train is the carriage, front or rear? – Cybergibbons Mar 11 '13 at 20:48
  • Again, wrong question. The proper question is which end of the platform, North or South? (assuming that is the alignment of the station track) – Chris Stratton Mar 11 '13 at 20:50
  • Nope, that's the wrong answer. No train companies advertise which end of the platform to go to by compass direction. It is always front or rear of the train. – Cybergibbons Mar 11 '13 at 20:52
  • Then you translate to that based on knowledge of which way the train is going from the timetable - something you also do tend to announce / display to the public, as they tend to get a bit more annoyed by ending up in the wrong place than by ending up in the wrong class of service! – Chris Stratton Mar 11 '13 at 20:53
  • It's taken a long time to get to this point: "The compass doesn't help you here without additional information." What is a timetable? – Cybergibbons Mar 11 '13 at 20:53
  • East coast mainline trains do not have this problem as their trains hardly ever turn around so the first class positions will be the same for each train most days. The problem lies with other operators such as Cross Country who's trains often reverse back out of stations whilst on a journey. – Daniel Autiero Mar 11 '13 at 20:54
  • Also first class positions are advertised on the stations as most passengers will know the direction the train will be arriving from but not the formation of the train. – Daniel Autiero Mar 11 '13 at 20:57
  • 1
    Imagine a train with a compass fixed so that if it was travelling north, the pointer would be pointing at North. This indicates the train is first class front. If that train was the opposite way round the compass needle would be facing north although in relation to the compass it would be reading south. – Daniel Autiero Mar 11 '13 at 21:00
  • Chris, a timetable is additional information from which you need to infer something. Exactly what I said. – Cybergibbons Mar 11 '13 at 21:03
  • But it's information already available to the railway management! This question asks how to infer the unknown information which is needed, from the information which is already known, plus one additional measurement. – Chris Stratton Mar 11 '13 at 21:03
  • Would this not give a different reading on a digital compass? I thought it would and based my original idea on it. – Daniel Autiero Mar 11 '13 at 21:05
  • 1
    Currently most companies rely on information coming from depots to work out first class positions for entire day. However this is still prone to human error. Also add to this that during disruption trains will divert which will change the position of first class. The aim here is to cut out human error using electonic equipment. – Daniel Autiero Mar 11 '13 at 21:08
  • So Daniel - the current system is geared up for knowing front/rear, so would it be preferable to know front/rear from the automated system? – Cybergibbons Mar 11 '13 at 21:22
  • In a perfect world a phone call from a driver would confirm which cab he is driving from before each journey. All we know each morning is which end first class is when it departs the depot (north or south facing), using this info and route knowledge we calculate the position for each journey and update the displays. There is no front or rear as such on modern trains. The direction of travel indicates this. – Daniel Autiero Mar 11 '13 at 21:37
  • A digital compass app on a smart phone displays degrees as well as the heading. So if we presume that the compass is fitted to the train pointing forwards out the first class end of the train and the compass was reading anywhere from 221 degrees SW to say 116 degrees SE we would know that the trains first class is towards thew rear. – Daniel Autiero Mar 11 '13 at 21:46
0

Why not use an accelerometer?

Presumably, all you care about is whether the train is going forward or backwards as far as the first class cabin is concerned. That way you don't have to worry about interference.

The trouble with the compass is that it'll still be pointing the same direction unless the cabin (device) physically turns around.

MandoMando
  • 3,242
  • 3
  • 22
  • 29
  • Thank you. Would an accelerometer give a negative reading if the train was travelling backward? – Daniel Autiero Mar 11 '13 at 18:48
  • yes, exactly. That's the idea. Though it may be a small value given that trains don't accelerate fast, and once at cruising speed, it'll go to zero. You should still be able to tell which direction it's going based on previous values. – MandoMando Mar 11 '13 at 18:55
  • This may actually prove tricky for that reason. An accelerometer does not detect velocity, rather it detects acceleration (and in an electric railway, it's primarily the same mechanism used for both, so magnitude may be similar). Which is to say it will detect both starting out of a station, and also slowing/braking into one, so you'd have to have a rule to know which one to look at. But a smartphone has an accelerometer, too, so if you want to combine the ideas and can arrange for a fixed-orientation mounting the cab during your tests, you can play with sensor fusion. – Chris Stratton Mar 11 '13 at 19:00
  • Thank you for the feedback. I understand the difficulties you have identified. I will have a ride out and test using a smart phone to see if there is a pattern. – Daniel Autiero Mar 11 '13 at 19:15
  • There are some sensor Accelerometer and Compass demos in the Android SDK samples. They only graph and do not log, but it would not be hard to modify them to log. If you can get mains or USB power in a protected location in any of the the cars, you could mount a phone for a week (even a castoff without a service plan) and have a lot of data to look at. – Chris Stratton Mar 11 '13 at 20:22
  • That's not a bad idea. Cheers. – Daniel Autiero Mar 11 '13 at 21:03