DOI: 10.3303/CET25120088 Paper Received: 25 June 2025; Revised: 15 September 2025; Accepted: 27 September 2025 Please cite this article as: Kevin Lius A., Ng K.H., Mohd Yusoff N.H., Wan Y.K., Wong V.-L., 2025, Leveraging the P-Graph Framework for the Optimal Synthesis of Pharmaceutical Wastewater Treatment Solutions, Chemical Engineering Transactions, 120, 523-528 DOI:10.3303/CET25120088 CHEMICAL ENGINEERING TRANSACTIONS VOL. 120, 2025 A publication of The Italian Association of Chemical Engineering Online at www.cetjournal.it Guest Editors: Bing Shen How, Viknesh Andiappan, Denny K.S. Ng, Hon Loong Lam, Petar S. Varbanov Copyright © 2025, AIDIC Servizi S.r.l. ISBN 979-12-81206-21-2; ISSN 2283-9216 Leveraging the P-Graph Framework for the Optimal Synthesis of Pharmaceutical Wastewater Treatment Solutions Kevin L. Antona, Kian Hao Ngb, Nurul Husna Mohd Yusoffc, Yoke Kin Wanb, Voon- Loong Wonga,* aSchool of Energy and Chemical Engineering, Xiamen University Malaysia, Jalan Sunsuria, Bandar Sunsuria, 43900 Sepang, Selangor Darul Ehsan. bDepartment of Chemical and Environmental Engineering, Faculty of Science and Engineering, University of Nottingham Malaysia, 43500 Semenyih, Selangor, Malaysia. cExxonMobil Research and Development Center, NJ 08801-3096, Clinton, New Jersey, Unites States. voonloong.wong@xmu.edu.my The increasing demand for pharmaceutical products has led to a rise in pharmaceutical wastewater, which poses serious environmental and health threats due to the presence of complex contaminants including high chemical oxygen demand (COD), biological oxygen demand (BOD), total suspended solids (TSS), heavy metals, and residual pharmaceutical compounds. Traditional treatment systems struggle to meet regulatory standards, especially in countries like Malaysia where stringent discharge limits are enforced under the Environmental Quality Act 1974 - Environmental Quality (Industrial Effluent) Regulations 2009. In the present study, a proposed methodology applies a stagewise treatment structure, from preliminary to advanced treatment, integrating various physical, chemical, and biological technologies for the effective reduction of key water quality parameters. A graph-theoretic method known as P-graph structure generation algorithms was further implemented to study multiple feasible treatment pathways. Each configuration was assessed based on pollutant removal efficiency of COD, BOD, TSS and economic viability. A case study was solved to simulate the application of this framework, demonstrating its capability to identify optimal treatment networks that comply with the Environment Quality Regulations 2009 while minimizing operational costs. This research highlights the potential of P-graph modelling as a practical decision-support tool for pharmaceutical wastewater. It helps design pharmaceutical wastewater treatment systems that are both affordable and meet environmental regulations. 1. Introduction The pharmaceutical market has been experiencing steady growth, driven by advancements in medical research, population increases, and rising global healthcare demands (DrugPatentWatch, 2025). Global pharmaceutical expenditures, excluding COVID-19 vaccine spending, are expected to reach approximately $ 1.6 T by 2025, growing at a compound annual growth rate (CAGR) of 3 % to 6 % (Van Arnum, 2021). While this expansion benefits healthcare outcomes, it also significantly increases the generation of pharmaceutical wastewater. According to 2022 data from the United Nations, only 38 % of industrial wastewater in 22 countries was treated, and merely 27 % of it was treated safely, underscoring the pressing need for effective wastewater treatment technologies in the pharmaceutical sector (Un-Water, 2025). Pharmaceutical wastewater contains harmful contaminants such as pharmaceutical compounds, pathogens, and heavy metals. In Lanzhou, China, high levels of β-lactam antibiotics such as ampicillin, ceftriaxone, amoxicillin, and cefazolin have been detected (Ji et al., 2021), while wastewater in Sungai Langat, Malaysia, contains pollutants like paracetamol and diclofenac (Lie et al., 2024). These substances cause COD levels of 1,000–10,000 mg/L, exceeding the limits of conventional treatments (Leistner, 2023). Such pollution can harm aquatic ecosystems by disrupting microbes, affecting fertility, and causing genetic issues (Samal et al., 2022). 523 To address the dangers of harmful contaminants in water bodies, governments, including Malaysia's, have implemented regulations such as the Environmental Quality Act 1974, the Environmental Quality (Sewage) Regulations 2009, the Environmental Quality (Industrial Effluent) Regulations 2009, and the Water Services Industry (Prohibited Effluent) Regulations 2021. These set enforceable limits on effluent quality and prohibit specific toxic discharges. Additionally, Malaysia's National Water Quality Standards (NWQS), developed by the Department of Environment (DOE), provide a framework for assessing surface water quality. Thus, selecting appropriate wastewater treatment technology is crucial for optimizing costs, energy use, and resource recovery while ensuring sustainability and compliance. This paper focuses on the development and optimization of pharmaceutical wastewater treatment systems using the P-graph framework to comply with regulatory standards set by the National Water Quality Standards (NWQS), the Environmental Quality Act 1974, and the Industrial Effluent Regulations 2009. While the P-graph method has been applied in previous studies to general wastewater treatment by Yenkie et al. (2021) and tannery wastewater by Aboagye et al. (2021), its application to pharmaceutical wastewater treatment remains largely unexplored. Wastewater from pharmaceutical manufacturing is characterized by high levels of chemical oxygen demand (COD), biological oxygen demand (BOD), and total suspended solids (TSS), making its treatment particularly challenging. These high COD concentrations and fluctuating flow rates often exceed the capabilities of standard treatment facilities. Achieving stringent COD reduction targets requires specialized treatment systems, and the operation and management of such systems involve substantial costs. These challenges underline the urgent need for cost-effective and efficient treatment solutions. 2. Methodology The P-graph approach was adopted to systematically synthesize optimal configurations for pharmaceutical wastewater treatment systems using a stage wise approach. This framework has been widely used to assess combinatorial problems, including those in process network design (Friedler et al., 2019).P-graph framework uses two node types: O-type nodes for technologies and M-type nodes for materials, connected by arcs indicating flow direction. Key algorithms like Maximal Structure Generation (MSG), Solution Structure Generation (SSG), and Accelerated Branch and Bound (ABB) generate optimal or feasible process networks while estimating costs (Friedler et al., 2022). P-graph able to present all feasible solutions ranked by cost, unlike conventional optimization methods, making it ideal for designing or retrofitting wastewater treatment systems. The advantage of the P-graph approach over other methods is its ability to provide a clear and visual representation of process networks using bipartite graphs, making it easier to understand, communicate, and modify process structures (Benjamin et al., 2021). 2.1 Stagewise Structure of Pharmaceutical Wastewater Treatment This study uses a six-stage system: preliminary, primary, secondary, tertiary, and advanced treatments. Each stage targets specific pollutants, starting from large solids to produce reusable effluent (i.e., treated water from the final treatment) and supporting efficient, low-energy operations. The treatment structure is summarized in Figure 1. Figure 1: Stage wise structure of pharmaceutical wastewater treatment used in this project with its abbreviation. The wastewater first enters preliminary treatment to remove particulate solids, followed by primary treatment to further remove dissolved solids as well as some COD and BOD. Next, the treated wastewater undergoes biological treatment, which focuses on the removal of COD and BOD. After that, the water proceeds to tertiary or polishing treatment to ensure that the concentrations of TSS, BOD, and COD meet the discharge limits. In 524 addition, this study explores alternative bypass options in the advanced and final treatment stages, allowing the treated wastewater from the tertiary stage to bypass the advanced or final treatments (or both) depending on the desired water quality to be achieved by the treatment plant. If higher-quality water is required, such as ensuring the absence of pathogens, Fenton oxidation and UV light treatments will be necessary. Otherwise, the water quality produced from the tertiary treatment is sufficient. The selection of technologies, their placement within the treatment sequence, associated costs, and removal efficiencies used in this study are all based on data obtained from relevant literature sources (see Supplementary). 2.2 Case study This project targets the removal of COD, BOD, and TSS, with influent data sourced from a pharmaceutical industry, as shown in Table 1. Effluent targets follow Malaysia’s NWQS and the Environmental Quality Act 1974 – Industrial Effluent Regulations 2009. The aims to meet Class I water standards: BOD ≤ 1 mg/L, COD ≤ 10 mg/L, and TSS ≤ 25 mg/L. These standards indicate very low pollution levels, suitable for ecological protection (Kawan et al., 2022). The objective of this project is to minimize the total cost by using the P-graph framework, with decision variables including the selection of treatment technologies and the combination and sequence of various treatment stages. This project assumes that the initial and final flow rates remain constant, as the focus is on reducing pollutant mass flowrate while maintaining a steady water within the treatment system. Table 1: The influence of pharmaceutical wastewater and final product requirement. Parameter Value of Inlet Value of Final Product Flow rate (m3/day) 200 200 COD (mg/L) 650 <10 BOD (mg/L) 330 <1 TSS (mg/L) 90 <25 As previously mentioned, the removal efficiency for each treatment stage was determined based on reported values (see Supplementary). After establishing these efficiencies and verifying that each stage could meet the required discharge standards, the next step was to calculate the number of pollutants removed at each stage. This calculation was carried out using the formula developed in this study, as shown Eq(1) where 𝑝𝑓(𝑛−1) is mass flowrate of pollutants in previous stage n-1: 𝐴𝑚𝑜𝑢𝑛𝑡 𝑜𝑓 𝑝 (𝑝𝑜𝑙𝑙𝑢𝑡𝑎𝑛𝑡) 𝑟𝑒𝑚𝑜𝑣𝑒𝑑, 𝑅𝑝 = 𝑅𝑒𝑚𝑜𝑣𝑎𝑙 𝑝𝑒𝑟𝑐𝑒𝑛𝑡𝑎𝑔𝑒 𝑥 𝑝𝑓(𝑛−1) (1) Consequently, the mass flow rate of pollutants entering the next stage can be calculated using Eq(2), where 𝑝𝑓(𝑛+1) is the total mass flowrate of pollutant for stage n+1. 𝑝𝑓(𝑛+1) = 𝑝𝑓(𝑛−1) − 𝑅𝑝 (2) The cost estimation model in this study is based on literature data (see Supplementary) and assumes a linear relationship between equipment cost and capacity. As shown in Eq(3), the equipment cost (Ci) is calculated as a function of its capacity (Qi). Here, Q1 and C1 are values from the literature, while Q2 represents the design capacity used in this study (200 m³/day). 𝐶2 = 𝐶1 ∗ 𝑄2 𝑄1 (3) The P-graph structure used in this study is shown in Figure 2. Raw water input was calculated by multiplying pollutant concentrations (COD, BOD, TSS) by a flow rate of 200 m³/day, resulting in a total mass flow rate of about 214 kg/day. Cost inputs were based on prior estimates, while removal efficiencies were excluded to maintain a steady-state flow and avoid skewing cost results. The final product was defined by minimum pollutant limits, and treated water was based on the mass of pollutants removed. The payout period used in this optimization was 10 years, which is the default setting in the P-graph framework. 3. Results and Discussion In this project, the Accelerated Branch and Bound (ABB) algorithm was used to generate 192 feasible treatment network solutions ranked by cost, supporting more informed decision-making across multiple optimal configurations. While the ABB algorithm was used to generate feasible treatment network structures based on cost and connectivity, the pollutant discharge limits (COD, BOD, TSS) were treated as final product assumptions 525 and manually validated in Excel. This manual validation was necessary because including removal efficiencies at each treatment stage would alter the raw material flow rate and affect cost calculations, whereas this study maintained a fixed flow rate of 200 m³/day. The top five cost-effective solutions are presented in Table 2. Unlike conventional methods, the P- graph approach offers a variety of feasible pathways, allowing engineers to explore different combinations of treatment technologies, such as with or without UV disinfection, to select the most suitable configuration. Figure 2: The superstructure configuration of P-graph that used The P-graph superstructure was constructed into a stagewise sequence. At each stage, multiple competing technologies (such as SBR, ASP, and MBR in the primary stage) are embedded in parallel. Rigorous Excel calculations confirmed that bypassing any of the preliminary through tertiary stages would cause effluent quality to breach Malaysia’s COD, BOD, and TSS limits, so only the advanced and final stages were permitted full bypass options. Table 2: Five optimal structures that identified using Accelerated Branch and Bound (ABB) Algorithm. Rank Operating Units Total Cost ($/day) Investment Cost ($) #1 Screen, chemical coagulation and clarifier, activated sludge, clarifier, activated carbon filtration 438.28 185,954.28 #2 Screen, chemical coagulation and dissolved air flotation, activated sludge, clarifier, activated carbon filtration 443.12 190,056.57 #3 Sedimentation tank, chemical coagulation and clarifier, activated sludge, clarifier activated carbon filtration 448.04 224,361.66 #4 Sedimentation tank, chemical coagulation and air flotation, activated sludge, clarifier, activated carbon filtration 452.87 228,463.95 #5 Screen, chemical coagulation and clarifier, activated sludge, clarifier, activated carbon filtration, UV light 453.38 187,004.64 526 3.1 Economic Evaluation Based on the analysis conducted using the P-graph algorithm, it was found that among the top five solutions, the most expensive structure incurred a total operating cost of 453.38 $/d, equivalent to approximately 2.27 $/m3 of treated wastewater. In comparison, the first-ranked solution had a daily operating cost of about $ 438.28, or roughly 2.19 $/m3. This indicates that the fifth-ranked structure is only around 3.33 % more expensive than the first-ranked one, reflecting a relatively small cost difference among the top five solutions. Additionally, the cost gap between the first- and second-ranked structures is just 2.5 %, further demonstrating that the P-graph algorithm effectively generates a well-ranked set of feasible solutions with minimal cost variation. Among these solutions, rank #1 emerged as the most economically advantageous in terms of investment cost, requiring the lowest total investment of $ 185,954.28. This configuration consists of a combination of screen, chemical coagulation and clarifier, activated sludge, clarifier, and activated carbon filtration. On the other hand, rank #5 is particularly suitable for situations where the wastewater contains a high concentration of bacteria or viruses, as it includes an additional UV disinfection stage. With an operating cost of approximately 453.38 $/d (or about 2.27 $/m3) and an investment cost of around $ 187,004.64, it offers a balanced option between performance and overall cost. The availability of the fifth-ranked structure as a feasible solution provides engineers with flexibility, allowing them to select a design that best fits their specific treatment needs, particularly when addressing high levels of microbial contamination. 3.2 Performance Evaluation As can be seen in Table 3, all feasible structures meet the National Water Quality Index of Malaysia standards (COD < 10 mg/L, BOD < 1 mg/L, TSS < 25 mg/L). Structures ranked #1, #2, and #5 yield identical final concentrations. This outcome is attributed to two main factors. First, the project focuses solely on COD, BOD, and TSS, and the differences among the feasible solutions primarily involve the addition of UV light, which does not significantly affect these parameters. Second, the variations lie in the sludge settling methods used after chemical coagulation (either through dissolved air flotation or clarifier systems) which also do not significantly impact the final concentrations of the targeted pollutants. Structures #3 and #4 also produce the same results for similar reasons. The main difference across structures lies in TSS removal efficiency sedimentation tanks perform better, achieving a lower final TSS concentration (0.0057 mg/L) compared to screens (0.037 mg/L). Table 3: Concentration of removed and remaining pollutants for the five best optimal structures under the cost minimization objective. Rank Pollutant Concentration Removed (mg/L) Concentration Remain (mg/L) SC CFC AS + Clarifier ACF UV Light SC CFC AS + Clarifier ACF UV Light #1 COD 0 624 23.4 1.85 - 650 26 2.6 0.75 - BOD 0 184.8 143.98 1.149 330 145.2 1.22 0.071 TSS 31.5 53.82 4.633 0.01 58.5 4.68 0.047 0.037 Pollutant SC CFD AS + Clarifier ACF UV Light SC CFD AS + Clarifier ACF UV Light #2 COD 0 624 23.4 1.85 - 650 26 2.6 0.75 - BOD 0 184.8 143.98 1.149 330 145.2 1.22 0.071 TSS 31.5 53.82 4.633 0.01 58.5 4.68 0.047 0.037 Pollutant ST CFC AS + Clarifier ACF UV Light ST CFC AS + Clarifier ACF UV Light #3 COD 0 624 23.4 1.85 - 650 26 2.6 0.75 - BOD 0 184.8 143.98 1.149 330 145.2 1.219 0.071 TSS 81 8.28 0.7128 0.0015 9 0.72 0.0072 0.0057 Pollutant ST CFD AS + Clarifier ACF UV Light ST CFD AS + Clarifier ACF UV Light #4 COD 0 624 23.4 1.85 - 650 26 2.6 0.75 - BOD 0 184.8 143.98 1.149 330 145.2 1.219 0.071 TSS 81 8.28 0.7128 0.0015 9 0.72 0.0072 0.0057 Pollutant SC CFC AS + Clarifier ACF UV Light SC CFD AS + Clarifier ACF UV Light #5 COD 0 624 23.4 1.85 1.85 650 26 2.6 0.75 0.75 BOD 0 184.8 143.98 1.149 1.149 330 145.2 1.22 0.071 0.071 TSS 31.5 53.82 4.633 0.01 0.01 58.5 4.68 0.047 0.037 0.037 527 4. Conclusions This study demonstrates the effectiveness of the P-graph framework in designing optimal pharmaceutical wastewater treatment systems. By analysing 192 feasible structures, the top five were selected based on cost and compliance with Malaysia’s environmental standards. The best configuration combined screening, chemical coagulation, activated sludge, and activated carbon filtration. While the study focused on COD, BOD, and TSS, future work should include other contaminants, validate results at scale, and integrate dynamic models with non- linear optimization. Incorporating pollutant thresholds directly into the model will also help minimize over- treatment and better utilize partial bypass options for improved cost-efficiency. Acknowledgments This work was financially supported by Xiamen University Malaysia Research Fund (XMUMRF) (Grant no. XMUMRF/2025-C15/IENG/0078). The data used for this P-graph optimization can be found in the Supplementary Document (drive.google.com/file/d/1XWzzFbKoMyy3-O04INuju9ZEWtbJsSEy/view). References Aboagye E.A., Pimentel J., Orosz Á., Cabezas H., Friedler F., Yenkie K.M., 2021, Efficient Design and Sustainability Assessment of Wastewater Treatment Networks using the P-graph Approach: A Tannery Waste Case Study. Chemical Engineering Transactions, 88, 493-498. Basso S., 2023, The four stages of wastewater treatment plants – IDRICA accessed 02.06.2025 DrugPatentWatch, 2025, The Influence of Emerging Markets on the Pharmaceutical Industry - DrugPatentWatch – Transform Data into Market Domination. DrugPatentWatch – Transform Data Into Market Domination accessed 10.06.2025 Frankel T., 2025, What Is Tertiary Wastewater Treatment, and How Does It Work? SSI Aeration accessed 20.06.2025 Friedler F., Aviso K.B., Bertok B., Foo D.C., Tan R.R., 2019, Prospects and challenges for chemical process synthesis with P-graph. Current Opinion in Chemical Engineering, 26, 58–64. Friedler F., Orosz Á., Losada J.P., 2022, P-Graphs for Process Systems engineering: Mathematical Models and Algorithms. Springer Nature. Ji J., Gao T., Salama E., El-Dalatony M.M., Peng L., Gong Y., Liu P., Li X., 2021, Using Aspergillus niger whole- cell biocatalyst mycelial aerobic granular sludge to treat pharmaceutical wastewater containing β-lactam antibiotics. Chemical Engineering Journal, 412, 128665. Kawan J.A., Suja F., Pramanik S.K., Yusof A., Rahman R.A., Hasan H.A., 2022, Effect of Hydraulic Retention Time on the Performance of a Compact Moving Bed Biofilm Reactor for Effluent Polishing of Treated Sewage. Water, 14(1), 81. Leistner T., 2023, Pharmaceutical wastewater treatment. clearfox.com. accessed 10.06.2025 Lie M., Rubiyatno N., Binhudayb F.S., Thao N.T.T., Kristanti R.A., 2024, Assessing the Impact of Pharmaceutical Contamination in Malaysian Groundwater: Risks, Modelling, and Remediation Strategies. Tropical Aquatic and Soil Pollution, 4(1), 43–59. Nathanson A,J., Ambulkar, Archis, 2025, Wastewater treatment | Process, History, Importance, Systems, & Technologies. Encyclopedia Britannica accessed 02.06.2025 Samal K., Mahapatra S., Ali M.H., 2022, Pharmaceutical wastewater as Emerging Contaminants (EC): Treatment technologies, impact on environment and human health. Energy Nexus, 6, 100076. Un-Water, 2025, Progress on Wastewater Treatment – 2024 Update | UN-Water. UN-Water accessed 01.06.2025 Van Arnum P., 2021, The Global Bio/Pharma Market: Where’s the Growth? - DCAT Value Chain Insights. DCAT Value Chain Insights accessed 01.06.2025 Yenkie K.M., Pimentel J., Orosz Á., Cabezas H., Friedler F., 2021, The P‐graph approach for systematic synthesis of wastewater treatment networks. AIChE Journal, 67(7), e17253. Benjamin M.F., Aviso K., Belmonte B.A., Tan R.R., 2021, Optimal operations of a bioenergy park under capacity disruptions via the P-graph method. Chemical Engineering Transactions, 89, 139-144. 528 0260.pdf Leveraging the P-Graph Framework for the Optimal Synthesis of Pharmaceutical Wastewater Treatment Solutions