An energy stock that doesn't get obliterated during a commodity downturn, who wouldn't want that? If you are interested, Magellan Midstream Partners (NYSE: MMP) may just be the company for you. It is an energy company that operates a network of pipelines and storage terminals in the U.S. With energy commodities tumbling, it is one of the few energy companies that has seen its stock increase since the beginning of 2014. This is wildly outpacing the Alerian MLP Index, which tracks a consortium of midstream players .

MMP Chart

MMP data by YCharts

To what should you attribute this performance?  To get to the bottom of this, we need to learn a bit more about the business. 

Refined Products
Refined products include gasoline, distillates, and aviation fuel. The pipelines also transports liquefied petroleum gas or propane. This segment is the company's crown jewel, and its network of pipelines and terminals cover the majority of the Central and Southeastern U.S.

G

Source: www.magellanlp.com

In 2014, the segment constituted 75% of total revenue and 76% of operating profit. In addition, the operating margins have been fairly stable at around 30%. One of the reasons that margins are so stable is the fact that rates are mostly regulated by the FERC, so you don't see drastic swings in margins from year to year. This is the segment that provides stability to the company throughout the commodity cycle.

Through this segment, the company can access approximately 48% of U.S. refining capacity. This provides Magellan with a broad base of existing and potential customers. According to projections made by the Energy Information Administration, the demand for refined products will also be stable for the next 10 years in the primary market areas served by Magellan's pipeline system.

Crude Oil
This segment operates 1,600 miles of crude oil pipelines and terminals concentrated in the southern part of the U.S. It derives revenue from transportation tariffs from shippers and collects storage fees from terminal customers. In general, pipelines in this segment are in high competition with other companies' infrastructure; however, there is usually a steady supply of revenue, as the two major properties serviced by the pipelines, Permian and Eagle Ford, are two of the most prolifically productive properties in the

U.S. Even at today's commodity prices, production did not decline significantly in either region. Moreover, 50% of the volume shipped were subject to long-term take-or-pay agreements in 2014, meaning that the company would get paid even if the contracted volume is not used. Hence, the company is able to secure a predictable source of cash flow from this segment.

Marine Storage
This segment has five marine storage terminals along coastal waterways with 25 million barrels of storage capacity in aggregate. In addition to storage, the terminals also provide distribution, blending, inventory management, and additive injection services for refiners. The company currently has contracts that require customers to pay for reserved capacity even when it's not used. While this isn't special to Magellan, the contracts nevertheless act like a cushion for the company when demand is low.

However, competition is heating up. For example, management stated that a significant amount of capacity has already been constructed by other companies near its Wilmington, Delaware facility. So while operating margins have been steady at 35%, this segment may not be as profitable in the future when the time comes to renegotiate, as contracts are set to expire in two and half years.

A Foolish conclusion
Magellan is able to withstand the volatility in the commodity markets because its services will always be needed regardless of commodity prices. While prices will fluctuate, the profitability of the company is largely dependent on the volume demand for the underlying commodities. With refined products still serving as the major source of energy for consumers for the foreseeable future, Magellan is able to capitalize with its extensive network of refined products pipelines reaching much of the U.S.

Perhaps a better question is why the stock hasn't gone up higher. The stock certainly isn't cheap. It is currently trading at roughly 20 times P/E, in line with the average S&P 500 company. While you are unlikely to see a collapse in revenue as would be the case with many other energy companies, growth opportunity for the crude segment is muted in the near future as producers struggle to stay afloat. Ultimately, the attractiveness of the entire energy industry is dependent on commodity prices, but Magellan Midstream Partners will provide you with a peace of mind through the troughs.

Jack Yan has no position in any stocks mentioned. The Motley Fool recommends Magellan Midstream Partners. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.