Application of genetic algorithm to a gas network for compressor speed optimization

Published: 13 January 2022| Version 2 | DOI: 10.17632/6zth8gytm4.2
Matthew Efe Takerhi


This contains codes for determining the optimum speed for six compressors for a gas network, the flow rates were obtained from the first simulation which is the flow simulation, the flow will remain constant during the simulation. The hypothesis is that compressor speed determines fuel consumption. The speed is encoded as genes and the fuel consumption is the objective function A genetic algorithm was used to search for the optimum speed for the compressors, that fulfill the objective function. From the simulation, the data showed that a genetic algorithm can be used to determine the sets of speed that give the minimum fuel consumption and is subjected to the constraint which is the pressure range at the demand point.


Steps to reproduce

The java programming language was used to write the codes in the IntelliJ integrated development environment. The classes are code templates, that make up the genetic algorithm and Gas Network. The classes that make up the genetic algorithm include genetic algorithm, Individual, and population, while the codes that make up the Gas network include, compressor, compressor station, loop, network, gas, loop, nodepro, and pipe. The class named constant is used to set various numeric constants and is used for providing constants for the genetic algorithm and gas network. To run the simulation, the parameters for the Gas network were set up in the Network class with the setNetworkUp method. The parameters for the Genetic algorithm were contained in the constant class, the parameters that can be changed to modify the search capacity of the genetic algorithm include: • POPULATION_SIZE • NUMBER_OF_GENERATION • CROSSOVER_RATE_FLOW • MUTATION_RATE_FLOW • TOURNAMENT_SIZE_FLOW To reach the same result the fitness function should be similar, and it determines the fittest individual which is the gas network with the set of speeds that gives the minimum value of the summation of the fuel consumption for all compressor stations in the gas network The approach to utilize the fitness function was to determine the best set of speed for the gas network. The main class contains the codes, which includes the copies of some class templates, which are created and run to direct the order of simulation, and some printouts of the simulation and results


Akademia Gorniczo-Hutnicza imienia Stanislawa Staszica w Krakowie


Petroleum Engineering, Natural Gas Network