Oil has been a roller coaster lately. Just a year ago, Western Texas Intermediate stood at $95/bbl. The commodity then crashed 50% to below $45/bbl in January before rebounding slightly in the second quarter. Unsurprisingly, it was a tumultuous time for energy companies as well. S&P's Oil & Gas Exploration & Production Index fell almost 40% over the past year.

XOP data by YCharts

Yet not all energy companies suffered the same fate. A particular sub-sector in the energy industry fared much better than the average producers: the midstream sector. The S&P index that tracks a consortium of midstream players, often structured as Master Limited Partnerships, fell by only 12% over the past year. What is so special about midstream companies and why are they able to withstand the volatility of the commodity? Let's take a look at the basics of a midstream company and examine three promising investment candidates.

How Midstream Companies Are Different
When we think of oil and gas companies, we get the impression that they drill holes and sell the fossil fuel. We call them "upstream" companies. It should be no surprise that their stock value is highly correlated with commodity prices. Instead of selling the commodity, though, midstream companies deal with the infrastructure needed to facilitate sale. They operate pipelines and other logistical assets that are critical to the industry. If managed properly, a midstream company's profitability is stable and much less correlated to the commodity than its upstream peers.

This is because a midstream company's services are often fee-based and it applies a stable margin on products regardless of commodity prices. As prices decline, the company's costs decrease along with revenue. Hence a midstream company is able to maintain stable margins in all but the most pessimistic scenarios.

Due to relatively predictable cash flow and capital expenditure needs, many can afford to pay large dividends. They are often structured as Master Limited Partnerships as well for tax efficiency purposes. Combining the above factors, midstream companies are great for income investors looking to have exposure to the energy industry without having to deal with the volatility in distributions. Let's take a look at three examples:

Source: www.plainsallamerican.com

1. Plains All American Pipeline (NYSE:PAA)

Plains All American Pipeline has been in operation since 1998 and has pipelines stretching from Alberta, Canada to Corpus Christi in the U.S. This extensive network services both "supply push" and "demand pull" activities, hence the company's pipelines will always be in demand as long as there is a need for oil. It also has a fantastic dividend history, it has never missed a single payment in the past 10 years. Over the same period of time, dividends increased from $0.325 per quarter to $0.685 per quarter today and share price more than doubled to $45. What's even more amazing is that the company never suffered a loss in 10 years and grew its income from $218 million in 2005 to $1384 million in 2014.

2. Magellan Midstream Partners (NYSE: MMP)

Much like Plains All American Pipeline, this company also has a great dividend history. While Magellan is mostly known for its refined products pipelines that deliver refined petroleum products like gasoline and diesel to end markets, the company is also investing heavily in crude oil pipelines as of late. Many of its refined product pipelines are in non-competitive regions and the company charges fixed rates regulated by the FERC. The company had an average 20% net income margin over the past five years. Dividends increased from $0.2488 per quarter 10 years ago to $0.7175 per quarter today. Over the same period of time, shares appreciated by 380%, from $16 to $77 today.

3. NuStar Energy L.P (NYSE: NS)

While smaller than the previous two firms, NuStar Energy has the same business model that can prosper at all points in the commodity cycle. The company has pipelines in North Dakota all the way to Texas along with refined product terminals on both coasts. Its operations have generated consistent cash flow, with no missed payments since the first dividend in 2007. The company also recently created a $125 million account receivable facility. The facility will allow the company to sell its receivables which means that cash will be received earlier. This will improve liquidity which is extremely important for dividend payouts.. The dividend has climbed steadily from $0.915 per quarter in 2007 to $1.095 per quarter today. Despite its stable business, the current market pessimism is giving you the opportunity to invest at a yield of 7%.

Midstream companies are very stable businesses that can maintain distributions despite fluctuations in commodity prices. Unless a company is over-leveraged and artificially creates volatility in its cash flow, a midstream company is usually a great choice for investors looking for stable dividends over time.