Dynamic modelling and PID loop control of an oil-injected screw compressor package

A significant amount of time is spent tuning the PID (Proportional, Integral and Derivative) control loops of a screw compressor package due to the unique characteristics of the system. Common mistakes incurred during the tuning of a PID control loop include improper PID algorithm selection and unsuitable tuning parameters of the system resulting in erratic and inefficient operation. This paper details the design and development of software that aims to dynamically model the operation of a single stage oil injected screw compressor package deployed in upstream oil and gas applications. The developed software will be used to assess and accurately tune PID control loops present on the screw compressor package employed in controlling the oil pressures, temperatures and gas pressures, in a bid to improve control of the operation of the screw compressor package. Other applications of the modelling software will include its use as an evaluation tool that can estimate compressor package performance during start up, shutdown and emergency shutdown processes. The paper first details the study into the fundamental operational characteristics of each of the components present on the API 619 screw compressor package and then discusses the creation of a dynamic screw compressor model within the MATLAB/Simulink software suite. The paper concludes by verifying and assessing the accuracy of the created compressor model using data collected from physical screw compressor packages.


Overview
Modern screw compressor packages contain a multitude of instruments, control valves and components which influence and change the operational characteristics of the compressor package. The complex design of a screw compressor package poses huge challenges in relation to achieving stable process output, as the measured operational variables (e.g. operating temperatures, pressures and flows) must be closely monitored and controlled to ensure that the compressor package is operating within its designed limits. By monitoring these variables it is possible to tune Proportional, Integral and Derivative (PID) loop controllers that govern the operation of the compressor through the actuation of valves and motors. The PID controller aims to match the measured process variables on the screw compressor package to set points that are predefined by the system operator. However, if a PID loop is improperly tuned the controller will struggle to accurately match the measured process variable to the chosen set point, which can result in unstable and inefficient operation of the screw compressor package [1].
The aim of the project is to create a dynamic mathematical model of an oil injected screw compressor package manufactured by Howden Compressors. The initial mathematical model of the screw compressor package will look to estimate critical values of the screw compressor such as oil and gas system pressures, temperatures and flows. Once the mathematical model of the screw compressor system has been created the next step is to incorporate control valve actuation, including closed loop PID control of the valves. By including the control valves and their PID control loops it will be possible to assess how the compressor package will react to changes in the process within the screw compressor. This will then allow for the operation of the modelled screw compressor package to be tuned in the same fashion that a physical package would be tuned.
Initially the specification of the mathematical model will be created and a compressor model will be developed within MATLAB and Simulink based on this specification. The model will then be verified against test data acquired from an operational Howden screw compressor package. This will ensure that the developed modelling software is able to accurately estimate each chosen parameter of the screw compressor and that the initial requirements for the model have been fulfilled.

Dynamic Compressor Package Model
The motivation behind this project is to create a physically accurate screw compressor model that will allow for PID loop tuning of a modelled screw compressor package to happen before the physical screw compressor package has been commissioned. By doing this time spent commissioning a specific screw compressor package at site will be decreased as it will be possible to apply PID controller settings to the control valves that were estimated to be suitable by the compressor modelling software. It is estimated that over 75% of PID loops within the process industry are poorly tuned, resulting in increased process variability which is detrimental to the operation of the plant [2]. The developed software model will aim to decrease the likelihood of a poorly tuned PID control loop being present on a selected compressor package by pre-emptively estimating the PID loop settings. The dynamic compressor model will also provide insight into pre-start, start, shut down and emergency shutdown conditions for the compressor package, without physically operating a compressor. This will allow for a risk free environment where PID control settings can be optimised without the possibility of a poorly tuned PID loop damaging physical components on a compressor package.

Dynamic Model Definition
Initially, the physical components on the dynamic screw compressor package will be split into individual modules from which the full compressor package model will be constructed. The model will focus on accurately representing the fundamental components on the compressor package using differential equations and look-up tables. Figure 1 outlines the key screw compressor components that are modelled, including the model inputs, design variables and outputs. Each of the compressor components within figure 1 will be modelled within MATLAB/Simulink, which will include representing each component within a function block. By modelling each component within its own MATLAB/Simulink function block, it is possible to create a customisable reference component library that will be used as the starting point for each individual dynamic compressor model. The user will define and customise each component block so it shares the same parameters as the physical component that it models.

