Researchers have uncovered the code VW used to cheat on emissions standards testing. (Source: iStock/University of California - San Diego)Researchers have uncovered the code VW used to cheat on emissions standards testing. (Source: iStock/University of California - San Diego)Remember a couple years back, when the story broke about Volkswagen having fooled U.S. and European emissions tests over a period of at least six years? An international team of researchers has figured out just how they went about it.

During a year-long investigation, the researchers found an ingenious code that would instruct a vehicle’s onboard computer to activate emission-curbing systems when an emissions test was being performed. Once the computer determined that the test was complete, those systems were deactivated – and the car went back to emitting up to 40 times the amount of nitrogen oxide allowed under Environmental Protection Agency regulations.

Copies of the code – euphemistically labeled as the “acoustic condition” – were found on VW’s own maintenance website, as well as forums run by car enthusiasts. Affected models included the Jetta, Golf and Passat, as well as Audi’s A and Q series.

In order to perform an emissions standards test, a car is placed onto a chassis equipped with a dynamometer that measures the power output of the engine. The vehicle follows a precisely-defined speed profile that mimics real-world urban driving with frequent stops. VW took advantage of the fact that the conditions of the test are standardized and public in order to teach the onboard computer how to recognize factors like distance, speed and wheel position and determine that a test was happening. As many as 10 different profiles for potential tests were included within the code.

"The Volkswagen defeat device is arguably the most complex in automotive history," said Kirill Levchenko, a computer scientist at the University of California San Diego who led the research.

Why would VW go to such elaborate measures to circumvent emissions testing? It’s the diesel engines, which boast impressive fuel-efficiency but also produce more particulates and nitrogen oxides than gasoline engines. Curbing emissions for these engines can mean sacrificing performance or efficiency.

According to a recent article in USA Today, there were about 11,000 unsold 2015 model year diesels at VW dealerships when the U.S. government ordered the company to halt sales. After paying billions in fines, and reprogramming those unsold cars, VW started selling the remaining diesels again in April – and demand is strong. But once they’re gone, they’re gone: Volkswagen executives have said they will stop selling vehicles with diesel engines in the U.S. and focus on becoming a leader in electric cars.