Volkswagen isn’t hiding from its emissions cheating scandal, which the company now says affects some 11 million diesel cars worldwide.

“Let’s be clear about this: Our company was dishonest with the EPA and the California Air Resources Board and with all of you,” Volkswagen U.S. chief Michael Horn said Monday night. “In my German words, we have totally screwed up.”

Thanks for finally coming clean, VW. But how exactly did the technology behind Volkswagen’s so-called defeat device actually work?

Regulators allege that Volkswagen installed software into its cars that allowed the autos to circumvent EPA tests. But that still doesn’t explain how VW vehicles were able to determine when they were being subjected to an emissions test in the first place.

To understand more about how Volkswagen cheated, we have to know a bit about the EPA’s testing process. When carmakers test their vehicles against EPA standards, they place a car on rollers and then perform a series of specific maneuvers prescribed by federal regulations. Among the most common tests for passenger cars is the Urban Dynamometer Driving Schedule (UDDS), which simulates 7.5 miles of urban driving. Here’s what that looks like, expressed as a speed profile.

In the first 505 seconds of the test, the driver pushes the car to highway-level speeds. The second phase of the test looks more like what you’d see in stop-and-go city traffic. In all these tests, the driver has to stay within two miles per hour of the required speed at any given moment. Along the way, the testers collect emissions data.

There's a dizzying array of other tests that cars sometimes face. There’s a test to simulate aggressive driving, which tops out at some 80 miles an hour, and a test that simulates urban driving on a hot summer day, with the air conditioning on full blast. There’s a cold-start test, where you begin the test with everything in the car turned off. There’s a hot-start test. There’s something called a New York City cycle, which simulates driving in a busy downtown area where you never get above 30 mph. And then there’s the Federal Test Procedure, a 30-minute test that mixes various elements of the other tests.

Simply prepping the test vehicle can require following a complicated flow chart of steps.

In the end, the detailed requirements for each test gave Volkswagen the advance knowledge it needed to teach its cars when to behave more cleanly. By measuring how long the engine was running, the vehicle’s speeds, and even seemingly esoteric factors, such as the position of the steering wheel and barometric pressure, Volkswagen vehicles could understand they were being tested and so adjusted their engine performance to pass the tests, according to the EPA.

"These inputs precisely track the parameters of the federal test procedure for emission testing," the agency said in a letter Friday to VW execs.

At all other times, the EPA said — like when consumers were actually driving the cars — Volkswagen would use a different “road calibration” that increased emissions of nitrogen oxide, a component in urban smog, up to 40 times federal standards.

Using a special engine setting for vehicle tests isn’t all that unusual, according to Consumer Reports. Most new vehicles do something similar because otherwise vehicles might interpret some of the testing procedures, like traction issues from being on rollers, as dangerous. But the problem here is that the EPA says the carmaker used its testing mode in an inappropriate attempt to beat the system.

Volkswagen admitted to installing software designed to cheat emissions tests in about 11 million cars worldwide. Here's what you need to know about the scandal. (Jorge Ribas/The Washington Post)

Designing a piece of software aimed at tricking the EPA isn’t really the hard part, according to Arvind Thiruvengadam, a professor at West Virginia’s Center for Alternative Fuels, Engines and Emissions who helped run independent tests on VW’s diesel cars.

“Knowing when to switch to the EPA-favorable cycle is the trick,” he told Car and Driver.

So if VW is capable of setting its cars to run cleanly, then why doesn't it do so all the time? The answer is that there's a tradeoff between cleanliness and performance, as described by this diesel engine engineer:

If the car ran on the “clean” map all the time it would be apparent that the driving experience and customer value (fuel economy and power) would be significantly impacted.