脱气塔设计工具

一款基于Perry手册和PHREEQC地球化学模型的空气脱气塔设计工具,适用于H₂S、CO₂去除和VOC处理等场景。

  • by puran-water
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 puran-water/degasser-design-mcp

使用说明

脱气/汽提塔设计MCP服务器

气提塔设计工具实现了Perry手册与PHREEQC地球化学形态的相关性。

⚠️ 开发状态:该项目正在积极开发中,尚未投入生产。API、接口和功能可能会更改,恕不另行通知。请自行承担风险,仅用于评估和测试目的。不建议用于生产部署。

实施状态

第1层:启发式规模确定(完整)

  • 佩里手册相关性(埃克特GPDC、HTU/NTU方法)
  • PHREEQC集成用于pH依赖性物种形成
  • 填充床的罗宾斯压降相关性
  • 鼓风机选型和功率计算
  • 佩里表14-13中的9种标准包装
  • 执行时间:<1秒

第2层:分段柱模拟(完成✅)

  • PHREEQC平衡级计算
  • 单相Murphree效率逆流(气相)
  • 守恒方程的质量平衡(液相)
  • 质量平衡关闭:<5%(VOC、CO2),<25%(H2S)
  • N<50个阶段收敛稳定(200次迭代限制,2%容差)
  • pH耦合物种形成与水化学整合
  • 执行时间:10-30秒

第3级:WaterTAP经济成本(完整)✅)

  • 来自上游图书馆的已验证成本相关性
    • 鼓风机:QSDsan(qsdsan.equipments._aeration.Blower)
    • 容器水TAP(watertap.costing.unit_models.cstr)
    • 包装和内部构件:行业标准值
  • 经济指标:净现值、LCOW、投资回收期
  • CEPCI成本上升至2025年
  • 完整的来源文件
  • 执行时间:<5秒

技术概述

服务器计算空气汽提应用的填料塔尺寸,考虑pH依赖的水形态。对于弱酸(H₂S, CO₂),只有中性分子形式是可剥离的,而离子物种留在溶液中。

pH依赖性物种

H₂S系统(pKa₁ = 7.0):

  • pH 6.0:α₀ = 0.896 (89.6%小时₂S、 10.4%小时⁻)
  • pH 7.0:α₀ = 0.500 (50%小时₂S、 50%小时⁻)
  • pH 8.0:α₀ = 0.091 (9.1%小时₂S、 90.9%HS⁻)

CO₂ 系统(pKa₁ = 6.35):

  • pH 6.0:α₀ = 0.688 (68.8%钴₂,31.2%碳氢化合物₃⁻)
  • pH 7.0:α₀ = 0.184 (18.4%)₂,碳氢化合物81.6%₃⁻)
  • pH 8.0:α₀ = 0.022 (2.2%钴₂,97.8%碳氢化合物₃⁻)

可剥离分数α₀ 使用PHREEQC平衡模型计算并应用于有效亨利常数。

应用程序

  • H₂S移除:地下水处理、气味控制。需要pH<6.5才能有效剥离。
  • CO₂ 剥离:反渗透预处理,降低碱度。需要pH<5.5才能实现>90%的转化率。
  • VOC去除地下水修复(TCE、PCE)。中性化合物的pH值无关。

快速开始

安装

# Clone repository
cd /mnt/c/Users/hvksh/mcp-servers/degasser-design-mcp

# Activate virtual environment (Python 3.12)
source ../venv312/bin/activate  # Linux/WSL
# OR
..\venv312\Scripts\activate  # Windows

# Install dependencies
pip install -r requirements.txt

# Run tests
pytest tests/ -v

MCP服务器配置

添加到您的MCP设置中(例如,Claude Desktop配置):

{
  "mcpServers": {
    "degasser-design-mcp": {
      "command": "/mnt/c/Users/hvksh/mcp-servers/venv312/Scripts/python.exe",
      "args": ["-m", "server"],
      "cwd": "/mnt/c/Users/hvksh/mcp-servers/degasser-design-mcp",
      "env": {}
    }
  }
}

可用的MCP工具

1. heuristic_sizing -快速塔架设计(<1s)

使用Perry手册的相关性确定填料塔空气汽提塔的尺寸。

输入参数:

