Case study · Energy
Pipework infrastructure at a natural gas facility

Validation System for Natural Gas Trading Optimization

Country
Brazil
Context
An international energy company, in its natural gas and biomethane trading operations in Brazil.
Client
The client did not authorize disclosing its name.

Introduction

The client invested in an R&D project, carried out by an academic research team, to balance the supply and demand of natural gas and biomethane and make the best use of its purchase, sale, and transportation contracts, especially in the short term. The main product was an optimization model meant to prescribe contract allocations considering transportation and storage capacities, take-or-pay and deliver-or-pay clauses and other operating rules, aiming at an industrial-grade solution (TRL 8 or 9).

The modeling approach was sound, but the code still reflected its origin as a research prototype. Before relying on its prescriptions in daily operations, the client needed an independent assessment of the implementation and a way to ensure that every prescription was consistent with the input data, the gas network, and the contracts.

Methodology

Mip Wise was engaged to review the optimizer developed by the research team, propose improvements, and build a system to make its use safe and auditable. The project followed these phases:

  • Technical assessment: Review of the codebase and documentation, covering the consistency between the mathematical formulation and the code, software architecture, coding practices, and data integrity. Findings were classified by risk level and included gaps between documented business rules and their implementation, missing data validations, and tight coupling between data handling and the optimization logic.
  • Improvement roadmap: Recommendations to bring the optimizer to production standards, including traceability between business rules and model equations, an optimization core decoupled from file reading and writing, modular code, structured error handling and logging, and coding standards.
  • Validator development: Mip Wise designed and built the Validator, a web application with its own interface that wraps the optimizer. It checks the input data before each run (types, referential integrity, and basic business rules) and audits the prescriptions afterwards, covering mass balance across the network, storage limits, contract penalties, price-tier usage, and the link between the physical gas route and the cost assigned to each customer.
  • Decision dashboards: The interface translates results into financial and operational KPIs (net margin, average molecule cost, penalty impact and demand served), with cost and revenue waterfall charts, nomination route views and drill-down to the data behind each indicator.
  • Testing and calibration: With limited historical data, a battery of stress tests (price shocks, extreme storage costs, removal of contract penalties and their combinations) checked that the optimizer and the Validator responded in a predictable and consistent way. The solution was delivered as a versioned Python package and a web app packaged with Docker.

Results

The Validator is ready for use, and its deployment in the client’s operation depends on the client’s database implementation and system integration.

  • Safer prescriptions: The validation layer prevents inconsistent data from reaching the optimizer and flags prescriptions that violate physical or contractual rules before they reach the planners.
  • Issues detected early: Tests with the Validator revealed inconsistencies in data and in the optimizer logic that could otherwise occur in daily operations, and led to new metrics and adjustments to business rules.
  • Path to production: The assessment and the Validator gave the client a clear roadmap to evolve the research prototype into an industrial solution, including data integration through APIs and a multi-day optimization horizon.

See more case studies in Energy

Facing a similar challenge?

Every operation has its own constraints. Tell us what you have in mind and we will talk about what could be done in your case, with no obligation.