Figure 1. Key Screw Compressor Components
The key components listed within figure 1 are critical and must be accurately modelled within MATLAB/Simulink if the resulting dynamic model is to be reliable and accurate. With the critical components and their variables defined it is paramount that each component is modelled within its own function block. The function blocks for each of the compressor components that will be considered within the dynamic model are shown in Figure 2. These function blocks must be arranged in conjunction with one another so that they accurately represent the physical dynamics of the compressor system that they are being modelled after. The easiest way to achieve this is to use the compressor piping and instrumentation diagrams as a reference to construct the dynamic model.

Dynamic Model Construction
Construction of the screw compressor dynamic model aims to recreate the physical parameters of the selected screw compressor package. To initialise a new screw compressor package model the parameters of the screw compressor need to be defined, which are outlined in figure 1.
The standardised dynamic model for each of the screw compressors manufactured by Howden Compressors will be used as a starting point for each new screw compressor package model. The standardised model will be modifiable which will allow each module to represent a number of different compressor models and setups, which all have a variation of different design and operational characteristics. Defining the compressor model is the starting point for each dynamic model, with each modular component added onto the compressor model. To assist in the creation of the model the piping and instrumentation diagram for the specific compressor that is being modelled can be used as a reference. Figure 3 illustrates the piping and instrumentation diagram for the lubrication oil system of the screw compressor package with the screw compressor, main drive motor, lubrication oil air blast cooler, primary separator, control valves and lubrication oil pumps all represented within the system. Each of the components is modelled using the information included within the manufacturer supplied datasheets, which will ensure that each model accurately reflects the physical parameters of each component.    Figure 4 is the lubrication oil system shown in Figure 3, recreated within the MATLAB/Simulink software package, where each main component within the system is represented by its own unique function block. This includes separate module blocks for the heat exchanger, compressor, oil pipelines and temperature control valves. To improve the usability of the software, the dynamic model has been integrated into a graphical user interface (GUI) that allows the end-user to easily input variables into the dynamic compressor model without altering any of the underlying code contained within the function blocks. The results from the simulation are then displayed on the GUI and also saved into a spreadsheet for analysis purposes. The next step in this process is to ensure that the model in Figure 4 is reliable and can be used with confidence to estimate the operation of the lubrication oil system. To achieve this it is essential that each modular model is independently verified.

Model Verification & Validation
Verification of the screw compressor model is a key step in ensuring the accuracy and reliability of the created model. Model verification ensures that it meets the requirements expected of the model in relation to its functionality and more importantly confirms model reliability and accuracy. It is a key step in the process of mathematically creating a dynamic model as it verifies not only the functionality of the model, but also the structure of the model [3].
The model will be validated against real world operational data to assess its ability to accurately model the operation of the screw compressor package and to ensure that the model is reliable [4]. Validation data will be collected from screw compressor package tests including the QGC package string test and tests of compressor systems at the Howden Compressors test facility. Figure 5 illustrates the process undertaken to collect validation data from the screw compressor package. Field equipment measurement data is collected and processed via the PLC into Logix5000 where it is then stored as an Excel .xlsx file. This information can then be exported into the MATLAB workspace where it will be used to validate the output from the dynamic model.

Figure 5. Data Collection Process for Model Validation
To gather data that is suitable for the purpose of system validation it is essential that the required test conditions are met by the screw compressor during the period of data collection from the screw compressor package. Changes in compressor operation should be instigated by the operator of the screw compressor system by altering temperature and pressure set points within the screw compressor package (via the control panel HMI or PLC) in what is known as a 'bump test'. To instigate this test a significant change in the control system set points needs to take place, which will result in the actuation of temperature and pressure control valves that look to match the new set points set by the system operator. By executing the bump test the dead time within the compressor system will become apparent. The dead time within the system refers to the time taken for a process variable to change its value in relation to the change in an output from a control valve or motor [5]. The dead time of a system can greatly increase the difficulty of tuning a control loop, as the added lag into the system can be challenging for the PID loop controller to manage. It is essential that pressure, temperature and flow changes are recorded at multiple points on the screw compressor during this test so that the reaction of the screw compressor system can be recorded and identified and then used to validate the created mathematical model. If possible, it is advisable that the system inputs, outputs and control valve actuation are recorded as this will ensure that any changes within the system can be easily identified and monitored during system analysis.