{
  "application": "H2S",              # "H2S", "CO2", "VOC", or "general"
  "water_flow_rate_m3_h": 60.0,     # m³/h
  "inlet_concentration_mg_L": 32.0, # mg/L
  "outlet_concentration_mg_L": 0.05,# mg/L
  "air_water_ratio": 34.0,          # Volumetric ratio
  "temperature_c": 25.0,            # °C
  "water_ph": 6.0,                  # Required for H2S/CO2
  "packing_id": "Plastic_Pall_Rings_25mm"  # Optional
}

输出(不包括鼓风机尺寸):

{
  "tower_diameter_m": 2.12,
  "tower_height_m": 4.94,
  "packing_height_m": 4.44,
  "packing_name": "Plastic Pall Rings",
  "packing_size_mm": 25.0,
  "design_velocity_m_s": 0.161,
  "flooding_velocity_m_s": 0.230,
  "ntu": 7.96,
  "htu_m": 0.465,
  "lambda_factor": 13.94,
  "removal_efficiency_percent": 99.97,
  "air_flow_rate_m3_h": 2040.0
}

输出(带鼓风机尺寸- include_blower_sizing=True):

{
  "tower_diameter_m": 2.12,
  "tower_height_m": 4.94,
  "packing_height_m": 4.44,
  "packing_name": "Plastic Pall Rings",
  "packing_size_mm": 25.0,
  "design_velocity_m_s": 0.161,
  "flooding_velocity_m_s": 0.230,
  "ntu": 7.96,
  "htu_m": 0.465,
  "lambda_factor": 13.94,
  "removal_efficiency_percent": 99.97,
  "air_flow_rate_m3_h": 2040.0,

  "blower_specs": {
    // Pressure Drop Breakdown
    "packed_bed_pressure_drop_pa": 1823.4,
    "inlet_distributor_pressure_drop_pa": 249.1,
    "outlet_distributor_pressure_drop_pa": 249.1,
    "demister_pressure_drop_pa": 373.6,
    "momentum_losses_pa": 87.3,
    "ductwork_silencer_pressure_drop_pa": 182.3,
    "elevation_head_pa": 58.2,
    "safety_factor_pa": 362.2,
    "total_system_pressure_drop_pa": 3385.2,
    "total_system_pressure_drop_inches_h2o": 13.59,
    "total_system_pressure_drop_psig": 0.49,

    // Blower Selection
    "blower_type": "Multistage Centrifugal",
    "thermodynamic_model": "Isothermal",
    "compression_ratio": 1.033,
    "discharge_pressure_pa": 104710.2,
    "discharge_pressure_psig": 0.49,

    // Temperatures
    "inlet_temperature_c": 25.0,
    "discharge_temperature_c": 25.0,

    // Power Requirements
    "shaft_power_kw": 10.2,
    "motor_power_kw": 11.1,
    "motor_power_hp": 14.9,

    // Efficiencies
    "blower_efficiency": 0.70,
    "motor_efficiency": 0.92
  }
}

示例用法:

# Via MCP tool call
result = await mcp__degasser_design_mcp__heuristic_sizing(
    application="H2S",
    water_flow_rate_m3_h=60.0,
    inlet_concentration_mg_L=32.0,
    outlet_concentration_mg_L=0.05,
    air_water_ratio=34.0,
    water_ph=6.0,
    packing_id="Plastic_Pall_Rings_25mm"
)

2. combined_simulation_mcp -一级+可选二级+可选三级

运行快速启发式规模计算(第1层),可选择继续进行严格的PHREEQC模拟(第2层),并可选择计算经济成本(第3层)。

输入参数:

{
  "application": "H2S",
  "water_flow_rate_m3_h": 50.0,
  "inlet_concentration_mg_L": 30.0,
  "outlet_concentration_mg_L": 0.5,
  "air_water_ratio": 40.0,
  "temperature_c": 25.0,
  "water_ph": 6.0,
  "run_tier2": true,                    # Set to true for Tier 2 simulation
  "num_stages_initial": 20,             # Fixed stage count (or None for auto-find)
  "find_optimal_stages": false,         # If true, uses bisection to find optimal N
  "run_tier3": true,                    # Set to true for economic costing
  "packing_type": "plastic_pall"        # Packing material: plastic_pall, ceramic_raschig, etc.
}

