Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

How Does Reliable Delphi Keep This Wonderland Running 365 Days A Year?

How Does Reliable Delphi Keep This Wonderland Running 365 Days A Year

When you are open every single day of the year, rain or shine, your timings are measured in milliseconds, and your smallest distances are 0.7mm (0.03 inch) apart you begin to really appreciate how absolutely rock-solid Delphi is. These are the insanely complex engineering problems Daniel Wolf faces every day he walks into his workplace where he is surrounded by the roar of speeding racing car engines, the hubbub of excited spectators, and the bustle of a busy airport. Welcome to The Miniatur Wunderland in Hamburg where pretty much everything you can see, smell, hear, and (not) touch – from ticketing, to racecars, to video feeds, to trains and planes – is driven by Delphi program code of one kind or another and some very clever engineering.

The facts of being fast, and tiny, and why being small actually makes it all harder

As Daniel says: “Let’s start with the facts: We have a 24-meter Formula 1 track. We hold Formula 1 and Formula E races on it. Both racing series include 20 vehicles each, of which a maximum of 14 are on the track at the same time per race. The reduced starting field is due to our city layout: We stayed as close as we could to the original layout of the city of Monaco. We had to “compress” some parts of the city a little so that we could integrate the entire city into our building. This is why our start-finish straight has space for a maximum of 14 cars“.

The Miniatur Wunderland sky cam view

On the start-finish straight of the real-life Monaco racetrack, the original (full size) cars reach speeds of almost 300 km/h (about 185 mph). Broken down to the scale of Miniatur Wunderland – everything is painstakingly accurate and to scale – this corresponds to about one meter per second (about 39 inches per second). In order to enable course corrections and avoid collisions, the computing threads must calculate what will happen for the next 10 seconds in advance. In the event of conflicts, some of these calculations may have to be discarded if a car either determines on its own that a plan to overtake is not working or if the car receives instructions from race control to let the following vehicle pass (“blue flag”). Yes, you read that correctly, the cars are intelligent and make their own decisions!

The Miniatur Wunderland is controlled by Delphi and everything happens live and real time

Of central importance is the car system-software written in Delphi. All threads come together here. Basically, all races are calculated live and are therefore no two races are the same. Each car follows its own racing strategy, checking its options for overtaking or blocking pursuers. Each car is represented by its own autonomous calculation thread. To ensure that the races as a whole run smoothly and are aesthetically pleasing to the 1 million plus guests who visit Miniatur Wunderland every year. There is a ‘master’ thread that resolves conflicts in good time and, for example, ensures that a faster car can overtake when the weaker competitor car in front of it briefly takes its foot off the gas. The experience is as close as possible to a real race.

The drivers are all subject to various parameters that control the race. The basic configuration corresponds to the current world ranking of the F1 teams. Yes, miniature Verstappen wins too often at Miniatur Wunderland too! Don’t worry though, the Delphi code generates random values that ensure that otherwise good drivers can also have a bad day or, for example, a slow start to the race.

Not just a full miniature scale model of the Monaco racetrack, but a working airport and other cities too!

As Daniel says: “This is the main window for our F1 vehicle control. It is the same software that controls our airport, for example – albeit in a completely different basic configuration. In the background is the complete track layout with the vehicles. The active window shows the most important individual parameters of the vehicles. In the example, those of Max Verstappen’s Red Bull. The inactive window behind it on the left houses the race control and is used to … well … control the races. Normally, however, this runs all day long without manual intervention and switches automatically between the Formula 1 and Formula E racing series. You can see a lot of vehicles parked at the bottom right. This is the section of the track with the tunnel under the conference centre. We have added five lanes to the (real existing tunnel) that are hidden from the view of the guest. We can park the vehicles of the racing series that are not currently in use there“.

One hilarious thing you can spot in the Wunderland is a kind of “easter egg”. At the top of the list of vehicles there are two free spaces, #21 and #22, one of which is marked with “Dixie Klo”. Brits might know these better as a “Portaloo” and Americans as a “Portapotty“. These are mobile toilets, like those you find on construction sites or music festivals. Says Daniel, “this has been one of our favorite test objects for four years now and at top speeds of the equivalent of 300 km/h it has always brought a smile to our faces, even in the darkest and most complicated times of the development of this system“. A mobile toilet which careers around Monaco at 300km/h – ONE HUNDRED AND EIGHTY-SEVEN MILES AN HOUR. 😂

How does the unique way the cars are powered work?

Due to their size of around 5 cm (2 inches), the vehicles have neither a gearbox nor a motor, or even a battery. They are driven by a magnetic field generated by the road surface, a “Hallbach array”. This has an internal resolution of 0.7mm (0.03 inch) and thus defines the coordinate system in which the cars can move. There is also a second layer under the roadway, which is equipped with sensors. These sensors detect the magnetic fields generated by the cars and allows the software to locate them. This enables the master controller software to compare the planned and actual positions. If you were to hold one of the vehicles on the track with your finger, the tracking system would notice this and initially activate the display of the yellow flags for this sector. All other vehicles would then be asked to check their routes and recalculate them if necessary and then find their way around this obstacle.

There are other incredible Delphi projects at Miniatur Wunderland too!

Not content with the totally mind-blowing feat of software engineering of semi-autonomous racing cars in perfect miniature Daniel and his colleagues have a whole raft of other things going on. One of them is their TV software. They wanted to broadcast the races – just as they are in the real world – on TV screens located along the miniature track for the ‘spectators’ in the grandstands. At the Miniatur Wunderland scale these TVs are actually displays with a diagonal of 2 inches / 5cm. They also placed 29 Raspberry Pi cameras on the track which can follow a race seamlessly. The Delphi software generates a master signal from these 29 video streams, which is played out to the displays.

The master Delphi thread ‘knows’ where the action is and activates the corresponding camera automatically. The quality of the images is so good and showed so many details and unusual perspectives that they subsequently decided to hang full size 32-inch displays on the ceilings to show Wunderland guests the race from this perspective. This presented another software engineering problem, as Daniel says, “so I had to find a solution for our TV signal that would allow us to operate both a 2 inch display and a 32 inch display“.

Another project that helped a lot during development is for error analysis. The task here was to be able to connect to the Formula 1 system via laptop in order to be able to call up and evaluate the operating parameters. Here again Daniel was able to exploit the strengths of Delphi, as the performance display of a lot of data is comparatively easy. On the data analysis screen there are two short curves, the blue curve is created by the magnetic field that drives the cars, i.e. by the control system, and the red magnetic field is generated by the car itself. A large upward deflection on these curves, followed by a smaller downward deflection, is the distinctive signature of one of the vehicles. Using the information about when and which sensor detected this signature, Daniel and his team can locate the cars precisely in a tiny fraction of a second with millimeter accuracy.

Miniatur Wunderland is a superb example of what can be done with Delphi and a lot of talent!

What a wonderful project (or should I say wunderful project?) Such great engineering both in the physical and software world and one which brings such great pleasure to so many millions of people. Thanks for letting us know about it Daniel!


Where can I download a copy of RAD Studio with Delphi?

If you want to try out Delphi for yourself then there are a few options. If you qualify – for students, hobbyists, and startups – you can use the free Delphi CE (community edition). If you do not qualify or you want to try the very latest version of RAD Studio with Delphi or C+++ Builder then you can click here to download a free trial of Delphi, or C++Builder, or a RAD Studio trial (which has both Delphi and C++).

Additional images courtesy of Marco Cantú

Exit mobile version