Baker Hughes Improves Precision of Oil and Gas Drilling Equipment
- Expensive field tests minimized
- Future development effort halved
- Firmware quality improved
“We add value for our customers with our design expertise and knowledge, not through coding. Simulink and Embedded Coder enabled us to accelerate development by shifting our resources and our focus from code implementation to system design and system-level testing.”Ingolf Wassermann, Baker Hughes
As accessible oil and gas deposits become scarcer, oil companies commonly have to drill three-dimensional wells extending over several kilometers to reach new reservoirs. Precise steering control is required during drilling to maximize reservoir contact and to avoid hitting existing wells.
Baker Hughes is developing advanced directional drilling services which incorporate algorithms that help oil and gas operators place wellbores precisely in their reservoirs. Running on an embedded processor amid the intense vibrations in the downhole environment, these algorithms accurately measure the inclination and azimuth of the borehole as it is drilled. Baker Hughes engineers used Model-Based Design to develop and improve the algorithms and to reduce reliance on field tests.
“In our industry, field tests are both difficult and expensive,” says Dr. Oliver Hoehn, signal processing and controls functional manager at Baker Hughes. “Model-Based Design enabled us to create a simulated downhole environment and run hardware-in-the-loop tests to validate new ideas in development and verify our firmware before we deploy it to the field.”
The inclination and azimuth of the drilling system are computed using signals from magnetometers and accelerometers. Downhole vibrations and shocks distort these signals, resulting in uncertainty of the wellbore position that increases with the depth of the well. Baker Hughes had previously hand-coded measurement algorithms in C to process the sensor signals. For certain complex drilling scenarios, however, the company believed that system performance could be significantly improved.
Because the engineering team lacked a model of the drilling system, they had no way to replicate scenarios encountered in the field, and no way to test the algorithm within the complete system. As a result, it was difficult to compare algorithm implementations. Further, the company found that hand-coding algorithms in C was error-prone and frequently produced an implementation that did not match the original specification.
Baker Hughes used Model-Based Design with MATLAB® and Simulink® to establish a new development process. They began by testing their existing algorithms in desktop simulations, and then used modeling and automatic code generation to improve the algorithms.
Working in Simulink, Baker Hughes engineers created an environment model that captured the effects of downhole shocks and vibrations, as well as sensor models that included filters, analog-to-digital converters, and other electrical and mechanical components.
The team then used S-functions to create Simulink blocks of their existing C algorithms. They combined these blocks with the environment and sensor models to run system-level simulations.
Together with other experts at Baker Hughes, the team created test cases to replicate drilling scenarios, and ran simulations in Simulink to test the existing algorithms in these scenarios.
The team used the result of the simulations to debug and improve their existing C algorithms and to guide improvements to the hardware design, including the analog filters.
To conduct hardware-in-the-loop (HIL) tests, the team generated code from the environment and sensor models using Embedded Coder® and deployed it to a real-time processor. This setup enabled the team to run tests of their entire system—including algorithms, sensors, and environment—in the lab for the first time.
Analysis of simulation and HIL results revealed opportunities for algorithm improvements, which the team implemented by redesigning and improving the original C algorithm in Simulink. During this phase, the team developed Simulink unit tests for each function in the new design. These tests were run continually throughout development.
They used Simulink Check™ and Simulink Coverage™ to check compliance with MathWorks Automotive Advisory Board (MAAB) modeling standards and measure model coverage of their test cases.
Using Embedded Coder they generated the algorithmic part of the system code from the Simulink algorithm model for their production floating-point processor. This accounts for approximately half of the code for the complete system.
The group shared their system model with other engineering teams within Baker Hughes, enabling those teams to run system-level tests on their own projects.
Expensive field tests minimized. “A single field test can cost more than $100,000, and even at that cost does not replicate the complex scenarios our customers encounter,” says Hoehn. “Simulations and HIL tests with Model-Based Design enabled us to simulate realistic conditions and conduct fewer field tests.”
Future development effort halved. “The model libraries and frameworks we developed with Simulink and Embedded Coder for HIL testing are already used by other Baker Hughes teams,” Hoehn says. “On future projects we expect that this reuse will reduce the resources required for the development of algorithmic systems by 50%.”
Firmware quality improved. “We have seen a significant improvement in the quality of the firmware we developed with Model-Based Design, leading to increased reliability and reusability,” says Hoehn. Baker Hughes system architect Ingolf Wassermann adds, “We now have a consistent HIL test setup that we can use to measure our progress in quality improvement, and that has improved our entire development process.”