输出(第2层和第3层):

{
  "request": {...},                      # Echo of input parameters
  "result": {...},                       # Tier 1 results (tower dimensions, blower)
  "tier2": {
    "tower_height_m": 22.6,
    "theoretical_stages": 20,
    "HETP_m": 1.13,
    "stage_profiles": {
      "liquid_conc_mg_L": [...],        # Concentration profile (N+1 points)
      "gas_conc_ppm": [...],
      "pH": [...],                       # pH profile showing drift
      "alpha_0": [...]                   # Strippable fraction at each stage
    },
    "convergence_info": {
      "inner_iterations": 98,
      "converged": true,
      "mass_balance": {
        "mass_in_mg_h": 1500000.0,
        "mass_out_water_mg_h": 461985.2,
        "mass_stripped_mg_h": 1148197.9,
        "error_fraction": 0.073,         # 7.3% error
        "passed": "True"
      }
    }
  },
  "tier3": {
    "capital_costs": {
      "air_blower_system": 150000,
      "packed_tower_shell": 13909,
      "packing_media": 934,
      "tower_internals": 1396
    },
    "operating_costs": {
      "blower_electricity": 261,         # USD/year
      "packing_replacement": 47          # USD/year
    },
    "total_capex": 166238,               # Total capital expenditure
    "total_annual_opex": 307,            # Total annual operating cost
    "economic_metrics": {
      "npv_usd": -169313,                # Net present value (30 years)
      "lcow_usd_per_m3": 0.086,          # Levelized cost of water
      "lcow_usd_per_1000gal": 0.325,     # Levelized cost per 1000 gallons
      "payback_years": 541,              # Simple payback period
      "annualized_total_cost_usd_per_year": 16920,
      "capital_recovery_factor": 0.0999,
      "annual_water_production_m3": 197100
    },
    "cost_breakdown_pct": {
      "air_blower_system": 90.2,         # Blower dominates CAPEX
      "packed_tower_shell": 8.4,
      "packing_media": 0.6,
      "tower_internals": 0.8
    }
  }
}

3. list_available_packings -查询包装目录

列出所有可用的包装及其规格。

输出:

{
  "packings": [
    {
      "packing_id": "Plastic_Pall_Rings_25mm",
      "name": "Plastic Pall Rings",
      "material": "Plastic",
      "nominal_size_mm": 25.0,
      "packing_factor_m_inv": 180.0,
      "surface_area_m2_m3": 206.0,
      "void_fraction": 0.90
    },
    ...
  ],
  "count": 9
}

设计方法论

1.形态计算

PHREEQC计算pH依赖系统的平衡形态:

# PHREEQC solution definition
solution = pp.add_solution({'pH': 6.0, 'temp': 25.0, 'S(-2)': 32.0})

# Calculate strippable fraction
α₀ = solution.species_molalities['H2S'] / solution.total_element('S', units='mol')

注: total_element() 需要 units='mol' 以避免单位与物种摩尔数(mol/kgw)不匹配。

2.塔高计算

剥离系数 (佩里方程式14-16):

λ = H_eff × (G/L)    where H_eff = H × α₀

传热单元数 (佩里方程式14-19,科尔伯恩):

NOG = ln[(Cin/Cout - 1/λ) / (1 - 1/λ)] / ln(λ)

包装高度 (佩里方程式14-15):

Z = NOG × HOG × 1.2    (20% safety factor)

来自经验相关性或供应商数据的HTU值(典型值:0.3-1.0 m)

3.塔架直径(Eckert GPDC)

洪水流速 (佩里方程式14-142):

uflood = Csf × √[(ρL - ρG)/ρG] × √(ε/Fp)

其中,基于流量参数FLG=(L/G)√(ρG/ρL)的Eckert图(图14-55)中的Csf

设计条件:

  • 运行速度:洪水的70%
  • 塔径:D=√(4QG/(π×设计))

4.压降和鼓风机尺寸

填充床 (罗宾斯相关性,佩里方程14-145):

ΔP_packed = Robbins(L, G, rhol, rhog, mul, H, Fpd)  # fluids library

系统组件:

  • 填充床(占总数的50-60%)
  • 分配器:1.0英寸高₂O每个(入口/出口)
  • 除雾器:1.5英寸高₂O
  • 动量损失、管道系统、高程水头
  • 总系统ΔP×1.12安全系数

