OLI Cloud APIs comprise a suite of tools for interacting with the OLI engine via straightforward web requests. They facilitate running simulations like water analysis, flash calculations, and process simulation, using just HTTP requests. The APIs allows users to update properties such as air temperature, rain, actual flow rate etc programmatically into the simulations.
OLI currently offers several API packages, each equivalent to a specific desktop product; these include:
Desktop Software | Cloud Equivalent | Description | |
1 | OLI Studio: Stream Analyzer | OLI Engine API | Flash calculations functionality |
2 | OLI Studio: Scale Chem | OLI ScaleChem API | Scale prediction functionality |
3 | OLI Studio: Corrosion Analyzer | OLI Corrosion API | Corrosion prediction functionality |
4 | OLI Flowsheet: ESP | OLI Process API | Process flow calculations |
5 | OLI Chemistry Wizard | OLI ChemBuilder API | Chemistry file generation |
OLI Cloud APIs are powered by the same OLI engine that powers the desktop tools; they require no installation for usage. To initiate the OLI API calculations, a script that interfaces with these APIs is required.
Capabilities of OLI APIs
The OLI Cloud APIs offer a wide range of capabilities, allowing you to perform various simulations similar to those on our desktop application, but with more flexibility and the ability to automate numerous calculations. These simulations include, but are not limited to, mixing water streams, reconciling water quality, reverse osmosis, pH neutralization, predicting mineral scaling, and analyzing corrosion rates. The APIs can also process your entire flowsheet case file in the cloud and provide the results.
The API calculations are initiated by a script, or a custom program located within the customer’s environment. This program can be configured to access local data sources and can perform simulations at scale. Here are a few instances where the use of OLI APIs proves beneficial:
- Automating simulation runs for hundreds of scenarios in an Excel file.
- When you have a laboratory data system with lab data for a large number of assets with constantly changing inflow compositions, APIs can be utilized to run simulations for each asset with latest composition data. Following these simulations, the system can automatically execute dynamically selected survey scenarios for each asset to determine the scaling or corrosion potential as the conditions change.
- When you have an inline analyzer data in the plant, you can use the real-time analyzer data to run what-if simulations and use the simulation results for automated cost optimization.
The API solution, which includes a script with connection to OLI APIs, can be configured to run on a schedule or in batch mode. Additionally, the results from the simulations can be stored in a data system of your choice for further analysis or visualization.
How to start using OLI APIs
To begin using OLI Cloud APIs, you need to follow these three steps:
- Registration: Obtain a license and register for OLI Cloud API access.
- Chemistry File Creation: Use your existing OLI Studio/Flowsheet case file to create a chemistry file or generate a new one in the cloud with ChemBuilder.
- Run Calculations: Develop a script to select input data and initiate OLI calculation. Once completed, the results are returned to you.
After completing the steps outlined above, your script can be configured to run simulations on a schedule. Scheduled runs ensure that the solution continues to operate in the background periodically, providing greater visibility into changing operating conditions.
Figure 1 depicts a solution deployed in a customer environment that utilizes OLI Cloud APIs to run simulations.
OLI’s APIs provide users with the flexibility to programmatically run multiple calculations in a sequence if more than one unit model is interconnected, or to run simulations in parallel. Running calculations in parallel reduces the total runtime, especially when dealing with a large number of simulations. Additionally, APIs also facilitate handling special scenarios, such as introducing time steps to simulate daily or hourly changes in the plant.
Figure 2 illustrates a simple scheduled task that retrieves data from a data source system for Water Analysis calculation. Subsequently, it utilizes the results of the Water Analysis to conduct a flash calculation.
OLI stores calculation results for 24 hours by default, with the option for immediate deletion post-retrieval. It is important to note that OLI Cloud’s primary role is as a calculation engine, not a data storage solution.
To help you build your own API based solutions, OLI provides a solution accelerator kit, which includes a sample Python solution and a Python wrapper. Additionally, documentation for the OLI Cloud API can be accessed at OLI API documents. This resource offers code snippets and examples to demonstrate script usage.
Conclusion
In this guide, we delved into the dynamic capabilities of the OLI Cloud APIs, demonstrating their flexibility in handling a large number of calculations. Their design allows for the introduction of changing environmental conditions into simulations, enhancing the accuracy and relevance of your results. Furthermore, these APIs enable you to sequence multiple simulation runs creatively by passing the output of one simulation as the input to another. If you have any questions or wish to discuss potential applications, feel free to reach out to us at OLI Systems Support.