12 ms·
The axle count of trains in Switzerland must not be a multiple of 2^8
- pmalynin 10y agoPresumably because the system uses an 8 bit unsigned integer for counting.
- miander 10y agoBut then the maximum would probably be 255.
- unethical_ban 10y agoWARNING - Did not RTFA, but I think I get the gist. If they use an 8 bit counter, then the detection is basically the axle count % 256. Axle #256 crossing would reset the counter to zero, indicating a safe track, when if wasn't.
- maym86 10y agoAnd 256 would be 0
- cs702 10y agoWow, a simple bit-arithmetic bug somewhere in there has over time become a design constraint for all trains used in an entire country. That's insane!
- jacquesm 10y agoMore of an operational constraint. You can design the various carriages and locomotives any way you want as long as you don't compose them in that way. They're putting an awful lot of faith in that counter though if they allow 255 and 257 that means that they expect to never miscount an axle.
- adrianN 10y agoA single wagon probably has an even number of axles, so 255 and 257 is probably impossible. But yes, those axle counters are extremely reliable, a miscount produces quite a bit of work because then a human has to confirm that the train left the track protected by the counters.
- masklinn 10y ago> A single wagon probably has an even number of axles Do bogies with uneven number of axles even exist?
- rocky1138 10y ago> A single wagon probably has an even number of axles, so 255 and 257 is probably impossible. Voilà.
- tlrobinson 10y agoThat doesn't seem like a safe assumption: http://d2ydh70d4b5xgv.cloudfront.net/images/a/e/fleischmann-3-axle-baggage-coach-5894-ho-scale-train-car-model-mib-dba8cb993304cdd963b7f2d9df8ebe48.jpg http://d2ydh70d4b5xgv.cloudfront.net/images/a/e/fleischmann-... (Not Swiss, just the first train car I could find with 3 axels)
- rmoriz 10y ago
- masklinn 10y agoA train having less than 256 axles in Switzerland doesn't exactly sound limiting, ridiculously long trains are coal and ore lines (e.g. BHP Billiton) or huge general freight in large countries (Canada, US). Switzerland is a fairly small country with steep gradients, a 256 axles limit would give a limit of ~60 cars.
- kozak 10y agoThey don't say that this is an upper limit. The number should not _equal_ 256 (or 512, etc), but it can be larger or smaller than that.
- masklinn 10y ago> They don't say that this is an upper limit. It's not, but considering the context going above would mean going through the limit which would be dangerous, during exit the counter would mark a railroad section as unoccupied before underflowing back to occupied. It might also have interesting failure modes during entry.
- tveita 10y agoIt sounds like that would momentarily register the track as free between the 256th and the 257th axle, a nice little race condition.
- shawabawa3 10y agoIt's not that it has to have less than 256 axles, it has to not have exactly 256 axles (or presumably multiples of 256)
- superuser2 10y agoThis kind of thing makes me less apprehensive about programming jobs going away. The quality of the software the world depends on is so low. We can do so much better and hopefully better will be demanded of us as the field matures.
- camiller 10y agoWhy would you jump to the conclusion that this is a software implementation. I believe, based on the comments in the linked article that it is probably a electro-mechanical counter.
- deleted 10y ago[deleted]
- morsch 10y agoThe problem may not be software, the solution almost certainly will be.
- mywittyname 10y agoThis was likely a known limitation when it was implemented and the costs to overcome it weren't considered worth it.
- tantalor 10y agoSee 3.7.4 Zugbildung, pg 137 http://www.sbb.ch/content/dam/sbb/de/pdf/sbb-konzern/sbb-als-geschaeftspartner/angebote-fuer-evus/onestopshop/grundlagen-netzzugang/R_I-30111_juli_2013_de.pdf http://www.sbb.ch/content/dam/sbb/de/pdf/sbb-konzern/sbb-als...
- kpil 10y agoWhat is the reason for counting? Is it to detect that a train has passed and not just stopped on top of the sensor?
- Aaargh20318 10y agoIf I had to guess they count the number of axels entering a section of track and then count down the same number of axels at the end of a section to know when it has cleared the section completely.
- adrianN 10y agohttps://en.wikipedia.org/wiki/Axle_counter#Track_vacancy_detection https://en.wikipedia.org/wiki/Axle_counter#Track_vacancy_det...
- gsnedders 10y agoThe goal is to answer the question of "is the entire train that passed into this block now out of the block?", alternatively phrased as, "has the train lost any wagons in this block?". If anything has got left behind, you can't let anything go into the block.
- deleted 10y ago[deleted]
- wodenokoto 10y agoOften time law makers choose rules that are extremely difficult to build systems around, when slight changes could have made it fairly easy to implement and reason about such a system. So I suppose it is nice to see that things can actually go the other way around.
- msm23 10y agoThe source http://imgur.com/DrEinPB http://imgur.com/DrEinPB states the problem using "256" not "2^8". I'm not sure if the tweeter is trying to be clever, but he isn't saving any characters by using the exponential notation. If you're trying to save characters in a tweet, you don't have any savings in using exponential over decimal for base two until 2^14.
- masklinn 10y agoOr the tweeter is smart enough to realise a likely origin of the limitation and uses that directly. Considering the tweeter in question, I'd go with the second one.
- joneholland 10y agoExcept I doubt it's a bit math bug, or the warning would be very clear about 16, 32, 64 axle trains etc It's likely that the axle count is stored as a 8-bit unsigned integer.
- masklinn 10y ago> Except I doubt it's a bit math bug What are you even talking about? > It's likely that the axle count is stored as a 8-bit unsigned integer. Which is exactly the point of writing it as 2^8…
- joneholland 10y agoSomehow I read the original tweet as "by powers of 2" and not 2 to the 8th. I blame my lack of morning coffee :)
- tlrobinson 10y agoI think the author was just suggesting this is due to 256 causing an 8 bit unsigned integer to overflow.
- kps 10y ago2⁸?
- dukoid 10y agoI was wondering if this could be an actual problem. Assuming a maximum length of 700m, you get 2.73m per axle. So - 2 axle cars must be longer than 5.76m - 4 axle cars must be longer than 10.92m - 6 axle cars must be longer than 16.38m Found this 6 axle car with a length of 15.0m: https://de.wikipedia.org/wiki/Flachwagen#S-Wagen_f.C3.BCr_schwere_Lasten https://de.wikipedia.org/wiki/Flachwagen#S-Wagen_f.C3.BCr_sc... So yes, this seems to be a real problem, as it is possible to arrange a train with with 256 axles with this type of car that does not violate the maximum length restriction.
- masklinn 10y ago> I was wondering if this could be an actual problem. In Switzerland? Probably not. In other places definitely, large-countries (USA, Canada, Australia) freight and coal/ore trains are hundreds of cars long (and each car has at least 2 bogies of 2 axles), the record is 682 cars and 8 locomotives.
- reustle 10y agoThis has some really interesting info https://en.m.wikipedia.org/wiki/Longest_trains https://en.m.wikipedia.org/wiki/Longest_trains
- andyv133 10y agoAlthough not all rail systems in all countries use axle counters for presence detection. In the US freight industry we use track circuits - https://en.wikipedia.org/wiki/Track_circuit https://en.wikipedia.org/wiki/Track_circuit
- Symbiote 10y agoThat's not a replacement, that's the older technology. Axle counting guarantees that there isn't a detached, derailed wagon fouling the line, or a wagon with dirty wheels which aren't completing the track circuit.
- 10y ago
- codewritinfool 10y agoThis reminds me of the Therac-25 bug. IIRC, overflow of a byte and zero meaning "ok" collaborated to cause big trouble.
- garethrees 10y agoIt follows that the axle count had better not be greater than 256 either, otherwise if the train splits then the front portion could decrement the axle count for the section down to zero, while leaving the rear portion in the section for the next train to collide with.
- rmoriz 10y agoAs mentioned in other comments, the maximum train length was limited in Europe to around 670m (therefore the possible axle count is rather limited) which will be increased on some networks and tracks. There are several different implementation of axle counters (for example http://www.scheidt-bachmann.de/en/signalling-systems/interlocking-system/axle-counter/ http://www.scheidt-bachmann.de/en/signalling-systems/interlo...), also train splits in Europe will trigger an emergency break due to air pressure drop in the breaking system. https://en.wikipedia.org/wiki/Railway_air_brake https://en.wikipedia.org/wiki/Railway_air_brake The note is just a sign of the huge safety margin that modern European railway systems implement in regular usage.
- VLM 10y agoTrains have a belt and suspenders approach to safety and FRED would go nuts if separated from the locomotive. https://en.wikipedia.org/wiki/End-of-train_device https://en.wikipedia.org/wiki/End-of-train_device Also very few non-railroad people understand pneumatic safety brakes, and suddenly breaking a brake hose locks the breaks on both halves of the train until the tanks drain completely down. Pneumatic brakes operate like a mechanical differentiation analog computer and the strength of the brake application is the rate or slope at which the brake hose pressure is dropping. An axle counter is like the stupidest defect detector imaginable. Modern defect detectors are like robot Q+A inspectors, every 20 miles or so they detect hot bearings, any load hanging out or down or too high, fancy ones can do on the fly weighing (hmm that tank car full of oil is losing 50 pounds per mile, someone has a leak...) for decades there's been work done with various barcode and RFID schemes to track and log individual cars, pretty interesting stuff. I would guess there exist dumb defect detectors that can not detect overheated bearings at exact integer multiples of 1024 degrees F or something. There's a nice one near a park a few miles from my house and using a scanner tuned to railroad frequencies you could hear a synthesized voice identify itself and say something like "no defects found" I never heard it say anything else. There is nothing wrong with defense in depth. It was paid for in blood, after all. The biggest problem with defense in depth is it leads to lazyness, well, we don't have to care about 256 axle trains because there's at least three other safety systems, etc etc. Then you end up with every one of them in a corner case and someone gets killed resulting in more regulation.
- Bromskloss 10y agoI imagine the Olsen Gang/Olsen banden/Jönssonligan whisking away a train while keeping their theft hidden from the system through the power of 256 axles.
- ralfd 10y agoThat is a reference I did not hear for 20 years.
- Bromskloss 10y agoReally? It's very much present in my cultural reference frame. :-)
- Kenji 10y agoThank you for making me feel much less safe on Swiss trains now =) That aside, I've often been wondering how these systems work exactly. There must be a challenging engineering problem behind organizing all of this.
- Turing_Machine 10y agoYes, it's fascinating. For a look at how a complex system this can be handled without computers, do some reading on how signaling and train movements were handled in the 19th Century. Pretty amazing how they were able to control continent-wide rail systems with hundreds of trains in motion at any given time, using just a telegraph wire, manual signal lanterns, slips of paper, etc... without (usually) causing any collisions.
- jsingleton 10y agoOne of the rare benefits of the antiquated signalling system in the UK, using good old-fashioned analogue tech, lots of wires and relays. I was once shown a bug in the system, that was literally a bug, squashed between two relay contacts.
- IshKebab 10y agoVery rare. It seems like 90% of delays are due to "signalling problems" (which is probably also code for "we have no idea what is going on", but still...)
- jsingleton 10y agoThe signals are designed to fail safe, due to gravity. But because they are electromechanical they fail a lot more often than solid state digital tech.
- gsnedders 10y agoGravity doesn't play into it much any more; semaphore signals are increasingly rare by this point, certainly on any main line. Modern electric signals simply default to danger in the absence of contact to the signal box, and fail-safe behaviour is maintained by the rule book stating that a signal displaying no aspect is equivalent to a signal displaying danger.
- jsingleton 10y agoGravity is still very important. The way that electric signals fail safe is that the relay is mounted in such a way that if something fails then gravity pulls the contacts to the danger position.
- lewiseason 10y agoAren't relays usually lightly spring-loaded/tend towards the NC position irrespective of which way you mount them? Maybe railway signalling relays are different, but none of the relays I've ever seen leave that behaviour to gravity.
- jsingleton 10y agoSimilarly, in the UK train axles must not be more than a set distance apart, otherwise the train could disappear (from the signalling system). This is one of the reasons we can't have double decker trains, as the carriages aren't long enough.
- Someone 10y agoFor the curious: double-decker carriages do not have to be shorter or have shorter axle distance, per se, but in the UK, they have to because their rail network is older, and can't handle the load that a double-decker train of 'normal' length exerts on the rails. https://en.m.wikipedia.org/wiki/Bilevel_rail_car https://en.m.wikipedia.org/wiki/Bilevel_rail_car: "Bilevel cars may not be usable in countries or older railway systems with low loading gauges. This includes much of the rail network in the northeast of the USA and almost the entire British rail network. In some countries such as the UK new lines are built to a higher than the existing structure gauge to allow the use of double-deck trains in future."
- gsnedders 10y agoIt's not the load: the loading gauge refers to the maximum dimensions of a train. In the UK, the vast majority of lines bridges and tunnels are simply far too low to allow for double-decker coaches; the only ones ever used had pretty weird offset compartments: see <http://dart75.tripod.com/cutaway.gif> http://dart75.tripod.com/cutaway.gif> for a cutaway diagram.
- Someone 10y agoThanks.
- anentropic 10y agono wonder we have so many delays due to "signalling problem"...
- kazinator 10y agoCould it be that this runs on little endian? And some code is accessing a 16 or 32 bit integer as though it were just a byte, so it gets only the low 8 bits? This the one disadvantage of little endian: an aliasing bug between different integer widths is hidden if the code isn't tested with sufficiently large values. On big endian, it's likely an instant show-stopper, since small values near zero map to zero. Note how the issue is that the value can't be a multiple of 256: i.e. have the least eight significant bits clear. That's troubling still, because although an axle count of 257 mitigates the signaling problem, the strong suspicion lingers remains that this 257 might be treated as an axle count of 1; and doesn't that have ramifications? I.e. it might be used as an 8 bit value for more than just an "do we have axles or not" test.
- gsnedders 10y agoThe systems with these limitations are mostly 1970s systems based on 8-bit microcontrollers, so I strongly suspect that they're using 8-bit integers. And yes, there are concerns about modulo behaviour, but this ultimately is an engineering trade-off: what is the probability of losing exactly 2^8 axles from a consist?
- jswny 10y agoCan we link to the actual Tweet instead of the mobile version please? https://twitter.com/mitsuhiko/status/752398314528731137 https://twitter.com/mitsuhiko/status/752398314528731137
- dopamean 10y agoHow is the desktop version more "actual" than the mobile version?
- cldellow 10y agoDepending on your user agent, the desktop version actually has the tweet in its HTTP response. Additionally, the mobile one rel=canonicals to the desktop one. Two good reasons to think of the desktop version as the actual version, especially when linking in the open web.
- FuNe 10y agoDunno much about trains but how far away from the traffic light would the button be? Certainly not more than 256 x wagon.length. I.e. in the unlikely case of a train with 256 wagons the light will signal green (unfortunate) but while it does so there will be a train passing by the crossroad. So in that case only (257 wagons won't do it - they'll merely cause a green blip) you'd need to have a really pedantic driver at wheel to try to pass because light went green.
- Pxtl 10y agohttp://www.xkcd.com/1700/ http://www.xkcd.com/1700/
- david-given 10y agoFun fact: you know token ring networks? It's based on a system of reliable mutual exclusion used by early railways. It worked like this: you have a long stretch of single-track line. Trains run in both directions on the line. Obviously you want to prevent collisions. But you don't have communications from one end to the other. How? At each end of the line, by the signal which lets trains onto the line, there's a hook. There is exactly one token, which is a physical object which hangs on the hook. A train is only allowed onto the single-track line if the token is physically in the possession of the driver. On emerging from the other end of the line the driver hangs the token back on the hook. Simple and foolproof (if not terribly efficient). https://en.wikipedia.org/wiki/Token_(railway_signalling) https://en.wikipedia.org/wiki/Token_(railway_signalling)
- personjerry 10y agoNow you're making me want to play OpenTTD again
- Bromskloss 10y agoI'm looking forward to Token Ring Simulator.
- conanite 10y agoExtra inefficient for two trains going in the same direction... gotta wait for the next train in the opposite direction
- thisrod 10y agoEarly? It was used on one section of Australia's main train line until a decade ago.
- zedadex 10y agoI mean, that doesn't invalidate what he was saying, but that's an interesting bit of info.
- B1FF_PSUVM 10y agoActually, that's not what the spec says. It only mentions "not being 256". So, technically, 512 would be fine.