鼓风机选择:

β 压力 类型 型号 η
≤1.2 ≤3psig 离心 等温 70%
1.2-1.5 3-7psig 旋转叶片 多变性 65%
>1.5 >7 psig 压缩机 绝热 75%

功率计算:

  • 等温(β≤1.2):W=P₁Q·ln(P₂/P₁)/η
  • 多变性(1.2<β≤1.5):从效率角度使用多变性指数n
  • 绝热(β>1.5):γ=1.4的标准绝热压缩

电机尺寸包括92%的电机效率。供应商数据应用于最终设计。


设计工具选择

第1层:启发式规模确定

用于:初步设计,筛选备选方案 局限性:

  • 假设整个塔的pH值恒定
  • pH值大于7.0时,H可能会低估身高50-200%₂S/CO₂
  • 不适合投标准备

发出警告时:

  • H的pH值≥7.0₂S或CO₂ 应用
  • 空气/水比<15(驱动力弱)
  • 碱度>500 mg/L碳酸钙₃

第2层:分阶段模拟(完成✅)

用于:pH值影响显著时的最终设计 特性:

  • 逐级pH值和浓度分布
  • 具有自适应Murphree效率的逆流流动
  • PHREEQC各阶段平衡
  • 水化学集成(RO MCP兼容)

演出:

  • VOC:质量平衡误差<10%(生产就绪)
  • 二氧化碳:质量平衡误差<5%(支持pH 4-8)
  • H2S:质量平衡误差<25%(工程设计可接受)
  • 收敛稳定到50个阶段,迭代限制为200次
  • 所有应用都验证了正确的剥离方向

第3级:经济成本(完整)✅)

用于:成本估算、包装比较、经济优化 特性:

  • 设备资本支出:鼓风机系统、塔壳、填料、内部构件
  • 年度运营成本:电力、包装更换
  • 经济指标:净现值、LCOW、投资回收期
  • 验证了与完整来源的成本相关性
  • CEPCI成本上涨至2025美元

成本相关性:

  • 鼓风机:QSDsan(qsdsan.equipments._aeration.Blower)-三层尺寸
  • 船舶:WaterTAP(watertap.costing.unit_models.cstr.cost_cstr)
  • 包装:行业标准值,CEPCI升级
  • 内部:分配器、除雾器、支撑格栅

包装目录

佩里手册表14-13中的9种标准包装:

包装 材料 尺寸(mm) Fp(m⁻¹) 表面积(m²/m³) 空隙率
塑料鲍尔环 塑料 25 180 206 0.90
塑料鲍尔环 塑料 50 85 102 0.92
金属鲍尔环 金属 25 220 220 0.75
金属鲍尔环 金属 38 164 164 0.78
金属鲍尔环 金属 50 121 121 0.78
陶瓷Intalox鞍座 陶瓷 25 256 302 0.73
陶瓷Intalox鞍座 陶瓷 50 118 131 0.76
陶瓷拉西环 陶瓷 25 190 587 0.74
陶瓷拉西环 陶瓷 50 92 213 0.74

选择指南:

  • H₂S/CO₂:使用塑料或陶瓷(耐腐蚀)
  • 挥发性有机化合物:通常首选塑料包装
  • 较小的填料(25mm):HTU更低(效率更高),直径更大,成本更高
  • 更大的包装(50mm):HTU更高,直径更小,成本更低

验证

测试覆盖率:58项测试通过

  • Perry的TCE基准(38→0.00151 mg/L):在手册的5%以内
  • H的PHREEQC物种形成₂S和CO₂:在pH 5-9范围内验证
  • 罗宾斯压降:与流体库相比误差<1%
  • 鼓风机功率计算:根据热力学模型进行验证
  • 所有应用的二级质量平衡和物理验证
  • 三层(小型/中型/大型)鼓风机成本验证

建筑

三层设计:

  1. 第1级:Perry与PHREEQC物种形成的相关性(完整✅)
  2. 第2层:平衡阶段模拟(完成✅)
  3. 第3层:WaterTAP经济成本计算(完整✅)

目录结构

