### Opyrability Examples Gallery Setup
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/examples_gallery/index_example_gallery.html
Configuration for launching interactive Python kernels via Binder or Colab, specifying kernel name and path.
```python
{
"requestKernel": true,
"binderOptions": {
"repo": "CODES-group/opyrability",
"ref": "main",
},
"codeMirrorConfig": {
"theme": "abcdef",
"mode": "python"
},
"kernelOptions": {
"name": "python3",
"path": "./examples_gallery"
},
"predefinedOutput": true
}
kernelName = 'python3'
```
--------------------------------
### Opyrability Navigation Links
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/intro.html
Lists key sections of the Opyrability documentation, including Installation, Overview, Algorithms, API Documentation, Process Model, Examples, and Bibliography, with corresponding links.
```Markdown
* [Installation](installation.html)
* [Using in a Google Colab environment:](installation.html#using-in-a-google-colab-environment)
* [Dependencies](installation.html#dependencies)
* [Process Operability Overview](operability_overview.html)
* [Process Operability Algorithms](algorithms.html)
* [API Documentation](api.html)
* [opyrability](_autosummary/opyrability.html)
* [The Process Model (M) - Programming Aspects](process_model.html)
* [Examples Gallery](examples_gallery/index_example_gallery.html)
* [Bibliography](bibliography.html)
```
--------------------------------
### Opyrability Documentation Navigation and Theme Setup
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/examples_gallery/Unisim_Example.html
This snippet demonstrates JavaScript code used for setting up the documentation's theme (light/dark/auto) and search functionality. It also includes logic for handling the display of toggle buttons and initializing Thebe for interactive code execution.
```JavaScript
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
let toggleHintShow = 'Click to show';
let toggleHintHide = 'Click to hide';
let toggleOpenOnPrint = 'true';
var togglebuttonSelector = '.toggle, .admonition.dropdown';
const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js";
const thebe_selector = ".thebe,.cell";
const thebe_selector_input = "pre";
const thebe_selector_output = ".output, .cell_output"
document.write(``);
document.write(` `);
document.write(` `);
document.write(` `);
```
--------------------------------
### UniSim Simulation Setup and Execution Parameters
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/examples_gallery/Unisim_Example.html
Demonstrates setting up simulation parameters in Python for UniSim Design. This includes defining the bounds for input variables (Ratio and Feed Flow Rate) and specifying the resolution for the simulation grid. It then calls a mapping function with the model, bounds, and resolution.
```Python
# Access to the spreadsheet
sheet_1 = Case.Flowsheet.Operations.Item('Plantwide') #Update with your spreadsheet name
# Subsequently, one can input the lower and upper bounds for the inputs and also define the resolution.
# SP-101 Ratio range: 0 - 0.1
# Feed Flow Rate range: 9000 - 15000 kmol/h
# Resolution: 5 x 5 grid = 25 simulations
AIS_bounds = np.array([[0, 0.1],
[9000, 15000]])
model = calculate_y
resolution = [5, 5]
AIS, AOS = AIS2AOS_map(model, AIS_bounds, resolution, plot=True)
```
--------------------------------
### Opyrability Navigation and Theme Switching
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/algorithms.html
Provides navigation links for Opyrability documentation, including sections on installation, overview, algorithms, API, process model, examples, and bibliography. It also includes functionality for switching between light and dark themes and a search button.
```HTML/JavaScript
* [Opyrability Documentation](intro.html)
* [Installation](installation.html)
* [Process Operability Overview](operability_overview.html)
* [Process Operability Algorithms](#)
* [API Documentation](api.html)
* [opyrability](_autosummary/opyrability.html)
* [The Process Model (M) - Programming Aspects](process_model.html)
* [Examples Gallery](examples_gallery/index_example_gallery.html)
* [Bibliography](bibliography.html)
* [Repository](https://github.com/CODES-group/opyrability "Source repository")
* [Open issue](https://github.com/CODES-group/opyrability/issues/new?title=Issue%20on%20page%20%2Falgorithms.html&body=Your%20issue%20content%20here. "Open an issue")
* [.rst](_sources/algorithms.rst "Download source file")
* .pdf
document.write(``);
document.write(` `);
```
--------------------------------
### Opyrability NLP Approach Setup
Source: https://github.com/codes-group/opyrability/blob/main/tests/dma_mr_inverse_mapping.ipynb
Sets up the necessary parameters for the NLP-based approach, including bounds for Design of Experiments (DOS), discretization resolution, design variable bounds, initial estimates, and constraints like plug-flow.
```Python
from dma_mr import *
from opyrability import nlp_based_approach
import jax.numpy as np
# Lower and upper bounds for DOS definition.
DOS_bounds = np.array([[15, 25],
[35, 45]])
# Discretization Resolution - 10x10 grid for DOS.
DOS_resolution = [10, 10]
# Lower and upper bounds of AIS (design)
lb = np.array([10, 0.1])
ub = np.array([300, 2])
# Initial estimate for NLP.
u0 = np.array([100, 1])
# Plug-flow constraint definition: L/D >=30.
def plug_flow(u):
return u[0] - 30.0*u[1]
con ={'type': 'ineq', 'fun': plug_flow}
# Model assignment - Design Problem - Inverse mapping.
model = dma_mr_design
# Obtain AOS.
fDIS, fDOS, _ = nlp_based_approach(model, DOS_bounds, DOS_resolution,
u0, lb, ub,
constr = (con),
method = 'ipopt',
plot = True,
ad = True,
warmstart = True)
```
--------------------------------
### Opyrability Documentation Navigation Menu
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/examples_gallery/Aspen_Example.html
This snippet defines the main navigation structure for the Opyrability documentation, including links to installation, overviews, algorithms, API documentation, process models, examples, and bibliography.
```HTML
* [Opyrability Documentation](../intro.html)
* [Installation](../installation.html)
* [Process Operability Overview](../operability_overview.html)
* [Process Operability Algorithms](../algorithms.html)
* [API Documentation](../api.html)
* [opyrability](../_autosummary/opyrability.html)
* [The Process Model (M) - Programming Aspects](../process_model.html)
* [Examples Gallery](index_example_gallery.html)
* [Bibliography](../bibliography.html)
```
--------------------------------
### Install Opyrability from PyPI/conda
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/installation.html
Instructions for installing the Opyrability library using package managers like PyPI or conda. Supports Windows, Linux, and macOS.
```bash
pip install opyrability
# or
conda install -c conda-forge opyrability
```
--------------------------------
### Setup Opyrability in Google Colab
Source: https://github.com/codes-group/opyrability/blob/main/docs/installation.md
Configures a Google Colab environment for opyrability by installing condacolab and then installing opyrability using conda.
```console
!pip install -q condacolab
import condacolab
condacolab.install()
!conda install -c codes-group -c conda-forge opyrability
```
--------------------------------
### Setup Opyrability in Google Colab
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/_sources/installation.md
Configures a Google Colab environment for opyrability by installing condacolab and then installing opyrability using conda.
```console
!pip install -q condacolab
import condacolab
condacolab.install()
!conda install -c codes-group -c conda-forge opyrability
```
--------------------------------
### Opyrability Initialization and Thebe Setup
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/algorithms.html
Initializes Opyrability documentation by setting the mode and theme from local storage and configuring Thebe for interactive code execution. It also sets up MathJax for rendering mathematical equations.
```JavaScript
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
let toggleHintShow = 'Click to show';
let toggleHintHide = 'Click to hide';
let toggleOpenOnPrint = 'true';
var togglebuttonSelector = '.toggle, .admonition.dropdown';
const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"
const thebe_selector = ".thebe,.cell"
const thebe_selector_input = "pre"
const thebe_selector_output = ".output, .cell_output"
window.MathJax = {"options": {"processHtmlClass": "tex2jax_process|mathjax_process|math|output_area"}}
DOCUMENTATION_OPTIONS.pagename = 'algorithms';
```
--------------------------------
### Multimodel Representation Setup
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/examples_gallery/aps_connection.html
This Python code demonstrates the setup for a multimodel representation study. It defines the bounds and discretization resolution for the input variables (AIS) and then calls a function 'multimodel_rep' to generate the representation. This is followed by a series of simulation calls with varying input values.
```Python
import numpy as np
# AIS bounds definition for the 2 inputs x 2 outputs case study
AIS_bounds = np.array([[8e5, 1.3e6], [1.5e5, 3.5e5]])
# AIS discretization definition
AIS_resolution = [5, 5]
# Multimodel representation call
AOS_reg = multimodel_rep(Multi, AIS_bounds, AIS_resolution)
# Calling simulation with inputs: [800000. 150000.]
print("Calling simulation with inputs: [800000. 150000.]")
# Initial simulation status: True (assumed from context)
# Example of subsequent simulation calls with varying inputs
print("Calling simulation with inputs: [800000.0, 150000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [925000.0, 150000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [1050000.0, 150000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [1175000.0, 150000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [1300000.0, 150000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [800000.0, 200000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [925000.0, 200000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [1050000.0, 200000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [1175000.0, 200000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [1300000.0, 200000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [800000.0, 250000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [925000.0, 250000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [1050000.0, 250000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [1175000.0, 250000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [1300000.0, 250000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [800000.0, 300000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [925000.0, 300000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [1050000.0, 300000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [1175000.0, 300000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [1300000.0, 300000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [800000.0, 350000.0]")
# Initial simulation status: True
print("Calling simulation with inputs: [925000.0, 350000.0]")
# Initial simulation status: True
```
--------------------------------
### IPOPT Wrapper in Python
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/installation.html
Demonstrates the use of cyipopt, a Python wrapper for the IPOPT library, facilitating nonlinear programming tasks.
```python
# Example usage of cyipopt (IPOPT wrapper)
# from cyipopt import minimize_ipopt
#
# def objective(x):
# return x[0]**2 + x[1]**2
#
# def constraint(x):
# return x[0] + x[1] - 1
#
# x0 = [0.5, 0.5]
# cons = [{'type': 'eq', 'fun': constraint}]
#
# result = minimize_ipopt(objective, x0, constraints=cons)
# print(result)
```
--------------------------------
### Set and Get Simulation Variables (Python)
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/examples_gallery/aps_connection.html
This snippet demonstrates how to set and get variable values within a simulation environment. It's used to configure membrane properties and retrieve process performance metrics like flow rates and purity. The `.Result` attribute suggests these operations are asynchronous or return a future.
```Python
vm.SetVariableValue(simName, "MDAC1.QCO2", u[0], "", ).Result
vm.SetVariableValue(simName, "MDAC2.QCO2", u[1], "", ).Result
Feed_flow = vm.GetVariableValue(simName, "Air_feed.F", "kmol/h").Result
Permeate = vm.GetVariableValue(simName, "Product.F", "kmol/h", ).Result
Purity = vm.GetVariableValue(simName, "Product.z[CO2]", "mol frac", ).Result
```
--------------------------------
### Opyrability Documentation Navigation and Setup
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/examples_gallery/membrane_reactor.html
This snippet shows the basic JavaScript setup for Opyrability's documentation, including theme switching, search functionality, and loading external libraries like Thebe for interactive code execution. It also includes navigation elements and links to related resources.
```javascript
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
let toggleHintShow = 'Click to show';
let toggleHintHide = 'Click to hide';
let toggleOpenOnPrint = 'true';
var togglebuttonSelector = '.toggle, .admonition.dropdown';
const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"
const thebe_selector = ".thebe,.cell"
const thebe_selector_input = "pre"
const thebe_selector_output = ".output, .cell_output"
window.MathJax = {"options": {"processHtmlClass": "tex2jax_process|mathjax_process|math|output_area"}}
DOCUMENTATION_OPTIONS.pagename = 'examples_gallery/membrane_reactor';
```
```javascript
document.write(``);
```
```javascript
document.write(` `);
document.write(` `);
```
--------------------------------
### Opyrability Initialization and Theme Settings
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/examples_gallery/APSandOpyrability.html
Initializes Opyrability documentation by setting the mode and theme from local storage and defines selectors for toggle buttons and Thebe integration. It also includes placeholders for dynamic image loading and search functionality.
```JavaScript
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
let toggleHintShow = 'Click to show';
let toggleHintHide = 'Click to hide';
let toggleOpenOnPrint = 'true';
var togglebuttonSelector = '.toggle, .admonition.dropdown';
const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js";
const thebe_selector = ".thebe,.cell";
const thebe_selector_input = "pre";
const thebe_selector_output = ".output, .cell_output"
document.write(``);
document.write(` `);
document.write(` `);
document.write(` `);
```
--------------------------------
### Multimodel Representation Study Setup
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/examples_gallery/APSandOpyrability.html
This section defines the bounds and resolution for a multimodel representation study. It then calls the `multimodel_rep` function with the simulation data and defined parameters.
```Python
AIS_bounds = np.array([[8e5, 1.3e6],[1.5e5, 3.5e5]]) #AIS bounds definition for the 2 inputs x 2 outputs case study
AIS_resolution = [5,5] #AIS discretization definition
AOS_reg = multimodel_rep(Multi, AIS_bounds, AIS_resolution) #Multimodel representation call
```
--------------------------------
### Python Operability Study Setup and Mapping
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/examples_gallery/APSandOpyrability.html
This Python code defines the input bounds and discretization for an operability study. It then calls a mapping function to relate the input conditions (CO2 permeance) to the output performance metrics (CO2 purity and recovery). The code also includes example calls to the simulation with specific input values.
```Python
# AIS bounds definition for the 2 inputs x 2 outputs case study
AIS_bounds = np.array([[3.35e-8, 6.7e-06], [3.35e-8, 6.7e-07]])
# AIS discretization definition for the 2 inputs x 2 outputs case study
AIS_resolution = [10, 10]
# Forward mapping call for the 2 inputs x 2 outputs case study
AIS, AOS = AIS2AOS_map(M, AIS_bounds, AIS_resolution)
# Calling simulation with inputs: [0. 0.]
# Initial simulation status: True
# Calling simulation with inputs: [3.35e-08, 3.35e-08]
# Initial simulation status: True
# ... (other simulation calls) ...
# Calling simulation with inputs: [6.7e-06, 1.0422222222222223e-07]
# Initial simulation status: True
# Calling simulation with inputs: [3.35e-08, 1.7494444444444446e-07]
# Initial simulation status: False
# 3.35e-08 1.7494444444444446e-07 failed
# Calling simulation with inputs: [7.742222222222222e-07, 1.7494444444444446e-07]
# Initial simulation status: False
# 7.742222222222222e-07 1.7494444444444446e-07 failed
```
--------------------------------
### Project Configuration
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/examples_gallery/Unisim_Example.html
Configuration object for the opyrability project, specifying kernel requirements, binder repository details, and CodeMirror settings.
```JSON
{
"requestKernel": true,
"binderOptions": {
"repo": "CODES-group/opyrability",
"ref": "main"
},
"codeMirrorConfig": {
"theme": "abcdef",
"mode": "python"
},
"kernelOptions": {
"name": "python3",
"path": "./examples_gallery"
},
"predefinedOutput": true
}
```
--------------------------------
### Import Libraries and Initialize DWSIM
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/_sources/examples_gallery/dwsim_connection.ipynb
Imports necessary Python libraries and DWSIM DLLs for simulation. It also includes a placeholder for setting the DWSIM installation path.
```Python
# remove the following two lines to run on linux
import pythoncom
pythoncom.CoInitialize()
from opyrability import multimodel_rep, OI_eval, AIS2AOS_map
import numpy as np
import matplotlib.pyplot as plt
# Call DWSIM DLLs
import clr
# Set your DWSIM installation path
dwsimpath = "C:\\Users\[YourUser]\\AppData\\Local\\DWSIM\" # Update this path
clr.AddReference(dwsimpath + "\\CapeOpen.dll")
clr.AddReference(dwsimpath + "\\DWSIM.Automation.dll")
clr.AddReference(dwsimpath + "\\DWSIM.Interfaces.dll")
clr.AddReference(dwsimpath + "\\DWSIM.GlobalSettings.dll")
clr.AddReference(dwsimpath + "\\DWSIM.SharedClasses.dll")
clr.AddReference(dwsimpath + "\\DWSIM.Thermodynamics.dll")
clr.AddReference(dwsimpath + "\\DWSIM.UnitOperations.dll")
clr.AddReference(dwsimpath + "\\DWSIM.Inspector.dll")
clr.AddReference(dwsimpath + "\\System.Buffers.dll")
clr.AddReference(dwsimpath + "\\DWSIM.Thermodynamics.ThermoC.dll")
```
--------------------------------
### Establishing APS Connection and Getting Services
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/examples_gallery/aps_connection.html
Establishes a connection to APS and retrieves essential services like SimulationManager, VariableManager, and SnapshotManager. These services are crucial for interacting with the simulation environment.
```Python
# Instantiating the required interfaces for the scripting interface
sc = simcentralconnect.connect().Result
sm = sc.GetService("ISimulationManager")
vm = sc.GetService("IVariableManager")
snap = sc.GetService("ISnapshotManager")
```
--------------------------------
### Establish APS Connection and Get Services
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/examples_gallery/APSandOpyrability.html
Establishes a connection to the APS simulation environment and retrieves essential services like SimulationManager, VariableManager, and SnapshotManager. These services are crucial for interacting with and controlling the simulation.
```Python
sc = simcentralconnect.connect().Result
sm = sc.GetService("ISimulationManager")
vm = sc.GetService("IVariableManager")
snap = sc.GetService("ISnapshotManager")
```
--------------------------------
### Initialize UniSim and Open Simulation Case
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/examples_gallery/Unisim_Example.html
This Python script initializes the UniSimĀ® Design application using COM automation and opens a specified simulation case. It requires the `pywin32` library. Ensure the directory path and simulation case name are updated to match your environment.
```Python
# UniSim Initialization
unis = win32.Dispatch('UniSimDesign.Application')
arq = 'C:/Users/ulyss/Desktop/PhD/Plant_Simulation/' #Update to your directory path
Case = unis.SimulationCases.Open(arq + 'ASU - Example.usc') #Update with your simulation name
Case.Visible = 1
```
--------------------------------
### Opyrability Documentation Setup
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/examples_gallery/unisim_connection.html
Configuration for Opyrability documentation, including theme settings, toggle hints, and Thebe integration for live code execution.
```JavaScript
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
let toggleHintShow = 'Click to show';
let toggleHintHide = 'Click to hide';
let toggleOpenOnPrint = 'true';
var togglebuttonSelector = '.toggle, .admonition.dropdown';
const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js";
const thebe_selector = ".thebe,.cell";
const thebe_selector_input = "pre";
const thebe_selector_output = ".output, .cell_output";
DOCUMENTATION_OPTIONS.pagename = 'examples_gallery/unisim_connection';
```
--------------------------------
### Opyrability Initialization and Thebe Configuration
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/examples_gallery/aps_connection.html
Initializes Opyrability documentation settings, including theme management and Thebe integration for live code execution. It sets up selectors for Thebe components and defines the page name for documentation options.
```JavaScript
document.documentElement.dataset.mode = localStorage.getItem("mode") || "";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "";
let toggleHintShow = 'Click to show';
let toggleHintHide = 'Click to hide';
let toggleOpenOnPrint = 'true';
var togglebuttonSelector = '.toggle, .admonition.dropdown';
const THEBE_JS_URL = "https://unpkg.com/thebe@0.8.2/lib/index.js"
const thebe_selector = ".thebe,.cell"
const thebe_selector_input = "pre"
const thebe_selector_output = ".output, .cell_output"
DOCUMENTATION_OPTIONS.pagename = 'examples_gallery/aps_connection';
```
--------------------------------
### Import Libraries and Initialize DWSIM
Source: https://github.com/codes-group/opyrability/blob/main/docs/examples_gallery/dwsim_connection.ipynb
Imports necessary Python libraries and DWSIM DLLs for simulation. It also includes a placeholder for setting the DWSIM installation path.
```Python
# remove the following two lines to run on linux
import pythoncom
pythoncom.CoInitialize()
from opyrability import multimodel_rep, OI_eval, AIS2AOS_map
import numpy as np
import matplotlib.pyplot as plt
# Call DWSIM DLLs
import clr
# Set your DWSIM installation path
dwsimpath = "C:\\Users\[YourUser]\\AppData\\Local\\DWSIM\" # Update this path
clr.AddReference(dwsimpath + "\\CapeOpen.dll")
clr.AddReference(dwsimpath + "\\DWSIM.Automation.dll")
clr.AddReference(dwsimpath + "\\DWSIM.Interfaces.dll")
clr.AddReference(dwsimpath + "\\DWSIM.GlobalSettings.dll")
clr.AddReference(dwsimpath + "\\DWSIM.SharedClasses.dll")
clr.AddReference(dwsimpath + "\\DWSIM.Thermodynamics.dll")
clr.AddReference(dwsimpath + "\\DWSIM.UnitOperations.dll")
clr.AddReference(dwsimpath + "\\DWSIM.Inspector.dll")
clr.AddReference(dwsimpath + "\\System.Buffers.dll")
clr.AddReference(dwsimpath + "\\DWSIM.Thermodynamics.ThermoC.dll")
```
--------------------------------
### Import Libraries and Initialize DWSIM
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/jupyter_execute/examples_gallery/dwsim_connection.ipynb
Imports necessary Python libraries and DWSIM DLLs for simulation. It also includes a placeholder for setting the DWSIM installation path.
```Python
# remove the following two lines to run on linux
import pythoncom
pythoncom.CoInitialize()
from opyrability import multimodel_rep, OI_eval, AIS2AOS_map
import numpy as np
import matplotlib.pyplot as plt
# Call DWSIM DLLs
import clr
# Set your DWSIM installation path
dwsimpath = "C:\\Users\[YourUser]\\AppData\\Local\\DWSIM\" # Update this path
clr.AddReference(dwsimpath + "\\CapeOpen.dll")
clr.AddReference(dwsimpath + "\\DWSIM.Automation.dll")
clr.AddReference(dwsimpath + "\\DWSIM.Interfaces.dll")
clr.AddReference(dwsimpath + "\\DWSIM.GlobalSettings.dll")
clr.AddReference(dwsimpath + "\\DWSIM.SharedClasses.dll")
clr.AddReference(dwsimpath + "\\DWSIM.Thermodynamics.dll")
clr.AddReference(dwsimpath + "\\DWSIM.UnitOperations.dll")
clr.AddReference(dwsimpath + "\\DWSIM.Inspector.dll")
clr.AddReference(dwsimpath + "\\System.Buffers.dll")
clr.AddReference(dwsimpath + "\\DWSIM.Thermodynamics.ThermoC.dll")
```
--------------------------------
### Install Opyrability with Conda (Linux/macOS)
Source: https://github.com/codes-group/opyrability/blob/main/docs/installation.md
Installs opyrability and all its requirements using conda on Linux and macOS systems. This command installs from the codes-group and conda-forge channels.
```console
conda install -c codes-group -c conda-forge opyrability
```
--------------------------------
### Install Opyrability with Conda (Linux/macOS)
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/_sources/installation.md
Installs opyrability and all its requirements using conda on Linux and macOS systems. This command installs from the codes-group and conda-forge channels.
```console
conda install -c codes-group -c conda-forge opyrability
```
--------------------------------
### Using Opyrability in Google Colab
Source: https://github.com/codes-group/opyrability/blob/main/docs/_build/html/installation.html
Guidance on how to set up and use the Opyrability library within a Google Colab environment.
```python
import sys
!{sys.executable} -m pip install opyrability
# Example usage (assuming IPOPT is also installed or available)
# from opyrability import OpyrabilitySolver
# solver = OpyrabilitySolver()
# ... solver setup and solve ...
```