A Python library for Pulp and Paper manufacturing processes, based on BREF (Best Available Techniques) standards.
Project description
PapAiEra
PapAiEra is a specialized Python library engineered for the Pulp and Paper industry. It mathematically models and solves optimization problems based on the Best Available Techniques (BAT) reference documents (EU BREF 2015).
Included Processes & Modules
The library covers a massive array of metrics across the entire pulp and paper production cycle.
1. Pulping Modules (pap_ai_era.pulping)
- Kraft (
kraft.py): H-factor calculation, Digester Mass Balance, Kappa numbers, recovery efficiency, black liquor solids, yield, BAT compliance. - Sulphite (
sulphite.py): Yields for paper/dissolving grades, SO2 and Mg/Ca base recovery. - Mechanical (
mechanical.py): Energy intensity of SGW, PGW, TMP, and CTMP, heat recovery. - Recycled Fibre (
recycled.py): Deinking yield, fiber loss, rejects rates. - Non-Wood (
non_wood.py): Depithing efficiency, silica load checks (crucial for bagasse). - Bleaching (
bleaching.py): O2 delignification drops, wash press carry-over, AOX generation. - Recovery Cycle (
recovery_cycle.py): Causticizing efficiency, evaporator steam economy, lime kiln energy.
2. Papermaking Modules (pap_ai_era.papermaking)
- Machine Operations (
machine.py): Paper machine fiber mass balance, OEE, broke tracking, wire retention, dryer section economy. - Wet End Chemistry (
wet_end_chemistry.py): Furnish-based dosing heuristics, physical GPL to LPH pump conversion algorithms, ash retention. - Coating/Finishing (
coating.py): Colour recovery, ultrafiltration efficiency, specific water usage. - Coating/Finishing (
coating.py): Colour recovery, ultrafiltration efficiency, specific water usage.
3. Sustainability (pap_ai_era.sustainability)
- Emissions (
emissions.py,air_emissions.py): BOD/COD/TSS load to water. TRS, SO2, NOx, Dust to air. - Wastewater & Water (
wastewater.py,water_energy.py): Loop closure, explicit cooling-water vs contaminated-water accounting. - Management (EMS): ISO 14001 grading, solid waste footprint (Ash + Sludge + Rejects).
4. Mathematical AI Solvers (pap_ai_era.optimization_models)
Allows for non-linear optimization using SciPy constraints to determine optimal dosing/setpoints.
optimize_batch_kraft_digester()optimize_continuous_kamyr_digester()optimize_bleaching_sequence_cost()optimize_sulphite_base_recovery()
Basic Usage
The library is organized into discrete processes. You can import individual functions to check Key Performance Indicators (KPIs):
from pap_ai_era.pulping.kraft import pulping_yield
from pap_ai_era.papermaking.machine import machine_oee
oee = machine_oee(availability=0.95, performance=0.98, quality=0.99)
print(f"Machine OEE is: {oee:.2f}%")
Example Problem: The Continuous Digester Bottleneck
The Scenario: A mill utilizing a Kamyr continuous digester needs to hit a specific Kappa number (e.g., Target Kappa 16.0). However, operators are using an excessively high Liquor-to-Wood (L/W) ratio. This means they are pushing too much water through the digester, forcing the evaporators in the recovery boiler cycle to burn thousands of dollars of excessive steam just to boil that water away later.
The Goal: Find the lowest Effective Alkali (%) and optimal cook temperature to hit the Target Kappa while mathematically penalizing the Liquor-to-Wood ratio to save evaporator steam costs.
Code Implementation
from pap_ai_era.optimization_models import optimize_continuous_kamyr_digester
result = optimize_continuous_kamyr_digester(
target_kappa=16.0,
liquor_to_wood_ratio_cost_penalty=5.0
)
if result["success"]:
print(f"Optimal Effective Alkali: {result['optimal_EA']:.2f}%")
print(f"Optimal Liquor/Wood Ratio: {result['optimal_LW_ratio']:.2f}")
print(f"Optimal Cook Temperature: {result['cook_temp']:.2f} °C")
Conclusion
By treating the pulping sequence not just as isolated silos but as a continuous mathematical system, PapAiEra allows process engineers to see how turning a dial in the Digester affects the steam budget in the Recovery Boiler.
Troubleshooting Guide
1. Optimization returns success: False
- Cause: Your
target_kappaortarget_brightnessis physically impossible given the bounding constraints (e.g., trying to achieve 90 ISO Brightness with only 5 kg/t of ClO2). - Solution: Check the boundaries defined in
optimization_models.py. Ensure your targets are realistic for the fibre type.
2. Import Errors (ModuleNotFoundError)
- Cause: Python cannot find the package.
- Solution: Ensure you are working in the active virtual environment where the package was installed, or run
pip install PapAiEraglobally.
3. Math Errors (Division by Zero)
- Cause: Passing
total_production = 0to efficiency equations. - Solution: The functions have built-in zero-division catches, but ensure you stream clean, non-zero denominator readings from your DCS historians.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file papaiera-0.1.5.tar.gz.
File metadata
- Download URL: papaiera-0.1.5.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
046b88ff264c30bc0f687e2ee1dc9084ea37496444c2df1bec17531cfbb83f6b
|
|
| MD5 |
5507429b0213c09ae6085ac5da5a0c93
|
|
| BLAKE2b-256 |
cd2c2ea1a7cfd1c2e625635fbb6fc1f8d68f9977af92975ad82eb12c663c709c
|
File details
Details for the file papaiera-0.1.5-py3-none-any.whl.
File metadata
- Download URL: papaiera-0.1.5-py3-none-any.whl
- Upload date:
- Size: 23.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
260e0ccac1a4641b359af63241b09da9bf5a30eb6bb3193bcf752a0a9da822a3
|
|
| MD5 |
79d48520803b6bb3c46ff4b5de6a6d4a
|
|
| BLAKE2b-256 |
e50238761fbdc63e940d2b815b864da182c4d02511ffde4b652a27b42b01d4d6
|