DETROIT (AP) — The U.S. Environmental Protection Agency plans sweeping changes to the way it tests for diesel emissions after getting duped by clandestine software in Volkswagen cars for seven years.

Chris Grundler, head of the EPA’s office of transportation and air quality, indicated the agency would add on-road testing to its regimen. VW’s sophisticated software allowed its cars to pass tests in the lab and then spew pollution into the atmosphere while on the highway.

The revelations meant unwanted scrutiny for the EPA. Its testing procedures have been criticized for being predictable and outdated, making it relatively easy for VW to cheat. What’s more, the EPA did not initially uncover the problem; researchers at West Virginia University did, using on-road testing.

Grundler says the changes are designed to detect software and other methods automakers might use to rig a test.

The EPA and the California Air Resources Board have engineers who are “developing clever ways in which these things can be detected,” Grundler says.

He also notes that testing of diesel engines, which make up only 1 percent of the vehicles on U.S. roads, wasn’t the top priority for the EPA. The agency did have on-road testing equipment — but it was assigned to monitor automaker gas mileage estimates and heavy-duty diesel trucks, where cheating had been uncovered in the past.

Grundler, who has been with the EPA for more than three decades, says the lack of on-road testing for diesels “might change in the future.” An announcement of the changes could come on Friday.

VW has admitted to installing software on Volkswagen and Audi cars with four-cylinder diesel engines that switches on pollution controls when they are being tested. When the software, called a “defeat device,” determines that the cars are back on real roads, the controls are turned off. The EPA says about 500,000 U.S. cars including the Jetta, Golf, Beetle, Passat and Audi A3 have the cheating software, and VW says a total of 11 million cars have it worldwide.

VW was able to fool the EPA because the agency only tested the cars on treadmill-like devices called dynamometers and didn’t use portable test equipment on real roads. The software in the cars’ engine-control computers checked the speed, steering wheel position, air pressure and other factors to determine when dynamometer tests were under way. It then turned on pollution controls that reduced the output of nitrogen oxide, an ingredient in harmful ozone, the EPA has said.

VW started the scheme with the 2009 model year, and may not have been caught without testing performed at West Virginia University on behalf of the International Council on Clean Transportation, a nonprofit group that advises governments on regulations. EPA and California regulators confronted VW with those findings to VW in May 2014. The automaker eventually did a recall late last year, without much improvement, the EPA says.

Only when the EPA and CARB refused to approve VW’s 2016 diesel models for sale did the company admit what it had done.

The EPA announced the violations a week ago and said VW could face billions in fines. The agency said the cars are safe to drive but VW will have to pay to recall and fix them. The agency also is going to test diesels from other manufacturers to make sure they don’t have similar devices.

Sen. Bill Nelson of Florida is frustrated that regulatory agencies such as the EPA are failing to protect the public. “Seven years is way too long a time that the EPA has been asleep at the switch,” he says.

He says the VW case has similarities to those involving General Motors ‘ defective ignition switches and Takata Corp.’s exploding air bag inflators, where it also took years before those problems were disclosed to consumers.

“When there is this kind of deception, we’ve got to get these agencies to be able to cut through it and catch it,” Nelson says.

It’s not the first time the EPA has had to change testing to make sure automakers are playing by the rules. Earlier this year the agency updated gas mileage tests after some automakers were caught with inflated window sticker estimates.

Grundler disputes the notion that EPA would never have caught VW without the outside help. European regulators were looking into VW’s on-road diesel emissions as far back as 2012, and since diesels make up half the cars there, the EPA decided to let Europe take the lead, he says.

“I don’t think it’s fair to say that this would never have been uncovered,” he says. “Do I wish we had uncovered it sooner? Absolutely.”

____

Daly reported from Washington, D.C.