Skip to content

Examples

Below are examples that run on a file simulating 4-isobutylacetophenone production.

Printing properties of objects present on the flowsheet

Script

Output
Column:
SAD (HYSYS Distillation)
{'SAD_Solvent': SAD_Solvent (HYSYS Material Stream), 'S-112': S-112 (HYSYS Material Stream)}

-> Compressor:
K-100 (HYSYS Compressor)
Raw HF Feed (HYSYS Material Stream)
S-110 (HYSYS Material Stream)
Q-K100 (HYSYS Named Object)

-> Pump:
P-102 (HYSYS Pump)
Raw AA Feed (HYSYS Material Stream)
S-106 (HYSYS Material Stream)
Q-P102 (HYSYS Named Object)

-> Valve:
VLV-100 (HYSYS Valve)
FCA_Ex_Bottoms (HYSYS Material Stream)
S-113 (HYSYS Material Stream)

-> Recycle:
RCY-1 (HYSYS Recycle)
HF_Recycle-2 (HYSYS Material Stream)
HF_Guess (HYSYS Material Stream)
PFDs=('PFD 1',) (HYSYS Dictionary)
(HYSYS Object)
{'Centre', 'name', 'Invoke', 'Items', 'Release', 'GetTypeInfo', 'QueryInterface', 'GetIDsOfNames', 'Application', 'GetTypeInfoCount', 'MoveBy', 'Parent', 'IsValid', 'AddRef', 'Extent', 'ExportSvg'}
(HYSYS Object)

Time taken for ./examples/test.py: 0.875s

Listing all unit operations

Script

Output
Unit operation names:
pumpop: P-100, P-103, P-101, P-105, P-104, P-106, P-102
valveop: VLV-100, VLV-101, VLV-102
mixerop: MIX-103, MIX-102, MIX-100, MIX-101
teeop: TEE-102, TEE-101, TEE-100
distillation: Oxylene_DC, SAD, iBAP DC, nBB DC
streamcutterop: Cutter-1
adjust: ADJ-1
recycle: RCY-3, RCY-1, RCY-2
setop: SET-1, SET-3, SET-7, SET-5, SET-8, SET-10, SET-6, SET-4, SET-2, SET-9
conversionreactorop: CRV-100
fractop: X-101
compressor: K-100
heatexop: HX-1, HX-6, HX-5, HX-3, HX-8, HX-2, HX-11, HX-10, HX-9, HX-4, HX-7, HX-12, HX-13

Time taken for ./examples/unitop_names.py: 0.340s

Validating common stream and unit operation properties

Script

Output
Assertions failed:
-> The following streams have backflow:
-> The following streams are mixed-phase:
S-117 (0.015740653415418526)
-> The following column feeds are entering below tray pressure:
-> The following heaters have a temperature decrease:
-> The following coolers have a temperature increase:
-> The following pumps have non-positive duties:
-> The following pumps are privy to cavitation:
-> The following valves have non-positive pressure drops:

Flags raised:
-> The following streams have no flow:
No Vap Out (0.0)

Time taken for ./examples/simcase_validity.py: 3.986s

Flagging out heat exchanger temperature difference violations

Script

Output
-> Heat exchanger names:
['HX-1', 'HX-2', 'HX-3', 'HX-4', 'HX-5', 'HX-6', 'HX-7', 'HX-8', 'HX-9', 'HX-10', 'HX-11', 'HX-12', 'HX-13']

-> Heat exchanger data:
     Name        Duty    Hot stream in  ...     T_c,in    T_c,out       CP_c
0    HX-1    0.001840            S-107  ...  55.000000  55.011491   0.160112
1    HX-2    3.847337           S-122a  ...  31.816451  52.318724   0.183714
2    HX-3    4.684739           S-123b  ...  10.000000  15.000000   0.935256
3    HX-4    0.267627  iBAP_DC_Bottoms  ...  40.832477  60.000000   0.028875
4    HX-5    8.177283            S-117  ...  25.157351  60.000000   0.224818
5    HX-6    6.184702            S-118  ...  40.000000  52.367624   0.509054
6    HX-7    1.243681            S-119  ...  25.000000  31.816451   0.181212
7    HX-8   90.600468            S-120  ...  30.000000  33.740000  24.181472
8    HX-9    5.753061            S-110  ...  39.806632  40.042194  24.419687
9   HX-10   34.360067            S-102  ...  38.398525  39.806632  24.383589
10  HX-11   13.046271            S-111  ...  37.863335  38.398525  24.370037
11  HX-12  100.274960  Recycle_Solvent  ...  33.740000  37.863335  24.268710
12  HX-13    1.951437           S-123a  ...   7.911999  10.000000   0.933907

[13 rows x 13 columns]

-> Minimum temperature diff. violations:
   Name  T_h,in    T_c,out    T_h,out     T_c,in
0  HX-1    60.0  55.011491  59.992489  55.000000
1  HX-2    55.0  52.318724  35.270000  31.816451

Time taken for ./examples/pinch_violations.py: 4.551s

Single feed optimisation of distillation columns

Scripts

Step 1:
✅ All required imports have been successfully imported.

Step 2:
1. Column: nBB DC-2, Feed: S-100-2, Bounds: (38, 73)
2. Column: Oxylene_DC-2, Feed: S-115-2, Bounds: (8, 32)
3. Column: iBAP DC-2, Feed: S-116-3, Bounds: (4, 18)
4. Column: SAD-2, Feed: S-114-2, Bounds: (3, 9)
Please enter the desired column profile: 1

Column: nBB DC-2, Feed: S-100-2, Bounds: (38, 73)
Is this the column profile you wish to continue with? [y/N]: y
✅ Column profile chosen: '1'

Step 3:
✅ Running HYSYS Case: C:\Users\Hari\OneDrive\Documents\Development\Python\aspen-pysys\examples\Team_10.hsc

Step 4:
✅ All unit operations required for optimisation are valid!
Column: nBB DC-2
✅ Design variable bounds have been set!
Stage count: 38 -> 73

Step 4:
Stage count=73: 100%|███████████████████████████████████████████| 36/36 [09:39<00:00, 16.10s/it]
✅ Condenser and reboiler duty data has been exported to 'C:\Users\Hari\OneDrive\Documents\Development\Python\aspen-pysys\examples\single-feed-col-opt\Team_10.csv'!

Step 5:
C:\Users\Hari\OneDrive\Documents\Development\Python\aspen-pysys\examples\single-feed-col-opt\collect.py:244: UserWarning: The figure layout has changed to tight
  plt.tight_layout()