The Pipesim Python Toolkit includes example scripts that cover all of its available methods, classes and properties. The scripts demonstrate the features and usage, which is indicated in the name of the script. They are located in the Pipesim installation folder, under Development Tools/Python Toolkit.
Along with the example scripts there are also several Case Studies. These are designed to demonstration potential use cases for the Pipesim Python Toolkit with more in depth code and and scripting. The case studies are located in the Pipesim installation folder, under Case Studies/Python Toolkit.
Before running the scripts or case studies, it is necessary to copy the Case Studies and Development Tools folders from the Program Files location into your Documents home folder. This is because the typical security settings for Windows limit read and write access in Program Files.
The following example scripts are included with the Pipesim Python Toolkit.
| Script | Description |
|---|---|
| add_and_delete.py | Add and delete model components. |
| add_well.py | Create a new model and add a well. |
| advanced_get_set_gaslift_tuning_factor.py | Update gas lift tuning factor. |
| advanced_get_set_tubing_head_temperature.py | Update tubing head temperature in advanced well. |
| advanced_get_set_wellstream.py | Update wellstream in advanced well. |
| advanced_well_concentric.py | Create a new model with advanced well in concentric tubing configuration. |
| advanced_well_dual_string.py | Create a new model with advanced well in dual string configuration. |
| advanced_well_set_type.py | Set well type to advanced and change tubing configuration. |
| advanced_well_single_string.py | Create a new model with advanced well in single string configuration. |
| advanced_well_tail_pipe.py | Add tail pipe to advanced well. |
| check_model_components.py | Open the Oil Network case study and review the model components. |
| connect_disconnect.py | Connect and disconnect model component connections. |
| connections.py | Display model connections. |
| convert.py | Convert a junction into a well or source. |
| copy_well.py | Copy (duplicate) a well. |
| create_black_oil_fluid.py | Create a black oil fluid. |
| create_compositional_fluid.py | Create a compositional fluid and set emulsion viscosity properties. |
| create_GIS_network.py | Create a network model with GIS coordinates. |
| create_network.py | Create a network model. |
| create_well_from_template.py | Create a well from a template. |
| describe.py | Display engineering units for parameters. |
| elevation.py | Get the elevations of GIS locations. |
| elevations.py | Get the elevations of a list of GIS locations. |
| excel_macros_functions.xlsx | Excel workbook with macros, functions and logging. |
| export_parameters.py | Export model component parameters. |
| find.py | Find model components. |
| generate_engine_files.py | Generate engine files for network and PT profile studies. |
| get_OneSubsea_multiphase_booster_results.py | Get simulation results for OneSubsea multiphase booster. |
| get_completion_ipr_points.py | Get a list of pressure, rate points for completion ipr model. |
| get_esp_curve_results.py | Get ESP pump curve results. |
| get_set_annulus_flow.py | Update of annulus flow in flowline. |
| get_set_batch_update.py | Perform a batch update on component parameters. |
| get_set_black_oil.py | Update black oil fluid parameters. |
| get_set_coating_table.py | Update pipe coating parameters. |
| get_set_completion_test_points.py | Update completion test point parameters. |
| get_set_composite_ipr.py | Update composite IPR. |
| get_set_corrosion_model.py | Update corrosion model values. |
| get_set_distributed_completion_properties.py | Update distributed completion values. |
| get_set_erosion_corrosion_risk_limits.py | Update erosion corrosion risk limits values. |
| get_set_esp_motor_and_cable.py | Update esp motor and cable values. |
| get_set_flow_control_valve_generic.py | Update flow control valve values in generic mode. |
| get_set_flow_control_valve_specific.py | Update flow control valve values in specific mode. |
| get_set_flow_correlations.py | Update global and local flow correlations. |
| get_set_fluid_composition.py | Update fluid composition. |
| get_set_geometry.py | Update flowline profile. |
| get_set_geothermal_profile.py | Update geothermal profile. |
| get_set_local_corrosion_model.py | Update global/local corrosion model settings. |
| get_set_mfl_fluid.py | Update MFL fluid properties and emulsion viscosity settings. |
| get_set_nodal_sim_inlet_conditions.py | Update inlet conditions for a nodal analysis simulation. |
| get_set_nodal_sim_sensitivites.py | Update sensitivities for a nodal analysis simulation. |
| get_set_oil_well_ipr.py | Update inflow performance relationship on a well completion. |
| get_set_pq_curve.py | Update a source PQ relationship curve. |
| get_set_pvt_fluid.py | Update PVT fluid properties. |
| get_set_relative_permeability_data.py | Update relative permeability data on Darcy completion. |
| get_set_simulation_settings.py | Update the simulation settings. |
| get_set_study_conditions.py | Update study conditions. |
| get_set_study_constraints.py | Update study constraints. |
| get_set_trilinear_ipr.py | Add a horizontal completion with trilinear IPR and run simulation. |
| get_set_well_heat_transfer.py | Get or set heat transfer table values. |
| get_set_value.py | Update a single parameter. |
| get_set_values.py | Update many parameters. |
| get_set_vfp_tables_conditions.py | Update vfp tables simulation parameters. |
| get_set_well_trajectory.py | Update a well trajectory. |
| get_set_wellstream_outlet.py | Update wellstream outlet. |
| get_set_blackoil_mix_viscosity_table.py | Update blackoil user defined mix viscosity table. |
| get_set_mfl_mix_viscosity_table.py | Update MFL user defined mix viscosity table. |
| get_set_compositional_mix_viscosity_table.py | Update compositional fluid user defined mix viscosity table. |
| get_set_userdefined_metocean.py | Update user defined metocean data |
| get_set_user_viscosity_table.py | Update blackoil user defined viscosity table |
| get_set_using_component.py | Get or set values using the find_component_objects method in Model class |
| get_spot_report_results.py | Get spot report results from simulation. |
| gldiagnosticssim_run_simulation.py | Perform a Gas lift diagnostics simulation. |
| multiprocessing_run_simulation_parallel.py | Run simulations in parallel using multiprocessing. |
| multiprocessing_run_simulation_seq.py | Run simulations sequentially using multiprocessing. |
| network_opt_sim_apply_results.py | Perform a network optimizer simulation and apply the results to the model. |
| network_opt_sim.py | Perform a network optimizer simulation. |
| networksim.py | Perform a network simulation. |
| networksim_async.py | Perform a network simulation as a background task. |
| new.py | Create a new Pipesim model. |
| nodal_sim_multipoint.py | Perform a nodal analysis simulation with multipointing. |
| nodal_sim_run_simulation.py | Perform a nodal analysis simulation with custom conditions and show plot. |
| nodal_sim_run_simulation_sensitivities.py | Perform a nodal analysis simulation with sensitivities. |
| open_ui.py | Open the Pipesim model in the UI. |
| open_close.py | Open and close a Pipesim model. |
| open_close_eu.py | Open and close a Pipesim model with alternative units. |
| open_save.py | Open and save a Pipesim model. |
| ptprofilesim_calc_custom_variable.py | Perform a PT Profile simulation with custom variable. |
| ptprofilesim_calc_outlet_pressure.py | Perform a PT Profile simulation with a specified outlet pressure. |
| ptprofilesim_sensitivity.py | Perform a PT Profile simulation sensitivity study. |
| ptprofilesim_multipoint.py | Perform a PT Profile simulation using multipointing. |
| read_catalog.py | Update an ESP from the catalog. |
| run_all.py | Run all the examples. |
| systemanalysis_sensitivity_customvariable.py | Perform a System analysis simulation with sensitivity and custom variable. |
| systemanalysissim_run_simulation.py | Perform a System analysis simulation. |
| systemperformance_concentric_tubing.py | Perform a System performance operation for concentric tubing. |
| systemperformance_dual_string.py | Perform a System performance operation for dual string. |
| systemperformance_flowcontrolvalve_result.py | Perform a System performance operation and check result of flowcontrolvalve. |
| validation_model.py | Validates the model for possible issues. |
| validation_network_opt_sim.py | Validates the model and optimization task for possible issues. |
| validation_networksim.py | Validates the model and networksim task for possible issues. |
| validation_nodal_sim.py | Validates the model and nodal analysis task for possible issues. |
| validation_ptprofile_sim.py | Validates the model and PT profile task for possible issues. |
| validation_system_performance.py | Validates the model and system performance task for possible issues. |
| vfp_tables_simulation_with_sensitivities.py | Perform a vfp tables simulation with sensitivities. |
| well_calibration.py | Perform well calibration task. |
| well_calibration_publish.py | Publish well calibration results to the model. |
| well_calibration_reset_boundary_conditions.py | Reset boundary conditions for well calibration test data. |
| well_calibration_set_calibration_parameters.py | Get and set calibration parameters for well calibration. |
| well_calibration_add_delete_test.py | And and delete well test data for well calibration. |
| well_export.py | Export a well to a new Pipesim model. |
| well_export_all.py | Export all the wells to individual Pipesim models. |
| well_import.py | Import a well into the Pipesim model. |
| well_import_all.py | Import multiple wells from a specified folder. |
| wellperformancecurvessim_run_simulation.py | Perform a Well performance curves simulation. |
| worker_thread_test.xlsx | Excel workbook with xl_worker_thread, xl_main_thread macros. |
The following Case Studies are included with the Pipesim Python Toolkit.
| Case Study | Complexity | Description |
|---|---|---|
| Build Network Model | Complex | Builds a network model from data in an Excel workbook. |
| Choke Manager | Simple | Uses Excel as a simple interface for updating choke parameters. |
| Daily Production | Simple | Runs simulations for each day of production data. |
| Excel Template | Simple | Template. Uses Excel as a simple interface to Pipesim model. |
| Export Flowline Geometries | Simple | Exports the flowline geometries from a model. |
| FCV Sensitivity | Complex | Perform multiple advanced well simulations for different flow control valve positions. |
| Gas Lift Diagnostics | Moderate | Uses Excel as a simple interface for running Gas Lift Diagnostics. |
| Gas Lift Optimizer | Complex | Uses Excel as a simple interface for gas lift optimizer network. |
| Gas Lift Performance | Simple | Uses Excel as a simple interface for running Gas Lift Performance. |
| GIS Model Conversion | Complex | Converts junctions into model components after a GIS shape file import. |
| InjectionPoint manager | Simple | Uses Excel as a simple interface for updating injection point parameters. |
| Merge Networks | Complex | Uses Excel as an interface to call merge networks script. |
| Network Optimizer | Complex | Uses Excel as a simple interface for network optimizer for all control types (ESP, PCP, Gas Lift & Choke). |
| Network Simulation | Moderate | Uses Excel as a simple interface for network simulations. |
| Nodal Analysis | Complex | Uses Excel as a simple interface for nodal analysis simulations. |
| PT Profile Simulation | Moderate | Uses Excel as a simple interface for PT Profile simulations. |
| Slug Catcher Sizing | Moderate | Performs multiple simulations for a slug catcher sizing study. |
| SpotReport manager | Simple | Uses Excel as a simple interface for updating spot report parameters. |
| System Analysis | Moderate | Uses Excel as a simple interface for running system analysis. |
| VFP simulation | Moderate | Perform multiple VFP tables generation based on individually predefined parameters. |
| Well Calibration | Moderate | Uses Excel as a simple interface for well calibration. |
| Well Model Management | Simple | Imports and exports individual well models from a network model. |
The data for a Pipesim model can come from many different sources. Typically this is available in a database, or in a document such as Excel workbook.
In this case study the model data has been provided in a formatted Excel workbook. The script reads the workbook and automatically builds the Pipesim model from the data. The user can update the parameterization, add or remove model components, and change the specified parameters in the workbook without needing to edit the script. The final model is opened in the Pipesim UI for verification and review.
Pipesim network model may contains many chokes in wells and network. In user interface user must edit choke parameters one by one. Excel can be used as a simple interface to control parameters of all choke at one table.
This case study demonstrates how to read list of chokes from model, get current parameters and update values.
Pipesim is sometimes used for production allocation and product metering verification. In these situations some of the production data is used as the boundaries in the Pipesim model, with the remaining data compared to the Pipesim simulation results.
The case study takes field data and runs the Pipesim model using these as boundary conditions. The Pipesim results are provided to compare with the field flow rates. This will highlight discrepancies in meter allocation, model calibration, or differences due to flow assurance issues.
Template of Excel-Pipesim link. The case study demonstrates how to get model description.
The GIS feature in Pipesim provides elevation data capture from online data sources. After capturing the elevation data the profile is often needed in other documents such as reports and calculations.
This case study uses Excel as an interface for performing advanced well simulations. Current well operation conditions can be received from the System performance task. Simulation will be performed for different FCV positions within a user defined range and results are reported in separate tables for each combination. The user can control the workflow for selecting the best combination of FCV positions.
Gas Lift Diagnostcs is one of the important features in Pipesim that allows engineers and operators analyze the impact of various production operation conditions on the performance and status of Gas Lift valves installed in the well.
The case study demonstrates how to check whether you can open (connect to) the model, set simulation conditions and run the Gas Lift Diagnostcs task. Once the task is completed, the status of each gas lift valve in displayed, in addition to the gas rate passing through each valve.
Excel can be used as simplified user interface for running Pipesim gas lift network optimizer simulations. Pertinent data can be exposed and updated without danger of the user damaging the underlying Pipesim model.
Boundary conditions, Initial conditions, Dual strings, Local constraints & Optimization parameters can be updated, simulations performed, and the results reviewed.
PIPEISIM provide a powerful simulation capability to model well performance with Gas Lift system installation. Based on casing injection pressure, gas density and hydraulic calculations, PIPIESIM will identify the operating valves and calculate well production flow rate at different surface gas lift injection rates.
The case study simplifies modeling the Gas Lift performance simuation and allows changing boundary conditions and Gas Lift rates, running well performance and then plotting the Gas Lift performance curve in Excel.
Pipesim can import GIS shape files to automatically lay out the flowlines and junctions. After import, the junctions can be converted to the equipment that exists in the field, such as well, sources and sinks.
This case study takes a Pipesim model file created from a shape file import and uses Excel data to do a search and replace on the model components. The components are matched against the latitude and longitude of the junctions.
The script is run from the desktop or through an interative Python window. While it reads the Excel workbook, it demonstrates that scripts do not need to be embedded in order to interact with Excel.
Pipesim network model may contains many injection points in both wells and network. In user interface user must edit injection point parameters (fluid, rate, temperature) one by one. Excel can be used as a simple interface to control parameters of all injection points at one table.
This case study demonstrates how to read list of injection points from model, get current parameters and update values.
Excel can be used as simplified user interface for running Pipesim network optimizer simulations. Pertinent data can be exposed and updated without danger of the user damaging the underlying Pipesim model.
Boundary conditions, Initial conditions, Local constraints & Optimization parameters can be updated, simulations performed, and the results reviewed.
Excel can be used as simplified user interface for running Pipesim network simulations. Pertinent data can be exposed and updated without danger of the user damaging the underlying Pipesim model. Boundary conditions and equipment data can be updated, simulations performed, and the results reviewed.
This case study uses Excel as an interface for performing network simulations. The boundary conditions and specific equipment data is exposed for user updates. The simulation can be run and results retrieved for analysis.
Excel can be used as simplified user interface for running Pipesim nodal analysis simulations. Pertinent data can be exposed and updated without danger of the user damaging the underlying Pipesim model. Boundary conditions and equipment data can be updated, simulations performed, and the results reviewed.
This case study uses Excel as an interface for performing batch nodal analysis simulations. The boundary conditions is exposed for user updates, the simulation run and results retrieved for visualization and analysis.
Excel can be used as simplified user interface for running Pipesim PT profile simulations. Pertinent data can be exposed and updated without danger of the user damaging the underlying Pipesim model. Boundary conditions and equipment data can be updated, simulations performed, and the results reviewed.
This case study uses Excel as an interface for performing PT Profile simulations. The boundary conditions is exposed for user updates, the simulation run and results retrieved for analysis.
Pipesim is often used on projects during the concept and front end engineering design (FEED) phases for equipment sizing.
In this use case, a parametric study is performed on a Pipesim model to determine the size of a slug catcher at an onshore receiving facility. It varies the flow correlation, Equation of State and liquid / gas ratio for pigging and ramp up scenarios. It is based on the paper presented at Pipeline Simulation Interest Group, PSIG1603.
Pipesim network model may contains many spot reports with different options. Excel can be used as a simple interface to control parameters of all reports at one table.
This case study demonstrates how to read list of spotreport from model, get current options and update values.
This case study uses Excel as an interface for running Pipesim system analysis simulations. Pertinent data can be exposed and updated without danger of the user damaging the underlying Pipesim model. Boundary conditions can be updated, simulations performed, and oil rate given different operation condidtion is estimated.
This case study uses Excel as an interface for performing VFP tables generation. Current well operation conditions can be received from Network simulation task. Table template allows to setup VFP task parameters for all wells simultaneously or specify unique parameters for each well. The ready VFP tables are stored in temporary folder specified by user.
Excel can be used as simplified user interface for running Pipesim well calibration task. Well test data and calibration parameters can be exposed and updated without danger of the user damaging the underlying Pipesim model.
This case study demonstrates how to extract well test data and related calibration parameters from the model, add a new test, and run a simulation. The calibration results can be published back to the model.
A use case for model management is to model wells individually and to import them into a single Pipesim file for a network simulation. It allows you to maintain individual well models, while being able to easily run a single large network simulation.
This case study provides an Excel interface for managing the well models. It will export all the wells in a Pipesim model to individual files and import them again on the click of a button. The well names in the model are also listed.