Flint Hills Resources this month wrapped up more than $400 million in construction projects at its Rosemount oil refinery, cutting its electricity costs and pollution emissions, while boosting efficiency and creating a new product to sell.

The refinery announced several big projects in the middle of the decade, including an on-site power plant, a fertilizer-making facility and new heaters for its coking units, which break down thick Canadian crude oil into lighter products like gasoline.

"To compete, we need to improve our energy economics," said Jake Reint, a Flint Hills spokesman. Indeed, demand for gasoline and diesel is static now and it faces an uncertain future, particularly if electric vehicles take off.

"We believe without question the transportation sector is poised for disruption," Reint said. "The refineries that are in a better position will be able to meet continuing demand. Marginal refineries will shut down."

The various Flint Hills projects appear to have created the largest single construction job site in Minnesota in recent years, requiring an average of 1,000 trades workers on most days, and is the largest in cost since U.S. Bank Stadium. The refinery itself employs about 1,000.

Flint Hills, an arm of Wichita, Kan.-based Koch Industries, owns refineries in Rosemount and Corpus Christi, Texas. With 345,000 barrels per day of production capacity, the Rosemount refinery is one of the Midwest's biggest, and federal data indicate that it is the 11th-largest refinery in the United States.

It supplies more than 50% of the motor fuel sold in Minnesota and around 40% sold in Wisconsin.

The Rosemount refinery, called Pine Bend, also supplies most of the jet fuel used at Minneapolis-St. Paul International Airport via a direct pipeline.

More than 80% of Pine Bend's oil feedstock comes from Alberta via Enbridge's pipeline system.

The refinery's reliance on Alberta oil has given it a cost advantage in recent years, as the discount of Western Canada Select to West Texas Intermediate — two benchmark crude prices — has often been wide. And that price gap may go on for some time.

"Their margins are good," Sandy Fielden, a Morningstar analyst, said of the Rosemount refinery. "They want to keep it running at high rates," and capital projects like the ones Flint Hills recently completed help.

Crude from Canada's oil sands, also called tar sands, is particularly thick, with a much higher liquid-asphalt content than a lighter crude from places like North Dakota. More processing is needed to extract its full value.

Hence, coking units are critical in breaking down the tar into lighter products such as motor fuels (though some asphalt is marketed as such and Flint Hills is a major manufacturer of the stuff).

Flint Hills had originally planned to entirely replace its two cokers, which are more than 50 years old.

Instead, it only replaced the cokers' heaters. That brought the overall cost of the project down from around $750 million to the $400 million range.

"We realized we would get the same results just doing the heaters," said Geoff Glasrud, Pine Bend's vice president and manufacturing manager.

The new heaters will emit 80% less nitrogen oxide, a significant pollutant, than the old ones. "It's the best of both worlds: better yields and less emissions."

The new heaters, made in Thailand, are four stories high and were shipped in pieces up the Mississippi River on barges after being offloaded in the New Orleans area. The heaters, which were fired up earlier this month, alone were a $100 million-plus investment.

Flint Hills sunk another $100 million-plus into a combined heat and power plant, which produces both electricity and steam for heat.

The combined-cycle electricity generator, which went online in May, has a 50-megawatt capacity and appears to be the state's largest in-house industrial power plant.

Reint said rising electricity costs prompted the project, and Flint Hills is now producing 40% of its power.

The refinery is one of Xcel Energy's largest customers, and Xcel noted in its third-quarter earnings that commercial and industrial sales in Minnesota were negatively affected by "newly installed cogeneration."

Flint Hills' third major project, a fertilizer plant, also cost more than $100 million and opened in June.

It makes ammonium thiosulfate (ATS), a niche fertilizer containing sulfur along with nitrogen, a more standard crop nutrient. The plant will be one of the largest ATS production facilities in the country.

Canadian crude has a high sulfur content. Even more of the element must be extracted these days because U.S. emissions standards now call for ultralow sulfur fuel. Flint Hills had been selling its waste sulfur directly to fertilizer makers and other users of the material. But making its own fertilizer is a higher-value proposition.

"Sulfate is a very important nutrient for crops, just like nitrogen," said Fabian Fernandez, an associate professor of nutrition management at the U's Extension Service.

In an odd twist, the demand for sulfate fertilizer has grown in recent years as pollution control efforts have reduced acid rain. "This was a free deposition of sulfur," Fernandez said.

Fielden, the Morningstar analyst, said value-added projects like Flint Hills fertilizer plant are becoming more common and necessary in the refinery industry.

Often, they will involve integration with an adjacent chemical plant.

Whether its fertilizer or chemicals, the driver is the same: Capitalizing on markets for other oil-based products with an uncertain long-term future for motor fuels.

Said Fielden: "If you are running a refinery, you have to ask, "How long is this gasoline thing going to last?"