degasser-design-mcp/
├── .mcp.json                    # MCP server configuration
├── README.md                    # This file
├── REMAINING_IMPLEMENTATION_PLAN.md  # Detailed roadmap for Phases 2-3
├── server.py                    # FastMCP server implementation ✓
├── requirements.txt             # Python dependencies ✓
├── .env.example                 # Environment variable template ✓
├── .gitignore                   # Git ignore rules ✓
├── tools/                       # MCP tool implementations
│   ├── __init__.py              # ✓
│   ├── heuristic_sizing.py      # Tier 1 heuristic sizing ✓
│   ├── simulation_sizing.py     # Tier 2 PHREEQC staged simulation ✓
│   ├── watertap_costing.py      # Tier 3 WaterTAP economic costing ✓
│   └── schemas.py               # Pydantic validation models ✓
├── utils/                       # Utility modules
│   ├── __init__.py              # ✓
│   ├── tower_design.py          # Perry's correlations (diameter, height) ✓
│   ├── packing_properties.py    # Packing catalog interface ✓
│   ├── speciation.py            # PHREEQC pH-dependent speciation ✓
│   ├── henry_constants.py       # Henry's law database ✓
│   ├── helpers.py               # Eckert GPDC, HTU/NTU methods ✓
│   ├── pressure_drop.py         # Robbins correlation & accessory ΔP ✓
│   ├── blower_sizing.py         # Power calculations (fluids.compressible) ✓
│   ├── water_chemistry.py       # RO MCP-compatible water chemistry ✓
│   ├── economic_defaults.py     # CEPCI escalation, QSDsan imports ✓
│   ├── costing_parameters.py    # WaterTAP parameter blocks ✓
│   ├── degasser_costing_methods.py  # Equipment costing methods ✓
│   ├── import_helpers.py        # Dependency detection ✓
│   ├── job_manager.py           # Background job management for Tier 2/3 ✓
│   ├── tier2_cli.py             # CLI runner for Tier 2 PHREEQC simulation ✓
│   └── tier3_cli.py             # CLI runner for Tier 3 WaterTAP costing ✓
├── databases/                   # Design databases
│   ├── pack.json                # Packing specifications ✓
│   ├── henrys_law.db            # VOC Henry's constants ✓
│   ├── voc_phases.dat           # PHREEQC custom phases ✓
│   └── voc_properties.json      # VOC properties ✓
└── tests/                       # Unit and integration tests
    ├── test_tower_design.py     # Perry's benchmark validation ✓
    ├── test_voc_phases.py       # PHREEQC integration tests ✓
    ├── test_simulation_sizing.py # Tier 2 simulation tests ✓
    ├── test_blower_sizing.py    # Blower sizing and pressure drop tests ✓
    └── test_blower_costing_validation.py # Blower costing validation ✓

示例用法

# H₂S stripping at pH 6.0
result = await heuristic_sizing(
    application="H2S",
    water_flow_rate_m3_h=60.0,
    inlet_concentration_mg_L=32.0,
    outlet_concentration_mg_L=0.05,
    air_water_ratio=34.0,
    water_ph=6.0
)

# Results
# Tower: 2.12 m dia × 4.94 m height
# Packing: 4.44 m depth
# Air flow: 2,040 m³/h
# Strippable fraction at pH 6.0: 89.6%

注:在pH 6.0时,10.4%的硫化物仍为不可剥离的HS⁻. 将pH值降至5.5,去除率>95%。


参考文献

设计相关性

  1. 佩里化学工程师手册,第8版,第14节
  2. PHREEQC第3版(Parkhurst&Appelo,2013),美国地质调查局
  3. 热力学和压降流体库(CalebBell/流体)
  4. 罗宾斯,洛杉矶(1991),《化学工程进展》,87(5),87-91

经济成本核算

  1. QSDsan v1.4.2+-鼓风机设备成本-https://github.com/QSD-Group/QSDsan
  2. WaterTAP v0.15.0+-船舶成本计算框架-https://github.com/watertap-org/watertap
  3. BioSTEAM v2.x-CEPCI成本上涨指数-https://github.com/BioSTEAMDevelopmentGroup/biosteam

有关完整的成本来源文件,请参阅COSTING_REFERENCES.md

许可证

MIT许可证

联系

github:https://github.com/puran-water/degasser-design-mcp