RWE Develops and Deploys an Automated System for Natural Gas and Power Trading and Risk Management

“MathWorks consultants were well-qualified, professional, and fast. They understood not only the technical issues but also the business goals, which is essential when working on a core business system. We got more than we expected from MathWorks Consulting.”


Automate business processes for quoting gas contracts and hedging against price fluctuations


Engage MathWorks Consulting to develop and deploy to a production environment an automated pricing and risk management system that fits within the company’s existing IT infrastructure


  • Models created in minutes, not weeks
  • 100% accurate results delivered
  • Technical expertise applied to core business goals
RWE headquarters in Essen, Germany.

As one of Europe’s five largest electricity and gas companies and the leading power producer in Germany, RWE supplies electricity and gas to over 24 million customers. When writing new gas contracts, RWE relies on complex models that factor in market prices, estimated demand, exchange rates, and projected daily temperatures. To manage risk, the company purchases futures and options, which serve as a hedge against market volatility.

RWE worked with MathWorks Consulting to build and deploy the computational kernel of EwITA (Entwicklung IT-Zielarchitektur Strom und Gas), an automated system for accounting, portfolio, and risk management. EwITA is a module within the SAP framework used at RWE. Based on MATLAB®, it enables analysts to quickly update models in response to changing market conditions, and provides consistent, reliable results enterprisewide.

“MATLAB was the ideal solution for this core business application,” says Dr. Norbert Tönder, IT project manager at RWE IT GmbH. “First, MATLAB provides precise results for very complex calculations. Second, the MATLAB language enables users to easily create sophisticated models and understand models written by others. Third, using MATLAB Compiler SDK we can integrate EwITA into our existing SAP framework. Last, with MATLAB we can extend the system to meet our future needs.”


Groups within RWE used disparate tools for trading and risk management, including purpose-built software and spreadsheets. Because the tools sometimes yielded different results, analysts had to perform tedious manual checks to ensure accuracy. Further, the tools could not handle nonlinear models, and model updates involved weeks of programming effort.

RWE wanted a single, consistent system that was integrated with its SAP enterprise software and accessible across the company. They needed to enable financial analysts to update the models themselves, without having to wait for IT programming assistance.

To develop and deploy the system, RWE sought to collaborate with technical specialists. “This is a business-critical system for RWE, and we wanted experts to help us develop and implement it quickly,” Tönder explains. “Just as important, we wanted to ensure a smooth knowledge transfer so that we could be self-sufficient once the job was complete.”


RWE engaged consultants from MathWorks to build and deploy the calculation tool for computing of complex formulas and connect it to RWE’s enterprise SAP system. The consultants used MATLAB and MATLAB Compiler SDK™ to build and deploy EwITA within the company’s IT infrastructure, where it would be accessible to RWE analysts throughout the company.

After working closely with RWE to define the interface between SAP and MATLAB, the MathWorks consultants developed MATLAB algorithms to implement RWE’s existing models.

Using representative models, input data, and pricing systems, the consultants compared the algorithm’s results with results obtained from RWE’s existing systems. They then implemented additional risk management capabilities in MATLAB, including support for nonlinear models.

“In the past, the inability to use nonlinear models limited the kinds of products our sales department could offer,” says Tönder. “With MATLAB, we can apply nonlinear option pricing and perform much more complex computations, which lowers our risk exposure and reduces the amount we have to spend on options.”

The consulting team used MATLAB to build FormelEditor, an interface that enables RWE analysts to create and update models without manual coding. A second interface, FormelTest, lets them test models offline using historical prices.

A deploy button automatically converts the tested model into a Java® component using MATLAB Compiler SDK. The component can then be deployed to the catalog of available models, and is ready to be used by the SAP system.

RWE analysts use the EwITA system, which is in enterprise production, to manage risk for the company’s entire portfolio. MathWorks consultants transferred application knowledge to RWE personnel, enabling RWE to maintain EwITA without ongoing assistance.


  • Models created in minutes, not weeks. “Creating a new model with our previous systems typically required a week or more of programming and testing,” says Tönder. “With the MATLAB based model editor, our analysts can do it themselves in minutes. By automating this process, we can respond to changing market conditions almost immediately, and our costs for creating and updating models are 10% to 20% of what they were.”

  • 100% accurate results delivered. “In the past we had different implementations that produced different results,” notes Tönder. “By integrating the Java package built using MATLAB Compiler SDK with SAP, we now have a stable production system that delivers the same accurate results throughout RWE.”

  • Technical expertise applied to core business goals. “Because this system was so vital to RWE’s business, developing it required specialists who were not only technical experts but also business savvy,” Tönder says. “MathWorks consultants interacted with us at a strategic level, documenting our business objectives and using their technical expertise to translate our requirements into system functionality.”