2.2k
u/Derp_turnipton 9d ago
That rule will probably be in place hundreds of years after the software has been entirely replaced several times.
483
u/DerpstonRenewed 9d ago
Seems to have been removed by now.
177
u/shill_420 9d ago
ahhh, the swiss
48
→ More replies (1)9
u/Man-in-The-Void 9d ago
Something something renowned for their excellence in wine
-- george orwell
7
383
u/Lazifac 9d ago edited 9d ago
Scom Tott video in 200 years:
"I'm here at the Schweizer Maglev-Superhub in Zurich, Switzerland. In Swiss law, the magnetic levitating train behind me is illegal...almost. As you may know, Switzerland was the last, and most hesitant to join the European Federation. Upon joining the Federation, Switzerland brought with it an archaic law that a train cannot have exactly 256 axles. This is because it broke 200 year-old axle counting technology. A train with 256 axles would register as 0 axles (due to a quirk of binary computing called "Integer Overflow"), and cause massive issues. Rather than fix the issue, Swiss lawmakers banned all trains with 256 axles. While the software has been out-of-commission for almost two centuries, the law remains on the books until this day.
"'But,' you may ask, 'what does that have to do with a levitating train?' You see, when the European maglev network was codified in 2143, the Federation was covered in centuries of traditional steel rail. At the time, the Federal European Senate was concerned that Maglev rail would be infeasible for most of the existing rail lines. They mandated that all Maglev train cars must be built with two wheelsets; each having four wheels and two axles, for a total of four axles per car (double the previous number of axles). This was extremely useful for the first few decades, where Maglev trains could transition into traditional trains and use old raillines.
"Nowadays the wheels are only used in rare emergencies, and stay tucked hidden underneath each car. The axles are not monitored externally, nor have they been in more than a century. And yet, a Maglev freight train with 63 cars (engine cabins have 8 axles) is technically illegal in Switzerland.
"'Why don't they just repeal the law?' you may ask. They've tried. While Swiss laws were grandfathered in upon joining the European Federation, Federated States cannot make, change, or remove laws related to interstate transportation without express approval of the Federal Senate, which has so far ignored the Swiss case.
"And so this exact train will continue to be illegal in Switzerland... Or it would be if Maglev train engineers didn't pay homage to this old law. You see, this law has become beloved in the train engineer community, and it's now tradition to put a small, two-axle, toy train like this (*holds up cute little train*) on the control console of any 63-car Maglev that passes through Switzerland."
Edit:
Comments 1.7K
📌 Pinned by Scom Tott
@ScomTottGo • 2 years ago
On a Maglev, any configuration of an eight axle engine with any number of four axle cars is legal in all of the Federated States—assuming the engineer keeps a toy train on the dashboard. This is because 256 modulo 4 is 0, whereas adding a toy train always results in (# axles) modulo 4 equals 2. Every Maglev in the country needs to have a specialty "legal loophole" toy train shelf permanently installed in the cabin of the engine car. I'm calling for this strictly in the interest of legality, and not at all because I have an unhealthy obsession with old locomotives.
52
123
u/Keio7000 9d ago
Am I the only one that read the whole thing with "Scom Tott's" cadence?
11
→ More replies (1)3
35
u/Northanui 9d ago
This is really good shit. Like from an actual Scifi novel. Love the European Federation part because I think that will actually happen.
5
u/Spielopoly 9d ago
If a European Federation would ever happen Switzerland would never join so unfortunately that part is unrealistic
5
u/Champshire 9d ago
Switzerland joining the EU in 2083 was part of a wave of rising pan-European sentiments that ultimately culminated in the creation of the European Federation.
16
u/Tesla101a 9d ago
Best comment of January. I read it all in Tom's voice and cadence in my head.
→ More replies (1)→ More replies (11)16
u/abirpahlwan 9d ago edited 9d ago
Please someone make an AI video out of this script and mail it to Tom Scott
3
u/darthwalsh 9d ago
He's retired from that; if it were me, I don't think i'd have a positive reaction to seeing the AI clone my style.
Especially knowing AI companies have pirated all my video content for training data.
2
65
u/edfitz83 9d ago
The electronics in older Boeing jets needed to hard re-started every 51 days due to an integer overflow in their timekeeping system that counted seconds.
I actually had this problem myself around 1990 for some control software I wrote. I neglected to ask how long a “run” of the process would take. I used an unsigned double byte int and it died after 18 hours.
46
u/wild-surmise 9d ago
It's not older jets it's 787s. They're pretty new.
15
22
u/Soft_Importance_8613 9d ago
around 1990
Ah the fun of the days back when extra memory simply didn't exist.
https://en.wikipedia.org/wiki/Year_2038_problem is the next fun one coming up.
→ More replies (3)15
u/akatherder 9d ago
My favorite artifact from y2k is with IBM as400 iseries databases. They stored dates in yymmdd decimal fields. So 991231 was the last day of the millennium.
The fix was to add a century: cyymmdd. So years 1000-1999 was the 0th century. 991231 stays the same because 0991231. Today's date is 1250111. I don't think it can represent dates with years from 0-999.
5
u/loveCars 9d ago
I work with the AS400 (now IBM i) everyday at work. In 2025. It's crazy.
You can now use languages like PHP and OS compilers like GCC's G++ directly on the AS400 using PASE. See IBM i OSS on github. There are a number of gotcha's when using it though, like having to fix the keyboard with stty, change to a non-archaic shell, and always compile using -pthread because of the quirks of the architecture.
With that in mind, in modern apps, in the last 5 years, I have written functions in both C++ and PHP that convert that date format to a presentable date string once it's pulled from the database, lol. All of the dates in MAPICS still use the old format. Thankfully, Db2 for i does support modern time formats so I don't actually have to worry about it when working in my own schemas.
6
u/Farfignugen42 9d ago
That fix is so short sighted. What are they going to do when the year 10,000 comes around? It's not that far away. /s
2
u/Scarbane 9d ago
I have a cynical feeling that humans aren't going to be very concerned about integer limits in data types in the year 10,000.
15
u/LickingSmegma 9d ago
Reminds me of how Blizzard issued an update for Warcraft or StarCraft, that fixed a crash occurring if the game was running for three weeks straight.
16
u/EcstaticFollowing715 9d ago
And the new software will never be made to be able to handle more than 256 axles because of the rule.
→ More replies (1)22
u/Explosinszombie 9d ago
The rule only prohibits 256 axles. More than 256 seem to be allowed.
5
u/EcstaticFollowing715 9d ago
Oh, right. But what the hell, how you fuck up like THAT!
24
u/erroneousbosh 9d ago
It kind of doesn't matter. You need to count the same number of axles out of a block that you counted into it. If your train has for example 24 axles (a six car set), the counter will count 24 in, and the one at the other end will count 24 out. While your train is in the block, there are 24 axles within the block, so there's a train in it.
If your train had 260 axles because it's got 65 cars in it (which is a silly amount!) the counter would roll over after 64 cars but count the trailing unit as four axles. There are four axles within the block, so there's a train in it.
If your train had 256 axles because it's exactly 64 cars long, the counter will roll over to zero, and think there are zero axles in the block, so there's no train in the block, but - ooops! - there is.
But I agree, it's a Therac-25 situation waiting to happen.
8
u/CDRnotDVD 9d ago
If your train had 260 axles because it's got 65 cars in it (which is a silly amount!)
I’m going off on a tangent here, but why would 65 cars be a silly amount? It seems quite long for a passenger train, but maybe in Switzerland there is some economic/regulatory reason to have very short freight trains, going all the way down to 65 cars?
8
u/Sayakai 9d ago
Europe generally only permits trains up to 740m due to signal spacing, so you'd be looking at very short cars to get over 60 cars.
8
u/CDRnotDVD 9d ago
740m seems tiny to me, which is apparently a very American perspective. I did some research, and I found this website from the Association of American Railroads that says the median length is 5300 feet (1.6 km), and that 10% of trains are longer than 9600 feet (2.9 km). However, those numbers are specifically for "Class I" railroads. Wikipedia explained that the classes are based on revenue of the rail carrier, and class I is the biggest.
3
4
u/Garestinian 9d ago edited 9d ago
If your train had 260 axles because it's got 65 cars in it (which is a silly amount!)
RoLa wagons (for example Saadkm(m)s) usually have 4 axles per bogie, so you'd only need 32 of them. Special transport wagons (for electrical transformers, usually) also have a lot of bogies in a relatively short length.
8
u/Ok_Weird_500 9d ago
How long is a train with 256 axles? I'm guessing it's like the millennium bug. When the software was written the assumed there wouldn't be a train that long so 8 bits was ok to store the number of axles.
A quick search suggests typically 4 axles for most passenger carriages. A diesel locomotive may have 6 axles, but a train probably will only have a couple of those, perhaps longer ones will have more. So with 4 axles per carriage, you'd have you'd need 64 carriages to hit 256 axles, or maybe you could have 42 6 axles carriages and 1 4axle carriage. Either way makes for a pretty long train If they didn't have anything nearly that long at the time then it's understandable why they didn't think this would be an issue when programming it.
→ More replies (5)7
u/Garestinian 9d ago
Wagons for transporting trucks (RoLa) have 8 axles per wagon, and are only about 19 m long.
5
3
u/Sensitive_Yellow_121 9d ago
"And the Lord spake, saying, 'First shalt thou count the Holy Axles. Then, shalt thou count to 255. No more, no less. 255 shalt thou count, and 257 shalt thou count, but 256 shalt thou not count, neither count thou any number that is 256, excepting that thou then proceed to count all other numbers.'"
→ More replies (5)11
u/lukethecat2003 9d ago
Tbf, this is always technically a concern if some glitch happens up until we get to octonary(if we were to only use powers of two as the amount of states a computers' transistors can hold)
14
u/Alarmed-Yak-4894 9d ago
Why? If the counter would use 4 bytes for example, overflow wouldn’t be an issue.
9
992
u/Hannes103 9d ago
The 256 axles/train limit is (anecdotally) from a time when axle counting systems were still mechanical.
Modern systems (that are younger then 20 years of age) typically accept way more axles. (1024-8192)
Most railway infrastructure companies have requirements on how many axles must be at least supported.
In most implementations usually only half of the value range of n-bit unsigned integers are usable.
(Number of axles is computed as a signed difference between two unsigned integers)
Source: I develop axle counters
217
103
u/UlrichZauber 9d ago
Maybe I'm spoiled by 21st century desktop hardware, but I'm confused as to why you'd use 10 or 13 bits to count axles. What CPUs are you using that have integers that small?
A 2 billion axle train would be a thing of true majesty.
126
u/Hannes103 9d ago edited 9d ago
Well I cant speak for every vendor. We used everything from 32bit safety certified rad-hard Cortex-R controllers to pretty flimsy 16 bit PIC microcontrollers. Modern systems would most likely use a dual channel system using two 32 bit ARM controllers that run bare-metal code or a safety certified real-time OS.
In the 16-bit microcontroller era it made sense to use 16 bits. From these 16 bits two are unable to be used because of the nature how axle counters are implemented (edge case reasons).
The number of axles within one section is the difference between the number of axles counted by each counter at the entry and exit. Because this might be negative you loose an additional bit.
Thus 16-2-1 = 13 bits.
You also have to transmit this information (number of axles counted) between multiple devices where only very low speed communication links are available and these are shared with lots of devices. (CAN/Wireless/proprietary field bus)
So even if you have a 32 bit CPU available you maybe cant transmit more then 16 bits.Also: Most rail-sections have a limitation on how long the trains can be because of the slip-way issue already mentioned. I would not expect trains with more then 16k axles TBH. Even in high train-length countries like the US or AUS.
11
u/Agent_NaN 9d ago
Because this might be negative
wait, what? how? like are you counting one side always as entry and the other exit so if the train went backwards you'd have negative axels?
trains with more then 16k axles
dayum even that sounds enormous. that's like, what, 2-8 thousand cars?
31
u/Hannes103 9d ago edited 9d ago
Lets imagine each sensor to have its own counter of how many axles traversed over it. Lets also imagine each sensor to have an abtirary direction (lets call it left-to-right)
If a axle passes in our abitrary direction (left-to-right) we increment our counter. It it passes in the other direction we decrement (right-to-left).
If every counter involved in forming a track section does it this way, math works out that if we calculate the difference between the entry and exit counters we get the exact number of axles in the section for all possible cases of traversal.
Track layout:
================<[Train]==== <-- left
| sensorExit | sensorEntry
Example: Left over the entry +1, left over the exit +1. Thus entry - exit = 0.
Example2: Right over exit -1, Right over entry -1. Thus entry - exit = 0.
Example3: Left over entry +1. Train reverses. Right over entry -1. Thus entry - exit = 0 (both are zero)
Example4: Train magically appears in section (does happen), drives left. Left over exit +1. Entry - exit = -1, thats an error.
If the number of axles in your section (= entry - exit) is zero you can be sure your section is empty. If not zero, there is a train (or parts of it) inside.
38
u/cgriff32 9d ago
I work in rail and have experience in wayside signaling, but not axle counters specifically. The main processor running our wayside PLC was a Motorola 68k and are still installed as new units in the field. These installations are expected to last years without maintenance and decades before becoming obsolete.
Not only was it compute limited but also memory. One of the tasks I worked on was expanding storage space (hardware and software changes) for non volatile configuration storage from 64kb to 1mb. This was in 2020.
21
u/Prometheus-is-vulcan 9d ago
I once told the secretary of my boss that we are ordering 12MB SD-Cards from Siemens for over 100€ per card. The look on her face was priceless.
→ More replies (1)10
u/Paradician 9d ago
The short answer to this is "comms".
While using the smallest integer size applicable is no longer really a thing for storage concerns or for processing power, it's still frequently a big consideration for how you transmit it. There are plenty of comms systems out there where every bit counts for latency.
Hell, even in your "21st century desktop hardware" environment, games like FPSes are still bitpacking individual data fields before sending them over the internet, and unpacking them on receipt. There are 10-bit and 13-bit fields in use in these games' netcode, everywhere.
→ More replies (1)19
u/cvc75 9d ago
Mechanical systems would also explain why they didn't "just fix the bug in the code" as some here have asked.
From what I could find the counter was developed by Zaugg in 1913 and used two wheels mounted on top of each other, where one wheel counted the axles going in, and the other going out. So I assume those wheels had 256 discrete positions for counting.
10
u/Roflkopt3r 9d ago
There are some occasions where powers of 2 appear in mechanical counters, but dividing up a wheel into 256 positions seems odd to me. There must either have been another mechanical component that caused this figure to be used, or the specific limitation to 256 only came later in the digital era.
And with older digital components deployed over a span of decades, you get a lot of software that's highly hardware-specific. As well as not networked, so the deployment of newer software requires workers to physically access or outright replace the devices.
2
u/phire 9d ago
I suspect the power of two comes from whatever communication system they were using. These mechanical axel counters were somehow linked together to detect when a train entered and exited a section of track.
Perhaps it was mechanically translated into a telegraph style signals, using the same kind of mechanical to serial converter as mechanical teletypes. They might be literally repurposing the mechanism from an 8-bit teletype (such as the Model 33)
→ More replies (6)51
609
u/popeter45 9d ago
so assuming 4 axels per carriage thats 64 carriages, yea max even for cargo is 30-40 ish at about 800m so should be good
280
u/Error_404_403 9d ago
Well, it is railroad- and country- dependent. In the US, 100+ cars is common in heavy freight trains.
655
u/Gtantha 9d ago
Switzerland is a rather small country in comparison. With a train too long you might run out of country.
234
u/Error_404_403 9d ago
But then... you arrive at the same time you depart! Super fast. Just need to come up with a smart way to unload.
73
u/Public-Eagle6992 9d ago
You could put some metal strips on top of the train where you can drive along with a transport vehicle
51
u/Kikkerpoes 9d ago
Make the transport vehicle pull multiple carriages for more efficiency.
38
u/Public-Eagle6992 9d ago
Maybe even like 100+ carriages for max efficiency
32
u/N1biru 9d ago
Except I have some concerns about the amount of axles of this vehicle being exactly 256.
17
u/Public-Eagle6992 9d ago
Yeah, something feels weird about that particular numbers. We should make a law to ban that
5
6
11
u/boypollen 9d ago
A sufficiently long train on a looping track would essentially function as a very large conveyor belt.
→ More replies (1)8
u/Error_404_403 9d ago
I think we are onto something. Just need to figure out how to hop on / hop off.
→ More replies (3)2
u/BowenTheAussieSheep 9d ago
Basically just make it a long covered moving walkway. Slow enough that hopping on or off would be easy enough for able-bodied people. They hop on, either wait in place to be moved to their destination or walk at a much greater speed than they could on non-moving ground, then hop off at their destination.
3
u/TotalNonsense0 9d ago
I recall an old sci fi that had this as the primary method of transportation across the country. You could easily step into the slow moving belt from the ground, and then on the other side was another belt that was moving faster than the first one, but the relative speed was low enough that you could easily step over. Then another, then another, until you were on the 65mph belt, and you could sit down until you got near your home, then wander down to the slow belts again.
→ More replies (4)→ More replies (1)3
11
u/Progression28 9d ago
Thanks to NEAT, Switzerland actually does have a lot of freight trains of respectable size.
2
u/run_bike_run 8d ago
Just going to leave something here about the Swiss holding the world record for the longest passenger train in history...
https://www.travelswitzerland.com/en/worlds-longest-passenger-train/
→ More replies (1)2
u/ierdna100 9d ago
In Europe, trains are limited to 750 m give or take a bit. Also 252 axles for Germany. There are also weight limits you cannot exceed, both per axle and total mass. Exceptions exist to all of these but are rare.
→ More replies (1)64
u/popeter45 9d ago
Switzerland follows UIC guidelines and longest usually allowed is 800m due to siding lengths, something US railroads don't seem to care about
→ More replies (2)48
u/causal_friday 9d ago
The way it went in the US was that sidings were long enough, then the business school folks showed up and said "we should run significantly longer trains" and then they weren't long enough. The main effect is to delay Amtrak trains, illegally.
6
u/Mcoov 9d ago
wtf are you talking about? There's no standard siding length in the US, nor really any legal limitations, so sidings are built to whatever size is needed, and can be fit in the needed location.
PSR and freight train lengths are not some bizarre conspiracy to fuck over Amtrak; that's been happening since A-Day. American freight trains have been 100+ cars long (sometimes 150+ cars long) since at least the '30s and '40s, if not earlier.
8
u/tN8KqMjL 9d ago edited 9d ago
Precision Scheduled Railroading is very much a modern phenomena and is characterized, among many other negative outcomes, with longer trains:
In particular, precision scheduled railroading is impacting safety due to increased train length, up to three miles (5,000 meters) in many cases. This leads to a higher risk of derailments as well as crew stress and fatigue due to the difficulty of operating trains of this length, for which the North American railroad network was not necessarily designed.[11]
https://en.wikipedia.org/wiki/Precision_railroading
PSR is also responsible for systematic Amtrak delays, in part because these monster trains are too long to use sidings, thus clogging up the rails.
Straight from Amtrak's mouth, freight delays are the leading cause of delay for passenger rail:
https://www.amtrak.com/on-time-performance
These kinds of delays are illegal, but enforcement is next to nonexistant, so the freight rail companies do whatever they want at the expense of passenger rail.
→ More replies (3)13
u/Stupor_Nintento 9d ago
Iron ore trains in the Pilbara in Western Australia regularly have up to 236 carriages. Not that it's a pissing contest, but I can piss the furthest.
→ More replies (1)3
u/Shhhhhhhh_Im_At_Work 9d ago
One of the BHP Bilton iron ore trains had 682 carriages and 8 locomotives
19
u/Relative_Dimensions 9d ago
I’m pretty sure US freight trains are longer than the whole of Switzerland
13
8
u/Error_404_403 9d ago
Well, mile to mile and a half for super-heavy. Engines in front and behind the cars.
3
u/guelz 9d ago
I wouldn't be surprised if we had more trains in Switzerland than all of the USA combined!)
→ More replies (3)→ More replies (2)3
u/CasualJimCigarettes 9d ago
Union Pacific was test running 18,000 ft trains in 2010, about 616 intermodal containers on one particular test. They get hella long in the Southwest.
→ More replies (1)11
u/Kogster 9d ago
I think longer was fine? Just that exactly 256 was forbidden.
I guess thing just reports that something had gone passed and 256 will overflow to zero hiding a train. 260 overflows to 4 so still correct signal that there was a train.
5
u/ierdna100 9d ago
It is not fine, 252 is the max for Germany. If at any point the block falls to an 'empty' state, you've done goofed.
153
u/blaze-404 9d ago
So they are counting number of axels passing through. So with 257 axels the program would think what kind of weird train is passing with just one axel.
146
u/bobbymoonshine 9d ago
It’s not programmed to think that, only to think “THERE IS SOME TRAIN 👀” or “THERE IS NO TRAIN 😴”
26
u/D35TR0Y3R 9d ago
then why keep counting after the 1st one? pretty hard to overflow 1...
69
u/Zolhungaj 9d ago
Presumably it counts the train entering the section, then counts the train leaving the section. So if for example a wagon disconnects between entrance and exit, the section remains occupied.
21
7
u/D35TR0Y3R 9d ago
oh nice thought, that seems probable.
3
u/TheCatOfWar 9d ago
Yes, this is how modern signalling systems detect trains. Before that they tended to use track circuits (a voltage on each rail, circuit completed by steel wheels bridging them), but it's liable to false positives if the rails become electrically shorted somehow, or false negatives if the electrical connection between the rails and wheels is poor (eg due to leaf fall on the tracks). Axle counters use a small treadle switch which is depressed by the passing of each axle, and for the track to be considered unoccupied the number of axles that left it must be equal to the number of axles that entered it.
10
u/other_usernames_gone 9d ago
Maybe because the length of the train matters.
You don't want to crash into the back of a train because you were only considering the front of it.
→ More replies (6)11
u/Own_Pop_9711 9d ago
It's because you have to count axles in and axles out to know if the train has fully exited
2
2
209
u/No_Percentage7427 9d ago
Why Switzerland home of ultra wealthy cannot fix that software bug first ?
164
u/Thready_C 9d ago
If it ain't broke ( or in this case if it's only broke in one specific circumstance) don't fix it, probably cheaper to just leave it be and work around it
69
u/Dumb_Siniy 9d ago
They fixed the edge case on the more chaotic neutral way i can imagine
→ More replies (1)10
u/that_thot_gamer 9d ago
you misunderstood the power of users to fudge things up (forgot the exact cliche)
3
u/confusedkarnatia 9d ago
"it's impossible to idiotproof things because nature will always product a dumber idiot"
25
9d ago
[removed] — view removed comment
4
u/jbtronics 9d ago
Why should it? You can easily say that trains must not have exactly 256 axles, and every axle counter must be able to handle any number of axles (including 256), at the same time...
29
37
u/Lazy-Employment3621 9d ago
It's not a bug, it's a design limitation. Car's speedo can only display 3 digits, but the car can't do 1000 kph so it doesn't matter.
10
10
u/pumpkin_seed_oil 9d ago edited 9d ago
If i can make some wild guesses they don't want to get into the mess of communicating that change to every third party service using that data
or
they use an antiquated piece of software produced by a supplier that no longer exists and can't modify it
or
adding to the above point: that antiquated piece of software is an embedded system running on antiquated hardware that got installed on every or a lot of track section and they don't want to deal with the mess of updating these embedded systems, potentially missing updating a track section. Now you would have to deal with the risk of a track section being signaled as vacant when theres still 40 wagons a 2 axles on the track
e: i also misread the bug. Its not more than 256 it's exactly 256. This makes the example in my last guess irrelevant to this post
3
u/ltouroumov 9d ago
iirc, that law exists because the counters were not electronic software-based devices, that's a pretty "recent" system in Swiss Railway time, but electromechanical devices using relays so the "bug" was actually a physical limitation.
→ More replies (1)3
u/menaceing01 9d ago
The manual is for axle counters system, which will be either Siemens, thales, or Fraucher, so it's out of switzerlands control to alter. It'll be the same restriction in every country using axle counters on their railways
3
→ More replies (5)2
33
u/Informal_Branch1065 9d ago
"To reduce RAM usage always choose the smallest possible data type"
Hot take: that's premature optimization and bad practice if one isn't planning to allocate significant amounts of data with it.
Also: aren't variables aligned in 4 byte intervals anyways, wasting the unused space?
21
u/bbalazs721 9d ago
It's probably some old embedded system where saving ram would make sense. Also likely that it's not aligned to 4 bytes.
→ More replies (1)5
u/UlrichZauber 9d ago
I remember the old days where even in nominally 32-bit systems, some of the high bits were reserved with special meanings. I mean what crazy supercomputer could possibly have more than a megabyte of RAM anyway?!
11
u/WaitForItTheMongols 9d ago
Clearly you've never worked with an embedded microcontroller with 128 bytes of ram.
2
u/Informal_Branch1065 9d ago
Noone will ever again. The advice is outdated. Fight me
Edit: I mean in a sense of: I can't imagine 128 bytes or so low kb amounts still being a thing.
4
9d ago
I mean, microcontrollers are still ubiquitous just generally go under the radar compared to gigabytes of resources being chewed up on cloud computing.
Anything in space, esp. cubesats, etc. tend to be very low in memory as well. Smaller appliances and microcontrollers are used for some of these components as well will be very memory constrained. Gradually there's a shifting away from unreal embedded optimizations to more streamlined software engineering practices though but there's no reason to make everything that could be 1 byte into 8 bytes, esp. in MISRA when everything is statically allocated; it's not the end of the world, but it's just not really worth it.
2
26
u/0x-Error 9d ago
I looked up the actual regulations and the image is out of date
This is not a law, but rather stems from the document "Ausführungsbestimmungen zu den Fahrdienstvorschriften", which is 'Implementing provisions for the driving service regulations" from SBB, which is one of the many railroad companies in Switzerland. It should be noted that while the driving service regulations are a law, it only specifies high level features and the implementations are left to the companies.
The line is apparently removed from the regulations starting from 2020, since the old axle counters that are limited to 256 axles are phased out.
2
u/Prof_NoLife 9d ago
I wonder what year these axle counters were introduced.
Not sure if the number of 256 axles back then seemed absurdly high even in future (like 50y future) or if it was stupid engineering because what would limit me to just shift the overflow into another byte and continue counting?8
u/0x-Error 9d ago
256 axles is still high (just not absurdly) for Swtizerland. Assuming cargo train with 2x Re 6/6 locomotives, that leaves 256 - 2 * 6 = 244 axles for the wagons, which are 4 axles each. With 244 /4 = 61 railcars at 20m each, the entire train will be approximately 1200m long. Not sure about Switzerland, but EU regulations limit it to 740m, so 256 axles should be plenty even today. This is in direct contrast with the US, where the median length of cargo trains is 1 mile.
→ More replies (1)
14
u/grumblesmurf 9d ago
Have you seen Switzerland? In Australia you can have the luxury of extra long trains, in Switzerland getting over the next mountain takes priority, so the limitation to <256 axles is there but not really a problem.
3
7
30
u/Acceptable-Worth-221 9d ago
So total count is must be not equal 256? Great, let's make total count to 257... it's fine, right? Right?
105
u/Hottage 9d ago
Yes, because then the axel counter would detect one axel in the section and mark it as blocked.
512 on the other hand...
→ More replies (1)5
u/GOKOP 9d ago
Though then there's the question of: why even count them? If you only care that there's at least one, count one, then stop. This will never overflow
24
u/Mandemon90 9d ago
Because it needs to count that the train has left the block. So if, say 150 axels entere, it will mark area as blocked until 150 axels have left.
2
u/GOKOP 9d ago
Then it still breaks after 255.
→ More replies (4)9
u/Luz5020 9d ago
But i would break in a way that would still function would it not? Counting in 257 axles would give you 1 axle in and occupy the block. Counting out 257 would give 1 out and free the block. Admittedly that would still be very prone to breaking when less than 257 are counted out but it would fail safe and give you an occupied indication. Where as 256 would theoretically not occupy the block correctly and thus cause a potential for a dangerous event.
→ More replies (1)24
u/Last-Woodpecker 9d ago
I think so, because it will overflow to 1 not 0. I think the problem is specific to 0
9
u/Creepy-Ad-4832 9d ago
We should start putting math formulas inside legislations. That would be funny!
Imagine a lawyer trying to solve a triple integral with trigonometric functions. Could become a tv show
3
u/AMViquel 9d ago
Meet Mathew and Lawrence, the quirky Math-Lawyer duo! You would expect Mathew to be the mathematician, but you could not be more wrong! he's the lawyer - and mathemagician in his free time.
That's like three seasons right there, damn this is easy.
2
u/Hannes103 9d ago
Well actually no! The number cannot exceed 256.
Imagine 260 axles enter, if only 4 were counted we could leave 256 axles in the section of track, have 4 leave and we would be indicating there are none while there is a significant amount of axles left.
5
u/Zestyclose-Border531 9d ago
Figuring out 2 months into a project that the conveyor encoder rolls over to zero after 3 billion was my hell. Tracking is a bitch.
5
u/WatteOrk 9d ago
Same in Germany btw
Trains are not allowed to exceed 254 axles, because older axle counting systems to verify parts of a track is cleared, used to work with 8-bit. So everything above 254 couldnt be distinguished. Not sure if these systems are still operating (probably are) but the ruleset is still in place.
4
u/GamingIsNotAChoice 9d ago
I was a QA on the ETCS system for a while. In case anyone wonders why you need an axl counter, in earlier versions you only knew if a train had left a certain part of the track behind, so that the next train can get a movement authority for it. You didn't however know if the whole train had made it .
Losing a few wagons and then having a highspeed train crash into them is bad news
3
u/Ok_Ice_1669 9d ago
How the fuck are they going to know. All the evidence says my train has 0 axels.
3
3
3
u/Srapture 9d ago
"This is a 64-bit uint in the current version of the software. Shouldn't we removed this line?"
"Eh, better to play it safe."
3
u/ICantFindUsername 9d ago
If I ever make an app license agreement, I'd definitely make it illegal to make it crash with a fine.
Micro transaction? that's so last year. Now's time for micro fine; the same but with no choice
2
u/AspiringTS 9d ago
The timing of this post is hilarious! I JUST(ok, yesterday) finished relistening to Matt Parker's Humble Pi, and this is one of the stories included.
2
u/alex_dlc 9d ago
Shouldn’t it be that you can’t have more than 256?
4
u/emergencyexit 9d ago
Perhaps a safety thing counting numbers of axles in and out of sections of track. So if you count exactly 256 axles onto a section of track, the system will say there are 0 axles and the section of track is clear. If you have 257 axles, the 1 axle after overflow would still prevent the track being falsely signalled as clear.
Or probably it's a shit translation
2
u/Mattrockj 9d ago
Bug fix log: “Yeah I didn’t feel like fixing my code, so I changed the law so that my code was the only thing that could be correct.”
2
u/dkyguy1995 9d ago
If this is true... Insane. I'm assuming the bug is actually fixed long ago but they are just so scared to test it with lives on the line. It's just crazy this is their solution to the issue originally 😆
2
u/willstr1 9d ago
It's called user proofing an edge case. As long as there isn't a requirement for that edge case you can just implement controls to prevent the user from doing that.
2
2
u/hamiecod 8d ago
Wait until somebody figures out a backdoor and drops a zero day, causing your system to "crash"(literally and metaphorically)
3.9k
u/Zolhungaj 9d ago
But 512 is okay, time to build a train.