Model Validation Method
For model validation purposes the assumed 'bump test' on the compressor system is defined as change in operation of the valves between start up and continuous operation compressor conditions. This allowed for the screw compressor model to be validated against a dataset that would exhibit the full dynamic range of the physical screw compressor package. The validation data that was used was collected over a five hour period from a single stage oil injected screw compressor package that consists of a suction knock-out vessel, fan cooled lube oil/gas heat exchanger and a combined primary and secondary oil separator and installed on the skid.
To give an example of the model validation process, the dynamic heat exchanger model was assessed by using the compressor output lubrication oil temperature test data as the input into the heat exchanger model. As before, the heat exchanger model has been programmed to model the physical parameters of the heat exchanger installed on the compressor that the test data was collected from. If the model is accurate, the output lubrication oil temperature from the heat exchanger model will mimic the cooled lube oil measurements recorded during the package string test. To enhance the control capabilities of the heat exchanger model a temperature control valve model with identical parameters as the physical temperature control valve that governed the output of the reference heat exchanger has been added to the system. The temperature control valve model will have its actuation controlled by the data collected from the physical control valve positioner data. This will ensure that the actuation of the control valve within the model is precisely mimicking the movement of the physical control valve on the package during the string test. The positioner is controlled by a fully tuneable PID controller during normal operation of the simulation. With the inclusion of the temperature control valve, full control over the temperature of the lubrication oil within the system is possible. The MATLAB/Simulink model used to validate the heat exchanger model against the validation data is shown in Figure 6. To achieve this, the validation data is used as the lubrication oil temperature input into the heat exchanger. The control valve that regulates the flow of oil into the heat exchanger model will then alter the position of the valve with the aim of keeping the temperature of the oil at the chosen set point of 47°C. Inputs pressure and flow into the control valve are constant and their values are matched to what would be expected during normal operation. During the execution of the Simulink model the output temperature and control valve position feedback data are recorded, which will be used to assess the performance of the compressor model.

Dynamic Heat Exchanger Model Validation
To validate the model, the output from the heat exchanger function block will be compared and analysed against the measured output from the physical heat exchanger. This is a critical step as it will allow for the performance of the control valve and heat exchanger system to be quantified. Figures 7  and 8 illustrate the control valve actuation, lubrication oil temperature input, physical heat exchanger output and model heat exchanger output data. The two stages of the compressor test can be seen in figure 7 and 8 with the start up phase occurring between 0 -4000 seconds where the primary separator lubrication oil and oil cooler output temperature will continue to fluctuate until it reaches a steady state value. During this time the temperature control valve is actuating in a bid to maintain an oil temperature set point of 47°C. The oil temperature reaches a steady state after 4000 seconds. At first glance, Figures 7 and 8 show the control valve model and heat exchanger model are capable of producing outputs that are comparable to those recorded from the physical heat exchanger and control valve components installed on the compressor package. To fully quantify and assess the accuracy of the heat exchanger and control valve models the output data from the model will need to be compared to collected validation data. The root mean squared error (RMSE) between the validation data and model output is found, which will return the measured total error as a square root of the sum of the model variance and the bias [6]. This will provide a quantified measurement of how strongly related the output of the model is to the collected test data. (1) Where: = number of samples, = measured value and = model estimated value.

RMSE is defined in equation
Equation (1) returns an average RMSE for the heat exchanger and temperature control models of 5.4062 for the duration of the string test. This RMSE improves to 1.1903 if the initial start up phase of the compressor between 0-4000 seconds is ignored. This is vital information as it shows that the model is capable of accurately predicting temperature values during steady state operation however, it is weaker at predicting temperature output during start up operation which will need to be improved in later iterations of the model.
The model validation process will be repeated to assess the accuracy of each of the compressor components in a bid to ensure that the output from each of the models is reliable and can be used to model the full screw compressor package. Accuracy within each model is paramount as it will allow for the most reliable model to be created.

Conclusions
The dynamic screw compressor package model is a useful tool that will give engineers the ability to predetermine PID control loop settings to be used that will control the actuation of the pressure and temperature control valves on the screw compressor. This will decrease the time spent by engineers trying to finely tune the PID control parameters and hence speed up the time spent commissioning a screw compressor package whilst also ensuring stable operation of the screw compressor package. The dynamic compressor model is also useful in the design stage of the compressor package, as it can be used to predict the performance of a component or the performance of the compressor package as a whole. Further development of the screw compressor model will need to take place in a bid to improve accuracy, with additional analysis into the validation of the compressor model using multiple datasets from compressor tests.