From e770ee92d6b729ad4edcc126cf8dc35036186e06 Mon Sep 17 00:00:00 2001 From: hsitaram Date: Tue, 20 Jan 2026 14:50:51 -0700 Subject: [PATCH 1/5] adding deacetylation pretreatment model --- applications/Bioconversion/Models_classes.py | 57 +- .../deacetylation_model/deacetylation.py | 310 ++++++++ .../virtual_engineering_notebook.ipynb | 705 +++++++++++++++++- 3 files changed, 1040 insertions(+), 32 deletions(-) create mode 100644 applications/Bioconversion/models/pretreatment_model/deacetylation_model/deacetylation.py diff --git a/applications/Bioconversion/Models_classes.py b/applications/Bioconversion/Models_classes.py index 1efc214..0c61af3 100644 --- a/applications/Bioconversion/Models_classes.py +++ b/applications/Bioconversion/Models_classes.py @@ -13,7 +13,7 @@ cwd = os.getcwd() def make_models_list(options_list, n_models=4, hpc_run=False): - + fs_options, pt_options, eh_options, br_options = tuple(options_list) # Initialize models FS_model = Feedstock(fs_options) @@ -193,10 +193,48 @@ def final_time(self, a): raise ValueError(f"Value {a} is outside allowed interval [1, 1440]") self.ve.pt_in['final_time'] = 60 * float(a) + @property + def acetylfrac(self): + return self.ve.pt_in['acetylfrac'] + + @acetylfrac.setter + def acetylfrac(self,a): + if not 0 < a < 1: + raise ValueError(f"Value {a} is outside allowed interval (0, 1)") + self.ve.pt_in['acetylfrac'] = float(a) + + @property + def DAtemp(self): + return self.ve.pt_in['deacetylation temperature'] + + @DAtemp.setter + def DAtemp(self,a): + if not 200 < a < 600: + raise ValueError(f"Value {a} is outside allowed interval (200, 600)") + self.ve.pt_in['deacetylation temperature'] = float(a) + + @property + def model_type(self): + return self.ve.pt_in['model_type'] + + @model_type.setter + def model_type(self, a): + if a not in ['dilute acid', 'deacetylation']: + raise ValueError("Invalid value. Allowed options: 'dilute acid', 'deacetylation'") + self.ve.pt_in['model_type']=a + self.select_run_function() + + def select_run_function(self): + # selected enzymatic hydrolysis model + if self.model_type == 'dilute acid': + self.run = self.run_pt_dilute_acid + elif self.model_type == 'deacetylation': + self.run = self.run_pt_deacetylation + ############################################## # ############################################## - def run(self, verbose=True, show_plots=None): + def run_pt_dilute_acid(self, verbose=True, show_plots=None): """Run pretreatment code specified in pretreatment_model/dolfinx/run_pretreatment.py @@ -226,6 +264,21 @@ def run(self, verbose=True, show_plots=None): print(f't_final = {self.t_final}') return True return False + + def run_pt_deacetylation(self, verbose=True): + if verbose: + print('\nRunning deacetylation pretreatment') + sys.path.append(os.path.join(self.pt_module_path, 'deacetylation_model')) + from deacetylation import deacetylate + deacetylate(self.ve,verbose,self.show_plots) + self.ve.pt_out = {} + self.ve.pt_out['X_X']=self.ve.feedstock['xylan_solid_fraction'] + self.ve.pt_out['X_G']=self.ve.feedstock['glucan_solid_fraction'] + self.ve.pt_out['conv']=0.0 + self.ve.pt_out["fis_0"] = self.ve.pt_in['initial_solid_fraction'] + self.ve.pt_out["rho_f"] = 0.0 + self.ve.pt_out["rho_x"]=730.0 + return True ################################################################################### #### diff --git a/applications/Bioconversion/models/pretreatment_model/deacetylation_model/deacetylation.py b/applications/Bioconversion/models/pretreatment_model/deacetylation_model/deacetylation.py new file mode 100644 index 0000000..43cd2f8 --- /dev/null +++ b/applications/Bioconversion/models/pretreatment_model/deacetylation_model/deacetylation.py @@ -0,0 +1,310 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Nov 19 14:33:24 2025 + +@author: spittman +""" + +# Set up Excel Relation and Data Frame +# knowns should be in excel file at this point +import numpy as np +from scipy.integrate import solve_ivp +import pandas as pd +import math +import matplotlib.pyplot as plt + +########################################### +# PHYSICAL AND CHEMICAL CONSTANTS +########################################### +### +# Equation Constants +F = 96485 # Faraday Constant -Amps*Sec/mol- -C/mol- +R = 0.008314 # Ideal gas constant -8.314 J/mol*K- -kJ/mol- +R_gas = 0.08206 # -L*atm/mol*K- +rho_h2o = 1000 # density of water -g/L- +mrho_h2o = 55.56 # density of water -mol/m3- +Ea = 38 # Arrhenius activation energy for acetyl groups -J/mol- +Arc = 1.1e4 # Arrhenius pre-exponent factor for acetyl groups -L/(mol-s)- +Ea_L = 55 # Arrhenius activation energy for lignin -J/mol- +Arc_L = 1.5e6 # Arrhenius pre-exponent factor for lignin -L/(mol-s)- +Ea_X = 45 # Arrhenius activation energy for xylan -J/mol- +Arc_X = 7e3 # Arrhenius pre-exponent factor for xylan -L/(mol-s)- +### +# Stoichiometric Equilibrium Constants +pKa_ace = 4.76 +pK_Naace = 4.76 + + +### +# Typical Composition of Cob Types +# Corn Husk +Husk_C = 0.38 # fraction of cellulose -%/100- +Husk_H = 0.35 # fraction of hemicellulose -%/100- +Husk_L = 0.15 # fraction of lignin -%/100- +Husk_Ep = 0.126 # effective porosity +Husk_T = 5.5 # tortuosity +Husk_v = 0.65 # void fraction +# Corn Cob +Cob_C = 0.33 # fraction of cellulose -%/100- +Cob_H = 0.36 # fraction of hemicellulose -%/100- +Cob_L = 0.17 # fraction of lignin -%/100- +Cob_Ep = 0.126 # effective porosity +Cob_T = 10.3 # tortuosity +Cob_v = 0.65 # void fraction +# Corn Stalk +Stalk_C = 0.40 # fraction of cellulose -%/100- +Stalk_H = 0.28 # fraction of hemicellulose -%/100- +Stalk_L = 0.21 # fraction of lignin -%/100- +Stalk_Ep = 0.671 # effective porosity +Stalk_T = 1.36 # tortuosity +Stalk_v = 0.65 # void fraction +# Acetyl Groups +Acy_P = 0.023 #0.023 #0.0223 # weight percentage of acetate in biomass +# Acy_P = 0.027 # switchgrass +# Lignin Groups +Lig_P = 0.153 # weight percentage of lignin in biomass +# Lig_P = 0.192 # switchgrass +# Xylan Groups +Xy_P = 0.213 # corn stover +# Xy_P = 0.218 # switchgrass + +loops = (3,6) +corn = np.zeros(loops) +corn[0,0] = Husk_Ep +corn[0,1] = Husk_T +corn[0,2] = Husk_v +corn[0,3] = Husk_C +corn[0,4] = Husk_H +corn[0,5] = Husk_L +corn[1,0] = Cob_Ep +corn[1,1] = Cob_T +corn[1,2] = Cob_v +corn[1,3] = Cob_C +corn[1,4] = Cob_H +corn[1,5] = Cob_L +corn[2,0] = Stalk_Ep +corn[2,1] = Stalk_T +corn[2,2] = Stalk_v +corn[2,3] = Stalk_C +corn[2,4] = Stalk_H +corn[2,5] = Stalk_L + +### +# Molar Mass - g/mol - +M_NaOH = 40 +M_OH = 17.01 +M_Na = 22.99 +M_ace = 59.04 # acetate - C2H3O2 +M_hace = 60.05 # acetic acid - C2H4O2 +M_Naace = 82.03 # sodium acetate +M_Cel = 162.14 # cellulose - C6H10O5 +M_Hem = 174.15 # hemicellulose - modeled as acetylated xylan +M_acy = 43.045 # acetyl group - C2H3O +M_X = 132.11 # deacetylated xylan +M_Lig = 188 # lignin - common approximation +M_H = 1 + +# Create matrix -g/mol- +loops = (3,12) +const = np.zeros(loops) +const[0,0] = M_ace +const[0,1] = M_hace +const[0,2] = M_Naace +const[0,3] = M_Cel +const[0,4] = M_Hem +const[0,5] = M_Lig +const[0,6] = M_acy +const[0,7] = M_X +const[0,8] = M_NaOH +const[0,9] = M_Na +const[0,10] = M_OH +const[0,11] = M_H + + +######################################### +# INITIAL CONDITIONS +######################################### +### +# VARIABLE SET INITIAL CONDITIONS +t_final = 7200 # Total reaction time -Sec- -120 min- #7200 #5400 +Tf = 365.15 # Operating Fluid Temperature -K- -363.15|90 C- -323.15|50 deg C- +V_DA = 55 # Volume of Deacetylation Reactor -L- #30 #20 +pHi_DA = 7 # Inital pH +pOHi_DA = 14-pHi_DA # Initial pOH +Part = 0.75 # particle size -inch- +Decomp = 2 # storage time -unitless- -(months)- + +### +# Initial Influent Content -g/L- +C_Husk = 10 # corn husk +C_Cob = 10 # corn cob +C_Stalk = 10 # corn stalk +C_NaOH = 9.09 # sodium hydoxide # 4.55 6.36 9.09 # 9.47 5.35 # 2.61 2.01 1.41 +# Biomass +W_BM = 5000 # biomass -g- #600 +# Acetyl Groups +C_acy = W_BM*Acy_P/V_DA # acetyl groups -g/L-2 +Molar_acy = C_acy/M_acy +C_ace_max = C_acy*(M_ace/M_acy) +# Lignin Groups +C_lig = W_BM*Lig_P/V_DA # -g/L- +C_lig_max = C_lig +Molar_lig = C_lig/M_Lig +# Xylan Groups +C_xy = W_BM*Xy_P/V_DA # acetyl groups -g/L-2 +C_xyo_max = C_xy*(M_X/M_Hem) +Molar_xy = C_xy/M_X + +####################################### +# Set UP Matrices +####################################### + +### = +# Calculation Matrix -row 0 g/L- -row 1 mol/L- +loops=(1,12) +DAC = np.zeros(loops) +M_DAC = np.zeros(loops) +dM_DAC = np.zeros(loops) +DAC[0,0] = 0 # Acetate +DAC[0,1] = 0 # Acetic Acid +DAC[0,2] = 0 # Sodium Acetate +DAC[0,3] = (C_Husk*Husk_C)+(C_Cob*Cob_C)+(C_Stalk*Stalk_C) # Cellulose +DAC[0,4] = C_xy # Hemicellulose +DAC[0,5] = C_lig # Lignin +DAC[0,6] = C_acy # Acetyl Groups +DAC[0,7] = 0 # Deacetylated Xylan +DAC[0,8] = C_NaOH # Sodium Hydroxide +DAC[0,9] = 0 # Sodium +DAC[0,10] = 10**(-pOHi_DA)*M_OH # Hydroxide +DAC[0,11] = 10**(-pHi_DA)*M_H # Hydrogen +# Convert +M_DAC[0,:] = DAC[0,:]/const[0,:] # -mol/L- +# NaOH Dissociates Completely +M_DAC[0,9] = M_DAC[0,9] + (1*M_DAC[0,8]) # Sodium +M_DAC[0,10] = M_DAC[0,10] + (1*M_DAC[0,8]) # Hydroxide +M_DAC[0,8] =M_DAC[0,8] - M_DAC[0,8] # Sodium Hydroxide +# Convert +DAC[0,:] = M_DAC[0,:]*const[0,:] # -g/L- + +# Free Acids +M_DAC[0,10] = M_DAC[0,10] - 0.02 + +# Arrehnius Rate Kinetics +# Lignin +kT_arh_L = Arc_L*np.exp(-Ea_L/(R*Tf)) # -L/(mol-s)- +# Acetate +kT_arh = Arc*np.exp(-Ea/(R*Tf)) # -L/(mol-s)- +# Xylan +kT_arh_X = Arc_X*np.exp(-Ea_X/(R*Tf)) # -L/(mol-s)- + +############################################### +### DEFINE FUNCTION +def DACy(t, y): + # Arrehnius Rate Kinetics + # Lignin + kT_arh_L = Arc_L*np.exp(-Ea_L/(R*Tf)) # -L/(mol-s)- + # Acetate + kT_arh = Arc*np.exp(-Ea/(R*Tf)) # -L/(mol-s)- + # Xylan + kT_arh_X = Arc_X*np.exp(-Ea_X/(R*Tf)) # -L/(mol-s)- + # Define Rate Equation + # Lignin + dligdt = kT_arh_L*y[3]*y[1] # -mol/L-s- + # Change value + dClig_dt = -dligdt + dCslig_dt = +dligdt + # Acetate + dacedt = kT_arh*y[0]*y[1] # -mol/L-s- + # Change value + dCacy_dt = -dacedt + dCace_dt = +dacedt + # Xylan + dxydt = kT_arh_X*y[5]*y[1] # -mol/L-s- + dCxyo_dt = +dxydt + dCxy_dt = -dxydt + dCOH_dt =-(dacedt+(1.2*dligdt)+(dxydt)) + return [dCacy_dt, dCOH_dt, dCace_dt, dClig_dt, dCslig_dt, dCxy_dt, dCxyo_dt] + +############################################### +### INTEGRATE +def deacetylate(ve_params,verbose=True,show_plots=True): + print("doing deacetylation..") + Tf=ve_params.pt_in['deacetylation temperature'] + Acy_P = ve_params.pt_in['acetylfrac'] + t_span = (0,t_final) + t_span = (0,t_final) + Cacetyl = M_DAC[0,6] + COH = M_DAC[0,10] + Cace = M_DAC[0,0] + Cxy = M_DAC[0,4] + Cxyo = 0 + Cxyoh = 0 + Clig = M_DAC[0,5] + Cslig = 0 + y0 = [Cacetyl, COH, Cace, Clig, Cslig, Cxy, Cxyo] + sol_DA = solve_ivp(DACy,t_span, y0, method='BDF', rtol=1e-6, atol=1e-9) + + ############################################ + # EXPERIMENTAL TIME POINTS + ############################################ + times = np.array([0,5,10,15,20,25,30,40,50,60,70,80,90,100,110,120], dtype=int) + + # Acetate Experimental Time Points + acetate_interp = np.interp(times, sol_DA.t/60, sol_DA.y[2]*M_ace) + acetyl_interp = np.interp(times, sol_DA.t/60, sol_DA.y[0]*M_acy) + DAC_exp_ace = np.vstack((times, acetate_interp, acetyl_interp)).T + + Macetate_interp = np.interp(times, sol_DA.t/60, sol_DA.y[2]) + Macetyl_interp = np.interp(times, sol_DA.t/60, sol_DA.y[0]) + + # Lignin Experimental Time Points + lignin_interp = np.interp(times, sol_DA.t/60, sol_DA.y[3]*M_Lig) + Slignin_interp = np.interp(times, sol_DA.t/60, sol_DA.y[4]*M_Lig) + DAC_exp_lig = np.vstack((times, Slignin_interp, lignin_interp)).T + + # Xylan Experimental Time Points + Xylan_interp = np.interp(times, sol_DA.t/60, sol_DA.y[5]*M_Hem) + Xylose_interp = np.interp(times, sol_DA.t/60, sol_DA.y[6]*M_X) + OH_interp = np.interp(times, sol_DA.t/60, sol_DA.y[1]*M_NaOH) + DAC_exp_xyo = np.vstack((times, Xylan_interp, Xylose_interp)).T + + # pH Experimental Time Points + # Calculate pKw + Hnot0 = 55.83 + Kw2 = 10**(-14)*((Hnot0/R)*((1/289.15)-(1/Tf))) + pKw = -np.log10(Kw2) + OH_interp = np.interp(times, sol_DA.t/60, sol_DA.y[1]*M_OH) + pH = pKw+np.log10(OH_interp) + DAC_exp_pH = np.vstack((times, pH)).T + + + ############################################ + # CREATE GRAPHS + ############################################ + # Acetate + '''plt.plot(sol_DA.t/60, sol_DA.y[2]*M_ace,color=(1, 0.5, 0.8)) + plt.title('Deacetylation Time Profile') + plt.xlabel('Time (min)') + plt.ylabel('Species Concentration (g/L)') + plt.show() + + # Lignin + plt.plot(sol_DA.t/60, sol_DA.y[4]*M_Lig,color=(0.1, 0.3, 0.7)) + plt.title('Lignin Solubilization Time Profile') + plt.xlabel('Time (min)') + plt.ylabel('Species Concentration (g/L)') + plt.show() + + # Xylose + plt.plot(times, DAC_exp_xyo[:,2],color=(0, 0.7, 0.3)) + plt.title('Xylose Time Profile') + plt.xlabel('Time (min)') + plt.ylabel('Species Concentration (g/L)') + plt.show() + + # pH + plt.plot(times, DAC_exp_pH[:,1],color=(1, 0.5, 0.5)) + plt.title('pH Time Profile') + plt.xlabel('Time (min)') + plt.ylabel('Species Concentration (g/L)') + plt.show()''' diff --git a/applications/Bioconversion/virtual_engineering_notebook.ipynb b/applications/Bioconversion/virtual_engineering_notebook.ipynb index 73a0b4d..42257ca 100644 --- a/applications/Bioconversion/virtual_engineering_notebook.ipynb +++ b/applications/Bioconversion/virtual_engineering_notebook.ipynb @@ -12,7 +12,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 1, "id": "97091f4a", "metadata": {}, "outputs": [ @@ -31,7 +31,7 @@ "" ] }, - "execution_count": 22, + "execution_count": 1, "metadata": { "image/png": { "width": 800 @@ -70,14 +70,14 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 2, "id": "08d383e5", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "f1138fb7a3ae47da8c1abc328ac5aa38", + "model_id": "021448ab0f8c4725be0e7ac18ca78787", "version_major": 2, "version_minor": 0 }, @@ -91,7 +91,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "c8ff8c4c4ab64690ba4be3124ea96832", + "model_id": "42900a82d2634ca19294b986bdc966f6", "version_major": 2, "version_minor": 0 }, @@ -105,7 +105,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "219f76c7f1e84e7680ca7ca41901a8b1", + "model_id": "c1a54e89b5424630b60a176f51fa4517", "version_major": 2, "version_minor": 0 }, @@ -166,14 +166,28 @@ }, { "cell_type": "code", - "execution_count": 24, - "id": "5ed9ca03", + "execution_count": 5, + "id": "7b0046aa", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "9859bcf9e91545da84af9406d4e02709", + "model_id": "8643f201880846469082d6179e55d430", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "HBox(children=(HTMLMath(value='', layout=Layout(display='flex', justify_content='flex-end', padding='0px 5px 0…" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "fb799d37a1934977b23133c1d972c51b", "version_major": 2, "version_minor": 0 }, @@ -187,7 +201,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "58ec19095eca48bbbeef9eaa38ff31e2", + "model_id": "af231d173bb94485b4df8663e771a2f7", "version_major": 2, "version_minor": 0 }, @@ -201,7 +215,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "79a80ece24a34f07a3258b8f71c47d79", + "model_id": "29b27dc8392d48979094905de05bae83", "version_major": 2, "version_minor": 0 }, @@ -215,7 +229,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "b648f0a4b31f4aab97f0f2ae481e35a0", + "model_id": "081e467156ac4b868e3308028482b3dc", "version_major": 2, "version_minor": 0 }, @@ -229,7 +243,35 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "38cefd8ae2ea42f4b1255e47bd03412a", + "model_id": "ff1a25cfc09f4ea5a322c1f02344cc70", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "HBox(children=(BoundedFloatText(value=0.025, description='Acetyl group fraction', layout=Layout(width='350px')…" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "8b95e6e824f84faba4b67136c82ce6ca", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "HBox(children=(BoundedFloatText(value=365.0, description='Deacetylation temperature', layout=Layout(width='350…" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "4b3567eee9ed4befbb49115b54b74af4", "version_major": 2, "version_minor": 0 }, @@ -246,6 +288,14 @@ "# Create the collection of widgets for pretreatment options\n", "pt_options = WidgetCollection()\n", "\n", + "pt_options.model_type = widgets.RadioButtons(\n", + " options = ['dilute acid', 'deacetylation'],\n", + " #value = 'Deacetylation',\n", + " #description = 'Model Type',\n", + " #disabled = False,\n", + " #tooltip = 'Specifies the solver to use for the EH step, \"CFD Simulation\" requires HPC resources.'\n", + ")\n", + "\n", "#### this needs to be changed to g acid / g bone-dry biomass (then converted in the run function) ####\n", "pt_options.initial_acid_conc = widgets.BoundedFloatText(\n", " value = 0.0001,\n", @@ -279,6 +329,22 @@ " tooltip = r'Total simulation time (min). Must be $\\geq$ 1'\n", ")\n", "\n", + "pt_options.acetylfrac = widgets.BoundedFloatText(\n", + " value = 0.025,\n", + " max = 0.1,\n", + " min = 0.0,\n", + " description = 'Acetyl group fraction',\n", + " tooltip = 'The initial fraction of acetyl groups. Must be in the range [0, 1]'\n", + ")\n", + "\n", + "pt_options.DAtemp = widgets.BoundedFloatText(\n", + " value = 365,\n", + " max = 600,\n", + " min = 200.0,\n", + " description = 'Deacetylation temperature',\n", + " tooltip = 'Fluid temperature for deacetylation. Must be in the range [200, 600]'\n", + ")\n", + "\n", "pt_options.show_plots = widgets.Checkbox(\n", " value = False,\n", " tooltip = 'Show Plots'\n", @@ -304,14 +370,14 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 6, "id": "06218c2d", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "442ad5786a5547cd97c9cc26761e2464", + "model_id": "ef27297f85954dd493f0851fc16de8ff", "version_major": 2, "version_minor": 0 }, @@ -325,7 +391,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "c3f148b35cd74ad6a428099dbc1ea26f", + "model_id": "72a408e547904d97aacff4dfb94133a2", "version_major": 2, "version_minor": 0 }, @@ -339,7 +405,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "2534721f75f24977a0426193375e9ee7", + "model_id": "55208793cb94406d9b9eeb55575debf3", "version_major": 2, "version_minor": 0 }, @@ -353,7 +419,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "db24805d9a29467d9f727d37bfb9df47", + "model_id": "b38df903e14149ad8d93bf98061b0082", "version_major": 2, "version_minor": 0 }, @@ -367,7 +433,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "8bbd6318d6bd405b86f0ca1b98dd8f7a", + "model_id": "f1b03ec4e6624d6fbdba959a1542538f", "version_major": 2, "version_minor": 0 }, @@ -458,14 +524,14 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 7, "id": "3f87239c", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "4dbfd8d9c40943b2876df9ae9bd2521c", + "model_id": "09e4fcac16b74edd8dbffc38d876a578", "version_major": 2, "version_minor": 0 }, @@ -479,7 +545,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "5150ed07795a439fb6b6999d6c406358", + "model_id": "c4f35397f36e43ff84c56c98d5718361", "version_major": 2, "version_minor": 0 }, @@ -493,7 +559,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "cb0347f898824ace90824aef06c63760", + "model_id": "af9a89088ba84064a197714ccfe2fd10", "version_major": 2, "version_minor": 0 }, @@ -507,7 +573,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "b614426963d5408daf356b5015ff2c54", + "model_id": "99348edca1e94f9b9246b4868916ab79", "version_major": 2, "version_minor": 0 }, @@ -521,7 +587,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "ecb42fe44c5a4b5393318de22e5c7034", + "model_id": "531d8634193d4573a30845ce42dab8a8", "version_major": 2, "version_minor": 0 }, @@ -535,7 +601,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "e3f210c28317424cb3ba798fb8c2d55b", + "model_id": "1d72987ae2144aae8546d062f6ddc4bc", "version_major": 2, "version_minor": 0 }, @@ -620,14 +686,14 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 8, "id": "c6faffab", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "fb5ada1a1fbb42cabbb55d596f1108c1", + "model_id": "e8fcd293529f4239af2a835ca6723c1c", "version_major": 2, "version_minor": 0 }, @@ -637,6 +703,553 @@ }, "metadata": {}, "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Initializing Pretreatment Model\n", + "Initializing Enzymatic Hydrolysis Model\n", + "Initializing Bioreactor Model\n", + "\n", + "Running Pretreatment\n", + "Mass of xylan initial (g): 0.1315\n", + "Mass of xylan (g): 0.13149999999999984\n", + "Unadjusted mass of xylog (g): 0.0\n", + "Unadjusted mass of xylose (g): 0.0\n", + "Unadjusted mass of furfural (g): 0.0\n", + "Unadjusted mass of products (g): 0.0\n", + "Unadjusted mass of products / initial xylan (g): 0.0\n", + "Adjusted mass of xylog (g): nan\n", + "Adjusted mass of xylose (g): nan\n", + "Adjusted mass of furfural (g): nan\n", + "Adjusted mass of products (g): nan\n", + "Adjusted mass of products / initial xylan (g): nan\n", + "Fractional conversion of xylog nan\n", + "Fractional conversion of xylose nan\n", + "Fractional conversion of furfural nan\n", + "Time (s): 0\n", + "Xylan (g/g): 0.2629999999999995\n", + "Xylog (g/L): 0.0\n", + "Xylose (g/L): 0.0\n", + "Furfural (g/L): 0.0\n", + "FIS (g/g): 0.4444444444444445\n", + "rho_x (g/g): 0.0\n", + "X_G (g/g): 0.40000000000000013\n", + "conv: 1.2664140965305975e-15\n", + "frac_conv_xylog: nan\n", + "frac_conv_xylose: nan\n", + "frac_conv_furfural: nan\n", + "\n", + "Mass of xylan initial (g): 0.1315\n", + "Mass of xylan (g): 0.10591540188050036\n", + "Unadjusted mass of xylog (g): 0.006914596220493513\n", + "Unadjusted mass of xylose (g): 0.019020281681723535\n", + "Unadjusted mass of furfural (g): 1.4157500890530782e-05\n", + "Unadjusted mass of products (g): 0.025949035403107577\n", + "Unadjusted mass of products / initial xylan (g): 0.1973310677042401\n", + "Adjusted mass of xylog (g): 0.006817485224855481\n", + "Adjusted mass of xylose (g): 0.018753154226623034\n", + "Adjusted mass of furfural (g): 1.3958668021136184e-05\n", + "Adjusted mass of products (g): 0.02558459811949965\n", + "Adjusted mass of products / initial xylan (g): 0.1945596815171076\n", + "Fractional conversion of xylog 0.015207571604240364\n", + "Fractional conversion of xylose 0.12549639330363704\n", + "Fractional conversion of furfural 0.00014595565421340117\n", + "Time (s): 30.0\n", + "Xylan (g/g): 0.22785431712490348\n", + "Xylog (g/L): 9.106715375412543\n", + "Xylose (g/L): 25.0502395385376\n", + "Furfural (g/L): 0.018645822102394793\n", + "FIS (g/g): 0.37973144421443683\n", + "rho_x (g/g): 34.156954913950145\n", + "X_G (g/g): 0.42157147345392815\n", + "conv: 0.1945596815171076\n", + "frac_conv_xylog: 0.015207571604240364\n", + "frac_conv_xylose: 0.12549639330363704\n", + "frac_conv_furfural: 0.00014595565421340117\n", + "\n", + "Mass of xylan initial (g): 0.1315\n", + "Mass of xylan (g): 0.08785441459503089\n", + "Unadjusted mass of xylog (g): 0.01168341512858848\n", + "Unadjusted mass of xylose (g): 0.03250388936539956\n", + "Unadjusted mass of furfural (g): 4.782120525736733e-05\n", + "Unadjusted mass of products (g): 0.04423512569924541\n", + "Unadjusted mass of products / initial xylan (g): 0.33638878858741755\n", + "Adjusted mass of xylog (g): 0.011527705296544804\n", + "Adjusted mass of xylose (g): 0.03207069623666546\n", + "Adjusted mass of furfural (g): 4.7183871758831415e-05\n", + "Adjusted mass of products (g): 0.043645585404969094\n", + "Adjusted mass of products / initial xylan (g): 0.33190559243322504\n", + "Fractional conversion of xylog 0.025714526390264707\n", + "Fractional conversion of xylose 0.2146175869830084\n", + "Fractional conversion of furfural 0.0004933674803680091\n", + "Time (s): 60.0\n", + "Xylan (g/g): 0.20003911824116213\n", + "Xylog (g/L): 13.225758755178415\n", + "Xylose (g/L): 36.794772300769935\n", + "Furfural (g/L): 0.054134148034181984\n", + "FIS (g/g): 0.3320703852424122\n", + "rho_x (g/g): 50.020531055948354\n", + "X_G (g/g): 0.43825586781598264\n", + "conv: 0.3319055924332251\n", + "frac_conv_xylog: 0.025714526390264707\n", + "frac_conv_xylose: 0.2146175869830084\n", + "frac_conv_furfural: 0.0004933674803680091\n", + "\n", + "Mass of xylan initial (g): 0.13149999999999998\n", + "Mass of xylan (g): 0.07433432037902826\n", + "Unadjusted mass of xylog (g): 0.015171345272917278\n", + "Unadjusted mass of xylose (g): 0.04264473247027711\n", + "Unadjusted mass of furfural (g): 9.168324919519883e-05\n", + "Unadjusted mass of products (g): 0.05790776099238959\n", + "Unadjusted mass of products / initial xylan (g): 0.44036320146303876\n", + "Adjusted mass of xylog (g): 0.01497692620864263\n", + "Adjusted mass of xylose (g): 0.042098245073545426\n", + "Adjusted mass of furfural (g): 9.05083387836607e-05\n", + "Adjusted mass of products (g): 0.05716567962097172\n", + "Adjusted mass of products / initial xylan (g): 0.43471999711765574\n", + "Fractional conversion of xylog 0.03340860599139548\n", + "Fractional conversion of xylose 0.28172209630965767\n", + "Fractional conversion of furfural 0.0009463799682702167\n", + "Time (s): 90.0\n", + "Xylan (g/g): 0.17722885291230994\n", + "Xylog (g/L): 15.356746625854617\n", + "Xylose (g/L): 43.16587222113059\n", + "Furfural (g/L): 0.09280366390705863\n", + "FIS (g/g): 0.29802452984780514\n", + "rho_x (g/g): 58.52261884698521\n", + "X_G (g/g): 0.451636178128238\n", + "conv: 0.43471999711765574\n", + "frac_conv_xylog: 0.03340860599139548\n", + "frac_conv_xylose: 0.28172209630965767\n", + "frac_conv_furfural: 0.0009463799682702167\n", + "\n", + "Mass of xylan initial (g): 0.1315\n", + "Mass of xylan (g): 0.06377682690456683\n", + "Unadjusted mass of xylog (g): 0.017828509732206916\n", + "Unadjusted mass of xylose (g): 0.050605598714248815\n", + "Unadjusted mass of furfural (g): 0.00014149444268878674\n", + "Unadjusted mass of products (g): 0.06857560288914451\n", + "Unadjusted mass of products / initial xylan (g): 0.5214874744421635\n", + "Adjusted mass of xylog (g): 0.017606892243874028\n", + "Adjusted mass of xylose (g): 0.04997654525711247\n", + "Adjusted mass of furfural (g): 0.00013973559444668696\n", + "Adjusted mass of products (g): 0.06772317309543319\n", + "Adjusted mass of products / initial xylan (g): 0.51500511859645\n", + "Fractional conversion of xylog 0.039275196893812786\n", + "Fractional conversion of xylose 0.33444380096014426\n", + "Fractional conversion of furfural 0.0014611136301459662\n", + "Time (s): 120.0\n", + "Xylan (g/g): 0.15801962686411836\n", + "Xylog (g/L): 16.578350009723906\n", + "Xylose (g/L): 47.05706424922819\n", + "Furfural (g/L): 0.13157265697244322\n", + "FIS (g/g): 0.2728857209704647\n", + "rho_x (g/g): 63.635414258952096\n", + "X_G (g/g): 0.462666484882276\n", + "conv: 0.5150051185964499\n", + "frac_conv_xylog: 0.039275196893812786\n", + "frac_conv_xylose: 0.33444380096014426\n", + "frac_conv_furfural: 0.0014611136301459662\n", + "\n", + "Mass of xylan initial (g): 0.13149999999999998\n", + "Mass of xylan (g): 0.055286712236933135\n", + "Unadjusted mass of xylog (g): 0.01990887545334024\n", + "Unadjusted mass of xylose (g): 0.05704525083234631\n", + "Unadjusted mass of furfural (g): 0.00019503281089425348\n", + "Unadjusted mass of products (g): 0.0771491590965808\n", + "Unadjusted mass of products / initial xylan (g): 0.5866856205063179\n", + "Adjusted mass of xylog (g): 0.019667367366441257\n", + "Adjusted mass of xylose (g): 0.05635325346526845\n", + "Adjusted mass of furfural (g): 0.0001926669313571599\n", + "Adjusted mass of products (g): 0.07621328776306688\n", + "Adjusted mass of products / initial xylan (g): 0.5795687282362502\n", + "Fractional conversion of xylog 0.04387144051322765\n", + "Fractional conversion of xylose 0.37711682927327944\n", + "Fractional conversion of furfural 0.0020145781795900754\n", + "Time (s): 150.0\n", + "Xylan (g/g): 0.141547967070928\n", + "Xylog (g/L): 17.336543113583414\n", + "Xylose (g/L): 49.67470175791504\n", + "Furfural (g/L): 0.16983353693461886\n", + "FIS (g/g): 0.2537984864324628\n", + "rho_x (g/g): 67.01124487149845\n", + "X_G (g/g): 0.47193551431641595\n", + "conv: 0.5795687282362499\n", + "frac_conv_xylog: 0.04387144051322765\n", + "frac_conv_xylose: 0.37711682927327944\n", + "frac_conv_furfural: 0.0020145781795900754\n", + "\n", + "Mass of xylan initial (g): 0.13149999999999998\n", + "Mass of xylan (g): 0.04830884574050471\n", + "Unadjusted mass of xylog (g): 0.021569208971308828\n", + "Unadjusted mass of xylose (g): 0.06237194787744904\n", + "Unadjusted mass of furfural (g): 0.0002510431697139226\n", + "Unadjusted mass of products (g): 0.08419220001847179\n", + "Unadjusted mass of products / initial xylan (g): 0.6402448670606221\n", + "Adjusted mass of xylog (g): 0.021312750948351004\n", + "Adjusted mass of xylose (g): 0.0616303450462114\n", + "Adjusted mass of furfural (g): 0.00024805826493287387\n", + "Adjusted mass of products (g): 0.08319115425949528\n", + "Adjusted mass of products / initial xylan (g): 0.6326323517832342\n", + "Fractional conversion of xylog 0.04754175116488944\n", + "Fractional conversion of xylose 0.4124312063928977\n", + "Fractional conversion of furfural 0.0025937651276251076\n", + "Time (s): 180.0\n", + "Xylan (g/g): 0.12723738796542813\n", + "Xylog (g/L): 17.837554797023177\n", + "Xylose (g/L): 51.58107743037736\n", + "Furfural (g/L): 0.2076105944426184\n", + "FIS (g/g): 0.23895802865596372\n", + "rho_x (g/g): 69.41863222740054\n", + "X_G (g/g): 0.47983626557799897\n", + "conv: 0.6326323517832341\n", + "frac_conv_xylog: 0.04754175116488944\n", + "frac_conv_xylose: 0.4124312063928977\n", + "frac_conv_furfural: 0.0025937651276251076\n", + "\n", + "Mass of xylan initial (g): 0.1315\n", + "Mass of xylan (g): 0.04247716657880298\n", + "Unadjusted mass of xylog (g): 0.022912470618381052\n", + "Unadjusted mass of xylose (g): 0.06685481306264658\n", + "Unadjusted mass of furfural (g): 0.0003087787904468668\n", + "Unadjusted mass of products (g): 0.0900760624714745\n", + "Unadjusted mass of products / initial xylan (g): 0.6849890682241406\n", + "Adjusted mass of xylog (g): 0.022644562819052565\n", + "Adjusted mass of xylose (g): 0.0660731022580613\n", + "Adjusted mass of furfural (g): 0.0003051683440831487\n", + "Adjusted mass of products (g): 0.08902283342119702\n", + "Adjusted mass of products / initial xylan (g): 0.6769797218341979\n", + "Fractional conversion of xylog 0.05051258626303234\n", + "Fractional conversion of xylose 0.44216220522504907\n", + "Fractional conversion of furfural 0.0031909237499188553\n", + "Time (s): 210.0\n", + "Xylan (g/g): 0.11468158892566835\n", + "Xylog (g/L): 18.184685077778212\n", + "Xylose (g/L): 53.05991404098797\n", + "Furfural (g/L): 0.24506501967836639\n", + "FIS (g/g): 0.22718160046140778\n", + "rho_x (g/g): 71.24459911876619\n", + "X_G (g/g): 0.48664504080581544\n", + "conv: 0.6769797218341979\n", + "frac_conv_xylog: 0.05051258626303234\n", + "frac_conv_xylose: 0.44216220522504907\n", + "frac_conv_furfural: 0.0031909237499188553\n", + "\n", + "Mass of xylan initial (g): 0.1315\n", + "Mass of xylan (g): 0.03753886927614635\n", + "Unadjusted mass of xylog (g): 0.024009519909941008\n", + "Unadjusted mass of xylose (g): 0.07067966490454951\n", + "Unadjusted mass of furfural (g): 0.00036777733448924724\n", + "Unadjusted mass of products (g): 0.09505696214897975\n", + "Unadjusted mass of products / initial xylan (g): 0.7228666323116331\n", + "Adjusted mass of xylog (g): 0.02373273443495109\n", + "Adjusted mass of xylose (g): 0.06986485874865324\n", + "Adjusted mass of furfural (g): 0.00036353754024933885\n", + "Adjusted mass of products (g): 0.09396113072385368\n", + "Adjusted mass of products / initial xylan (g): 0.7145333134893815\n", + "Fractional conversion of xylog 0.05293993993094286\n", + "Fractional conversion of xylose 0.4675366973293905\n", + "Fractional conversion of furfural 0.00380124804443225\n", + "Time (s): 240.0\n", + "Xylan (g/g): 0.10358245223431574\n", + "Xylog (g/L): 18.434116863364274\n", + "Xylose (g/L): 54.26669119587129\n", + "Furfural (g/L): 0.28237342475408345\n", + "FIS (g/g): 0.2176799071412333\n", + "rho_x (g/g): 72.70080805923556\n", + "X_G (g/g): 0.4925636808036236\n", + "conv: 0.7145333134893813\n", + "frac_conv_xylog: 0.05293993993094286\n", + "frac_conv_xylose: 0.4675366973293905\n", + "frac_conv_furfural: 0.00380124804443225\n", + "\n", + "Mass of xylan initial (g): 0.13149999999999998\n", + "Mass of xylan (g): 0.03331283850552668\n", + "Unadjusted mass of xylog (g): 0.024910982507703235\n", + "Unadjusted mass of xylose (g): 0.07397959191434413\n", + "Unadjusted mass of furfural (g): 0.00042774044806563415\n", + "Unadjusted mass of products (g): 0.099318314870113\n", + "Unadjusted mass of products / initial xylan (g): 0.755272356426715\n", + "Adjusted mass of xylog (g): 0.024627267042021592\n", + "Adjusted mass of xylose (g): 0.07313702561394125\n", + "Adjusted mass of furfural (g): 0.0004228688385104394\n", + "Adjusted mass of products (g): 0.09818716149447328\n", + "Adjusted mass of products / initial xylan (g): 0.7466704296157665\n", + "Fractional conversion of xylog 0.05493534853480103\n", + "Fractional conversion of xylose 0.4894340877586944\n", + "Fractional conversion of furfural 0.004421632341839197\n", + "Time (s): 270.0\n", + "Xylan (g/g): 0.09371405044340829\n", + "Xylog (g/L): 18.611913645809494\n", + "Xylose (g/L): 55.27288118147163\n", + "Furfural (g/L): 0.3195806620535998\n", + "FIS (g/g): 0.20985292969212352\n", + "rho_x (g/g): 73.88479482728113\n", + "X_G (g/g): 0.4977441754819617\n", + "conv: 0.7466704296157666\n", + "frac_conv_xylog: 0.05493534853480103\n", + "frac_conv_xylose: 0.4894340877586944\n", + "frac_conv_furfural: 0.004421632341839197\n", + "\n", + "Mass of xylan initial (g): 0.1315\n", + "Mass of xylan (g): 0.029666959378235047\n", + "Unadjusted mass of xylog (g): 0.025653835695860876\n", + "Unadjusted mass of xylose (g): 0.07685154625654109\n", + "Unadjusted mass of furfural (g): 0.0004884390651750931\n", + "Unadjusted mass of products (g): 0.10299382101757706\n", + "Unadjusted mass of products / initial xylan (g): 0.7832229735176963\n", + "Adjusted mass of xylog (g): 0.025364706996110452\n", + "Adjusted mass of xylose (g): 0.07598539945859663\n", + "Adjusted mass of furfural (g): 0.0004829341670578819\n", + "Adjusted mass of products (g): 0.10183304062176496\n", + "Adjusted mass of products / initial xylan (g): 0.7743957461731176\n", + "Fractional conversion of xylog 0.056580334997660825\n", + "Fractional conversion of xylose 0.5084954488484033\n", + "Fractional conversion of furfural 0.005049691860871388\n", + "Time (s): 300.0\n", + "Xylan (g/g): 0.08490444058911752\n", + "Xylog (g/L): 18.7295902616478\n", + "Xylose (g/L): 56.10848956171211\n", + "Furfural (g/L): 0.3566041221659421\n", + "FIS (g/g): 0.20325377269553718\n", + "rho_x (g/g): 74.83807982335992\n", + "X_G (g/g): 0.5023018492350889\n", + "conv: 0.7743957461731176\n", + "frac_conv_xylog: 0.056580334997660825\n", + "frac_conv_xylose: 0.5084954488484033\n", + "frac_conv_furfural: 0.005049691860871388\n", + "\n", + "Mass of xylan initial (g): 0.1315\n", + "Mass of xylan (g): 0.026501313546173584\n", + "Unadjusted mass of xylog (g): 0.026266102278982052\n", + "Unadjusted mass of xylose (g): 0.07936874775784959\n", + "Unadjusted mass of furfural (g): 0.0005496871649772514\n", + "Unadjusted mass of products (g): 0.1061845372018089\n", + "Unadjusted mass of products / initial xylan (g): 0.8074869749186988\n", + "Adjusted mass of xylog (g): 0.025972766941701097\n", + "Adjusted mass of xylose (g): 0.07848237115937934\n", + "Adjusted mass of furfural (g): 0.0005435483527459962\n", + "Adjusted mass of products (g): 0.10499868645382643\n", + "Adjusted mass of products / initial xylan (g): 0.7984690985081857\n", + "Fractional conversion of xylog 0.057936717132311695\n", + "Fractional conversion of xylose 0.5252052214467972\n", + "Fractional conversion of furfural 0.005683490380423914\n", + "Time (s): 330.0\n", + "Xylan (g/g): 0.07701720823606935\n", + "Xylog (g/L): 18.793175947198833\n", + "Xylose (g/L): 56.78767353752638\n", + "Furfural (g/L): 0.393296557578727\n", + "FIS (g/g): 0.19755917097495876\n", + "rho_x (g/g): 75.5808494847252\n", + "X_G (g/g): 0.506327430165928\n", + "conv: 0.7984690985081857\n", + "frac_conv_xylog: 0.057936717132311695\n", + "frac_conv_xylose: 0.5252052214467972\n", + "frac_conv_furfural: 0.005683490380423914\n", + "\n", + "Mass of xylan initial (g): 0.1315\n", + "Mass of xylan (g): 0.02373847446231967\n", + "Unadjusted mass of xylog (g): 0.026769569636844417\n", + "Unadjusted mass of xylose (g): 0.08158784221355742\n", + "Unadjusted mass of furfural (g): 0.0006113223934123473\n", + "Unadjusted mass of products (g): 0.10896873424381417\n", + "Unadjusted mass of products / initial xylan (g): 0.8286595759985869\n", + "Adjusted mass of xylog (g): 0.02647300330752698\n", + "Adjusted mass of xylose (g): 0.08068397236393152\n", + "Adjusted mass of furfural (g): 0.0006045498662218347\n", + "Adjusted mass of products (g): 0.10776152553768034\n", + "Adjusted mass of products / initial xylan (g): 0.8194792816553638\n", + "Fractional conversion of xylog 0.059052580255066524\n", + "Fractional conversion of xylose 0.5399383701920892\n", + "Fractional conversion of furfural 0.00632133890536139\n", + "Time (s): 360.0\n", + "Xylan (g/g): 0.06994138518348918\n", + "Xylog (g/L): 18.807886554012235\n", + "Xylose (g/L): 57.32235898283659\n", + "Furfural (g/L): 0.4295056804873612\n", + "FIS (g/g): 0.1925461694332083\n", + "rho_x (g/g): 76.13024553684883\n", + "X_G (g/g): 0.5098938860451155\n", + "conv: 0.8194792816553637\n", + "frac_conv_xylog: 0.059052580255066524\n", + "frac_conv_xylose: 0.5399383701920892\n", + "frac_conv_furfural: 0.00632133890536139\n", + "\n", + "Mass of xylan initial (g): 0.13149999999999998\n", + "Mass of xylan (g): 0.021316683568877583\n", + "Unadjusted mass of xylog (g): 0.027181638376733916\n", + "Unadjusted mass of xylose (g): 0.08355397553098351\n", + "Unadjusted mass of furfural (g): 0.0006732078868768905\n", + "Unadjusted mass of products (g): 0.11140882179459431\n", + "Unadjusted mass of products / initial xylan (g): 0.8472153748638352\n", + "Adjusted mass of xylog (g): 0.02688263832375734\n", + "Adjusted mass of xylose (g): 0.08263487555754147\n", + "Adjusted mass of furfural (g): 0.0006658025498235976\n", + "Adjusted mass of products (g): 0.1101833164311224\n", + "Adjusted mass of products / initial xylan (g): 0.8378959424419956\n", + "Fractional conversion of xylog 0.059966341508001175\n", + "Fractional conversion of xylose 0.5529938440352586\n", + "Fractional conversion of furfural 0.006961813733896935\n", + "Time (s): 390.0\n", + "Xylan (g/g): 0.06358338745891846\n", + "Xylog (g/L): 18.781181650741765\n", + "Xylose (g/L): 57.7317073511001\n", + "Furfural (g/L): 0.4651536981291458\n", + "FIS (g/g): 0.18807784918608297\n", + "rho_x (g/g): 76.51288900184187\n", + "X_G (g/g): 0.5130616734228657\n", + "conv: 0.8378959424419956\n", + "frac_conv_xylog: 0.059966341508001175\n", + "frac_conv_xylose: 0.5529938440352586\n", + "frac_conv_furfural: 0.006961813733896935\n", + "\n", + "Mass of xylan initial (g): 0.1315\n", + "Mass of xylan (g): 0.019185634131302403\n", + "Unadjusted mass of xylog (g): 0.02751647101149009\n", + "Unadjusted mass of xylose (g): 0.08530391867090562\n", + "Unadjusted mass of furfural (g): 0.0007352324277991894\n", + "Unadjusted mass of products (g): 0.11355562211019489\n", + "Unadjusted mass of products / initial xylan (g): 0.8635408525490106\n", + "Adjusted mass of xylog (g): 0.027215693377126496\n", + "Adjusted mass of xylose (g): 0.08437147675823935\n", + "Adjusted mass of furfural (g): 0.0007271957333317737\n", + "Adjusted mass of products (g): 0.11231436586869761\n", + "Adjusted mass of products / initial xylan (g): 0.854101641587054\n", + "Fractional conversion of xylog 0.06070927800220866\n", + "Fractional conversion of xylose 0.5646152056825142\n", + "Fractional conversion of furfural 0.007603757667917786\n", + "Time (s): 420.0\n", + "Xylan (g/g): 0.05786236361184584\n", + "Xylog (g/L): 18.72006328549342\n", + "Xylose (g/L): 58.034140909752544\n", + "Furfural (g/L): 0.5001948677285147\n", + "FIS (g/g): 0.18405770812534872\n", + "rho_x (g/g): 76.75420419524596\n", + "X_G (g/g): 0.5158818960319367\n", + "conv: 0.854101641587054\n", + "frac_conv_xylog: 0.06070927800220866\n", + "frac_conv_xylose: 0.5646152056825142\n", + "frac_conv_furfural: 0.007603757667917786\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Mass of xylan initial (g): 0.13149999999999998\n", + "Mass of xylan (g): 0.017303818768587706\n", + "Unadjusted mass of xylog (g): 0.027785728694856043\n", + "Unadjusted mass of xylose (g): 0.08686802151280779\n", + "Unadjusted mass of furfural (g): 0.000797307169358644\n", + "Unadjusted mass of products (g): 0.11545105737702248\n", + "Unadjusted mass of products / initial xylan (g): 0.8779548089507414\n", + "Adjusted mass of xylog (g): 0.02748371631905158\n", + "Adjusted mass of xylose (g): 0.08592382394121871\n", + "Adjusted mass of furfural (g): 0.0007886409711419849\n", + "Adjusted mass of products (g): 0.11419618123141227\n", + "Adjusted mass of products / initial xylan (g): 0.8684120245734775\n", + "Fractional conversion of xylog 0.06130714920346107\n", + "Fractional conversion of xylose 0.5750035366408555\n", + "Fractional conversion of furfural 0.008246245895971326\n", + "Time (s): 450.0\n", + "Xylan (g/g): 0.05270767279156585\n", + "Xylog (g/L): 18.629690381630404\n", + "Xylose (g/L): 58.24300534353154\n", + "Furfural (g/L): 0.5345760720306583\n", + "FIS (g/g): 0.18040591693815375\n", + "rho_x (g/g): 76.87269572516195\n", + "X_G (g/g): 0.5183981865144879\n", + "conv: 0.8684120245734775\n", + "frac_conv_xylog: 0.06130714920346107\n", + "frac_conv_xylose: 0.5750035366408555\n", + "frac_conv_furfural: 0.008246245895971326\n", + "\n", + "Mass of xylan initial (g): 0.1315\n", + "Mass of xylan (g): 0.01563671957653142\n", + "Unadjusted mass of xylog (g): 0.027999081828672372\n", + "Unadjusted mass of xylose (g): 0.0882715396166711\n", + "Unadjusted mass of furfural (g): 0.0008593613817024473\n", + "Unadjusted mass of products (g): 0.11712998282704593\n", + "Unadjusted mass of products / initial xylan (g): 0.8907223028672694\n", + "Adjusted mass of xylog (g): 0.027696285709401122\n", + "Adjusted mass of xylose (g): 0.0873169268975263\n", + "Adjusted mass of furfural (g): 0.0008500678165411564\n", + "Adjusted mass of products (g): 0.11586328042346858\n", + "Adjusted mass of products / initial xylan (g): 0.8810895849693428\n", + "Fractional conversion of xylog 0.06178132173453229\n", + "Fractional conversion of xylose 0.5843262028123434\n", + "Fractional conversion of furfural 0.008888541807939849\n", + "Time (s): 480.0\n", + "Xylan (g/g): 0.048057355336731736\n", + "Xylog (g/L): 18.516292739334048\n", + "Xylose (g/L): 58.37554524449582\n", + "Furfural (g/L): 0.568311025691788\n", + "FIS (g/g): 0.17707467608479585\n", + "rho_x (g/g): 76.89183798382987\n", + "X_G (g/g): 0.5206479615395219\n", + "conv: 0.8810895849693429\n", + "frac_conv_xylog: 0.06178132173453229\n", + "frac_conv_xylose: 0.5843262028123434\n", + "frac_conv_furfural: 0.008888541807939849\n", + "\n", + "Mass of xylan initial (g): 0.1315\n", + "Mass of xylan (g): 0.01472728607909724\n", + "Unadjusted mass of xylog (g): 0.02810367768774305\n", + "Unadjusted mass of xylose (g): 0.08904553038173652\n", + "Unadjusted mass of furfural (g): 0.0008965601979441652\n", + "Unadjusted mass of products (g): 0.11804576826742373\n", + "Unadjusted mass of products / initial xylan (g): 0.897686450702842\n", + "Adjusted mass of xylog (g): 0.02780059601392519\n", + "Adjusted mass of xylose (g): 0.0880852265847048\n", + "Adjusted mass of furfural (g): 0.000886891322272783\n", + "Adjusted mass of products (g): 0.11677271392090277\n", + "Adjusted mass of products / initial xylan (g): 0.8880054290562948\n", + "Fractional conversion of xylog 0.06201400378264681\n", + "Fractional conversion of xylose 0.5894676760041082\n", + "Fractional conversion of furfural 0.00927357846482948\n", + "Time (s): 498.0\n", + "Xylan (g/g): 0.045486271199255454\n", + "Xylog (g/L): 18.438722060859284\n", + "Xylose (g/L): 58.42245288013397\n", + "Furfural (g/L): 0.5882299279261713\n", + "FIS (g/g): 0.175208185131814\n", + "rho_x (g/g): 76.86117494099325\n", + "X_G (g/g): 0.5218835069033171\n", + "conv: 0.8880054290562948\n", + "frac_conv_xylog: 0.06201400378264681\n", + "frac_conv_xylose: 0.5894676760041082\n", + "frac_conv_furfural: 0.00927357846482948\n", + "\n", + "Pretreatment wallclock time: 0.35 s.\n", + "Finished Pretreatment\n", + "\n", + "Running Enzymatic Hydrolysis Model\n", + "\n", + "FINAL OUTPUTS (at t = 24 hours)\n", + "Conversion Rate = 0.4937\n", + "rho_g = 24.53 g/L\n", + "rho_x = 23.25 g/L\n", + "rho_sL = 3.242 g/L\n", + "rho_f = 0.1679 g/L\n", + "Finished Enzymatic Hydrolysis\n", + "\n", + "Running Bioreactor\n", + "\n", + "INPUTS\n", + "Gas velocity = 0.08 m/s\n", + "Column height = 40.00 m\n", + "Column diameter = 5.00 m\n", + "Bubble diameter = 0.0060 m\n", + "OUR_max = 87.69 mol/m^3/hr\n", + "t_final = 100.0 s\n", + "\n", + "FINAL OUTPUTS (at t = 100.0 seconds)\n", + "OUR = 68.3978 mol/m^3/hr\n", + "Finished Bioreactor\n" + ] } ], "source": [ @@ -677,7 +1290,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 9, "id": "130891c9", "metadata": {}, "outputs": [ @@ -724,6 +1337,38 @@ "\n", "display(a)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "60905d23", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "88860133", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "04f1021e", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3ca6bd14", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -745,7 +1390,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.9" + "version": "3.13.11" }, "widgets": { "application/vnd.jupyter.widget-state+json": { From 9eb7c160b34810d346336df36a360868c52c17ef Mon Sep 17 00:00:00 2001 From: Pittman Date: Thu, 29 Jan 2026 15:10:26 -0700 Subject: [PATCH 2/5] Wire deacetylation pretreatment into VE and output yields/pH --- applications/Bioconversion/Models_classes.py | 11 +- .../deacetylation_model/deacetylation.py | 273 ++++++++---------- 2 files changed, 131 insertions(+), 153 deletions(-) diff --git a/applications/Bioconversion/Models_classes.py b/applications/Bioconversion/Models_classes.py index 0c61af3..35e796b 100644 --- a/applications/Bioconversion/Models_classes.py +++ b/applications/Bioconversion/Models_classes.py @@ -270,14 +270,9 @@ def run_pt_deacetylation(self, verbose=True): print('\nRunning deacetylation pretreatment') sys.path.append(os.path.join(self.pt_module_path, 'deacetylation_model')) from deacetylation import deacetylate - deacetylate(self.ve,verbose,self.show_plots) - self.ve.pt_out = {} - self.ve.pt_out['X_X']=self.ve.feedstock['xylan_solid_fraction'] - self.ve.pt_out['X_G']=self.ve.feedstock['glucan_solid_fraction'] - self.ve.pt_out['conv']=0.0 - self.ve.pt_out["fis_0"] = self.ve.pt_in['initial_solid_fraction'] - self.ve.pt_out["rho_f"] = 0.0 - self.ve.pt_out["rho_x"]=730.0 + + deacetylate(self.ve, verbose, self.show_plots) + # deacetylate() will populate pt(out). return True ################################################################################### diff --git a/applications/Bioconversion/models/pretreatment_model/deacetylation_model/deacetylation.py b/applications/Bioconversion/models/pretreatment_model/deacetylation_model/deacetylation.py index 43cd2f8..2172a6e 100644 --- a/applications/Bioconversion/models/pretreatment_model/deacetylation_model/deacetylation.py +++ b/applications/Bioconversion/models/pretreatment_model/deacetylation_model/deacetylation.py @@ -34,61 +34,6 @@ pKa_ace = 4.76 pK_Naace = 4.76 - -### -# Typical Composition of Cob Types -# Corn Husk -Husk_C = 0.38 # fraction of cellulose -%/100- -Husk_H = 0.35 # fraction of hemicellulose -%/100- -Husk_L = 0.15 # fraction of lignin -%/100- -Husk_Ep = 0.126 # effective porosity -Husk_T = 5.5 # tortuosity -Husk_v = 0.65 # void fraction -# Corn Cob -Cob_C = 0.33 # fraction of cellulose -%/100- -Cob_H = 0.36 # fraction of hemicellulose -%/100- -Cob_L = 0.17 # fraction of lignin -%/100- -Cob_Ep = 0.126 # effective porosity -Cob_T = 10.3 # tortuosity -Cob_v = 0.65 # void fraction -# Corn Stalk -Stalk_C = 0.40 # fraction of cellulose -%/100- -Stalk_H = 0.28 # fraction of hemicellulose -%/100- -Stalk_L = 0.21 # fraction of lignin -%/100- -Stalk_Ep = 0.671 # effective porosity -Stalk_T = 1.36 # tortuosity -Stalk_v = 0.65 # void fraction -# Acetyl Groups -Acy_P = 0.023 #0.023 #0.0223 # weight percentage of acetate in biomass -# Acy_P = 0.027 # switchgrass -# Lignin Groups -Lig_P = 0.153 # weight percentage of lignin in biomass -# Lig_P = 0.192 # switchgrass -# Xylan Groups -Xy_P = 0.213 # corn stover -# Xy_P = 0.218 # switchgrass - -loops = (3,6) -corn = np.zeros(loops) -corn[0,0] = Husk_Ep -corn[0,1] = Husk_T -corn[0,2] = Husk_v -corn[0,3] = Husk_C -corn[0,4] = Husk_H -corn[0,5] = Husk_L -corn[1,0] = Cob_Ep -corn[1,1] = Cob_T -corn[1,2] = Cob_v -corn[1,3] = Cob_C -corn[1,4] = Cob_H -corn[1,5] = Cob_L -corn[2,0] = Stalk_Ep -corn[2,1] = Stalk_T -corn[2,2] = Stalk_v -corn[2,3] = Stalk_C -corn[2,4] = Stalk_H -corn[2,5] = Stalk_L - ### # Molar Mass - g/mol - M_NaOH = 40 @@ -127,8 +72,8 @@ ### # VARIABLE SET INITIAL CONDITIONS t_final = 7200 # Total reaction time -Sec- -120 min- #7200 #5400 -Tf = 365.15 # Operating Fluid Temperature -K- -363.15|90 C- -323.15|50 deg C- -V_DA = 55 # Volume of Deacetylation Reactor -L- #30 #20 +Tf = 363.15 # Operating Fluid Temperature -K- -363.15|90 C- -323.15|50 deg C- +V_DA = 20 # Volume of Deacetylation Reactor -L- #30 #20 pHi_DA = 7 # Inital pH pOHi_DA = 14-pHi_DA # Initial pOH Part = 0.75 # particle size -inch- @@ -139,9 +84,16 @@ C_Husk = 10 # corn husk C_Cob = 10 # corn cob C_Stalk = 10 # corn stalk -C_NaOH = 9.09 # sodium hydoxide # 4.55 6.36 9.09 # 9.47 5.35 # 2.61 2.01 1.41 +C_NaOH = 2.01 # sodium hydoxide # 4.55 6.36 9.09 # 9.47 5.35 # 2.61 2.01 1.41 # Biomass -W_BM = 5000 # biomass -g- #600 +W_BM = 600 # biomass -g- #600 #5000 + +# Acetyl Groups +Acy_P = 0.023 #0.023 #0.0223 # weight percentage of acetate in biomass +# Lignin Groups +Lig_P = 0.153 # weight percentage of lignin in biomass +# Xylan Groups +Xy_P = 0.213 # corn stover # Acetyl Groups C_acy = W_BM*Acy_P/V_DA # acetyl groups -g/L-2 Molar_acy = C_acy/M_acy @@ -158,8 +110,6 @@ ####################################### # Set UP Matrices ####################################### - -### = # Calculation Matrix -row 0 g/L- -row 1 mol/L- loops=(1,12) DAC = np.zeros(loops) @@ -168,9 +118,9 @@ DAC[0,0] = 0 # Acetate DAC[0,1] = 0 # Acetic Acid DAC[0,2] = 0 # Sodium Acetate -DAC[0,3] = (C_Husk*Husk_C)+(C_Cob*Cob_C)+(C_Stalk*Stalk_C) # Cellulose -DAC[0,4] = C_xy # Hemicellulose -DAC[0,5] = C_lig # Lignin +DAC[0,3] = 0 # Cellulose +DAC[0,4] = C_xy # Hemicellulose +DAC[0,5] = C_lig # Lignin DAC[0,6] = C_acy # Acetyl Groups DAC[0,7] = 0 # Deacetylated Xylan DAC[0,8] = C_NaOH # Sodium Hydroxide @@ -199,40 +149,19 @@ ############################################### ### DEFINE FUNCTION -def DACy(t, y): - # Arrehnius Rate Kinetics - # Lignin - kT_arh_L = Arc_L*np.exp(-Ea_L/(R*Tf)) # -L/(mol-s)- - # Acetate - kT_arh = Arc*np.exp(-Ea/(R*Tf)) # -L/(mol-s)- - # Xylan - kT_arh_X = Arc_X*np.exp(-Ea_X/(R*Tf)) # -L/(mol-s)- - # Define Rate Equation - # Lignin - dligdt = kT_arh_L*y[3]*y[1] # -mol/L-s- - # Change value - dClig_dt = -dligdt - dCslig_dt = +dligdt - # Acetate - dacedt = kT_arh*y[0]*y[1] # -mol/L-s- - # Change value - dCacy_dt = -dacedt - dCace_dt = +dacedt - # Xylan - dxydt = kT_arh_X*y[5]*y[1] # -mol/L-s- - dCxyo_dt = +dxydt - dCxy_dt = -dxydt - dCOH_dt =-(dacedt+(1.2*dligdt)+(dxydt)) - return [dCacy_dt, dCOH_dt, dCace_dt, dClig_dt, dCslig_dt, dCxy_dt, dCxyo_dt] - +############################################### ############################################### ### INTEGRATE def deacetylate(ve_params,verbose=True,show_plots=True): print("doing deacetylation..") - Tf=ve_params.pt_in['deacetylation temperature'] + + # Read VE Inputs + Tf=ve_params.pt_in['deacetylation_temperature'] Acy_P = ve_params.pt_in['acetylfrac'] - t_span = (0,t_final) - t_span = (0,t_final) + fis_in = float(ve_params.pt_in['initial_solid_fraction']) + fis_dac = float(ve_params.pt_in.get('deacetylation_solid_fraction', fis_in)) + + # Initial Conditions Cacetyl = M_DAC[0,6] COH = M_DAC[0,10] Cace = M_DAC[0,0] @@ -241,70 +170,124 @@ def deacetylate(ve_params,verbose=True,show_plots=True): Cxyoh = 0 Clig = M_DAC[0,5] Cslig = 0 + t_span = (0,t_final) y0 = [Cacetyl, COH, Cace, Clig, Cslig, Cxy, Cxyo] - sol_DA = solve_ivp(DACy,t_span, y0, method='BDF', rtol=1e-6, atol=1e-9) - - ############################################ - # EXPERIMENTAL TIME POINTS - ############################################ - times = np.array([0,5,10,15,20,25,30,40,50,60,70,80,90,100,110,120], dtype=int) - # Acetate Experimental Time Points - acetate_interp = np.interp(times, sol_DA.t/60, sol_DA.y[2]*M_ace) - acetyl_interp = np.interp(times, sol_DA.t/60, sol_DA.y[0]*M_acy) - DAC_exp_ace = np.vstack((times, acetate_interp, acetyl_interp)).T + def DACy(t, y): + # Arrehnius Rate Kinetics + ################################ + # Lignin + kT_arh_L = Arc_L*np.exp(-Ea_L/(R*Tf)) # -L/(mol-s)- + # Acetate + kT_arh = Arc*np.exp(-Ea/(R*Tf)) # -L/(mol-s)- + # Xylan + kT_arh_X = Arc_X*np.exp(-Ea_X/(R*Tf)) # -L/(mol-s)- - Macetate_interp = np.interp(times, sol_DA.t/60, sol_DA.y[2]) - Macetyl_interp = np.interp(times, sol_DA.t/60, sol_DA.y[0]) + # Define Rate Equation + ################################ + # Lignin + dligdt = kT_arh_L*y[3]*y[1] # -mol/L-s- + # Change value + dClig_dt = -dligdt + dCslig_dt = +dligdt + # Acetate + dacedt = kT_arh*y[0]*y[1] # -mol/L-s- + # Change value + dCacy_dt = -dacedt + dCace_dt = +dacedt + # Xylan + dxydt = kT_arh_X*y[5]*y[1] # -mol/L-s- + dCxyo_dt = +dxydt + dCxy_dt = -dxydt + # Final Hydroxide Stoichiometry + dCOH_dt =-(dacedt+(1.2*dligdt)+(dxydt)) + return [dCacy_dt, dCOH_dt, dCace_dt, dClig_dt, dCslig_dt, dCxy_dt, dCxyo_dt] - # Lignin Experimental Time Points - lignin_interp = np.interp(times, sol_DA.t/60, sol_DA.y[3]*M_Lig) - Slignin_interp = np.interp(times, sol_DA.t/60, sol_DA.y[4]*M_Lig) - DAC_exp_lig = np.vstack((times, Slignin_interp, lignin_interp)).T + # Integrate + sol_DA = solve_ivp(DACy,t_span, y0, method='BDF', rtol=1e-6, atol=1e-9) - # Xylan Experimental Time Points - Xylan_interp = np.interp(times, sol_DA.t/60, sol_DA.y[5]*M_Hem) - Xylose_interp = np.interp(times, sol_DA.t/60, sol_DA.y[6]*M_X) - OH_interp = np.interp(times, sol_DA.t/60, sol_DA.y[1]*M_NaOH) - DAC_exp_xyo = np.vstack((times, Xylan_interp, Xylose_interp)).T + # Retreive Final Value + Cacetyl_f, COH_f, Cace_f, Clig_f, Cslig_f, Cxy_f, Cxyo_f = [float(sol_DA.y[i, -1]) for i in range(7)] - # pH Experimental Time Points + # pH Calculation + ############################################# # Calculate pKw Hnot0 = 55.83 Kw2 = 10**(-14)*((Hnot0/R)*((1/289.15)-(1/Tf))) pKw = -np.log10(Kw2) - OH_interp = np.interp(times, sol_DA.t/60, sol_DA.y[1]*M_OH) - pH = pKw+np.log10(OH_interp) - DAC_exp_pH = np.vstack((times, pH)).T + OH_final = sol_DA.y[1, -1] * M_OH + pH = pKw+np.log10(OH_final) + + # Yield Calculations + ################################################# + Cace_f_gL = Cace_f * M_ace + ace_yield = Cace_f_gL / C_ace_max # acetate yield + Clig_f_gL = Clig_f * M_Lig + lig_yield = Clig_f_gL / C_lig_max # total lignin yield + Cxy_f_gL = Cxy_f * M_X + xyl_yield = Cxy_f_gL / C_xyo_max # total xylose yield + + # Dewatering Calculations + ################################################# + # Avoid divide-by-zero / nonsense + if fis_dac <= 0 or fis_dac >= 1 or fis_in <= 0 or fis_in >= 1: + s = 1.0 + else: + s = ((1.0 - fis_dac) / (1.0 - fis_in)) * (fis_in / fis_dac) + # Liquid concentrations increase when liquid decreases + Cxy_f_dw = Cxy_f / s + Cxyo_f_dw = Cxyo_f / s + Cace_f_dw = Cace_f / s - ############################################ - # CREATE GRAPHS - ############################################ - # Acetate - '''plt.plot(sol_DA.t/60, sol_DA.y[2]*M_ace,color=(1, 0.5, 0.8)) - plt.title('Deacetylation Time Profile') - plt.xlabel('Time (min)') - plt.ylabel('Species Concentration (g/L)') - plt.show() + if not hasattr(ve_params, "pt_out") or ve_params.pt_out is None: + ve_params.pt_out = {} - # Lignin - plt.plot(sol_DA.t/60, sol_DA.y[4]*M_Lig,color=(0.1, 0.3, 0.7)) - plt.title('Lignin Solubilization Time Profile') - plt.xlabel('Time (min)') - plt.ylabel('Species Concentration (g/L)') - plt.show() + # standard VE pretreatment outputs expected downstream + ve_params.pt_out["fis_0"] = fis_dac + ve_params.pt_out["X_X"] = float(ve_params.feedstock["xylan_solid_fraction"]) + ve_params.pt_out["X_G"] = float(ve_params.feedstock["glucan_solid_fraction"]) + ve_params.pt_out["conv"] = 0.0 + # Furfural + ve_params.pt_out["rho_f"] = 0.0 + # pH + ve_params.pt_out["pH_final"] = float(pH_final) + # Theoretical Maximum Yield + ve_params.pt_out["C_ace_max_gL"] = float(C_ace_max) + ve_params.pt_out["C_lig_max_gL"] = float(C_lig_max) + ve_params.pt_out["C_xyo_max_gL"] = float(C_xyo_max) + # Actual Yield + ve_params.pt_out["ace_yield"] = float(ace_yield) + ve_params.pt_out["lig_yield"] = float(lig_yield) + ve_params.pt_out["xyl_yield"] = float(xyl_yield) + # Final Concentration - before dewatering + ve_params.pt_out["Cace_final_gL_pre_dewater"] = float(Cace_f_gL) + ve_params.pt_out["Clig_final_gL_pre_dewater"] = float(Clig_f_gL) + ve_params.pt_out["Cxy_final_gL_pre_dewater"] = float(Cxy_f_gL) + # Final Concentration - after dewatering + ve_params.pt_out["Cxy_final_dewatered"] = float(Cxy_f_dw) + ve_params.pt_out["Cxyo_final_dewatered"] = float(Cxyo_f_dw) + ve_params.pt_out["Cace_final_dewatered"] = float(Cace_f_dw) + + return ve_params.pt_out - # Xylose - plt.plot(times, DAC_exp_xyo[:,2],color=(0, 0.7, 0.3)) - plt.title('Xylose Time Profile') - plt.xlabel('Time (min)') - plt.ylabel('Species Concentration (g/L)') - plt.show() +if __name__ == "__main__": + class DummyVE: + def __init__(self): + self.pt_in = { + "deacetylation_temperature": 350.0, + "acetylfrac": 0.5, + "initial_solid_fraction": 0.2, + "deacetylation_solid_fraction": 0.3, + } + self.feedstock = { + "xylan_solid_fraction": 0.25, + "glucan_solid_fraction": 0.35, + } + self.pt_out = {} - # pH - plt.plot(times, DAC_exp_pH[:,1],color=(1, 0.5, 0.5)) - plt.title('pH Time Profile') - plt.xlabel('Time (min)') - plt.ylabel('Species Concentration (g/L)') - plt.show()''' + ve = DummyVE() + deacetylate(ve, verbose=True, show_plots=False) + print("pt_out keys:", ve.pt_out.keys()) + for k, v in ve.pt_out.items(): + print(k, v) From 7e8e22bc77e9f8993819d4fe306646dbde4bdbb3 Mon Sep 17 00:00:00 2001 From: hsitaram Date: Fri, 6 Feb 2026 10:19:38 -0700 Subject: [PATCH 3/5] fixing some variable errors --- applications/Bioconversion/Models_classes.py | 4 ++-- .../pretreatment_model/deacetylation_model/deacetylation.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/Bioconversion/Models_classes.py b/applications/Bioconversion/Models_classes.py index 35e796b..e3a5c0c 100644 --- a/applications/Bioconversion/Models_classes.py +++ b/applications/Bioconversion/Models_classes.py @@ -205,13 +205,13 @@ def acetylfrac(self,a): @property def DAtemp(self): - return self.ve.pt_in['deacetylation temperature'] + return self.ve.pt_in['deacetylation_temperature'] @DAtemp.setter def DAtemp(self,a): if not 200 < a < 600: raise ValueError(f"Value {a} is outside allowed interval (200, 600)") - self.ve.pt_in['deacetylation temperature'] = float(a) + self.ve.pt_in['deacetylation_temperature'] = float(a) @property def model_type(self): diff --git a/applications/Bioconversion/models/pretreatment_model/deacetylation_model/deacetylation.py b/applications/Bioconversion/models/pretreatment_model/deacetylation_model/deacetylation.py index 2172a6e..fdf346e 100644 --- a/applications/Bioconversion/models/pretreatment_model/deacetylation_model/deacetylation.py +++ b/applications/Bioconversion/models/pretreatment_model/deacetylation_model/deacetylation.py @@ -251,7 +251,7 @@ def DACy(t, y): # Furfural ve_params.pt_out["rho_f"] = 0.0 # pH - ve_params.pt_out["pH_final"] = float(pH_final) + #ve_params.pt_out["pH_final"] = float(pH_final) # Theoretical Maximum Yield ve_params.pt_out["C_ace_max_gL"] = float(C_ace_max) ve_params.pt_out["C_lig_max_gL"] = float(C_lig_max) From e8021f8c566c7ec9b6692a7677947f6c865fb794 Mon Sep 17 00:00:00 2001 From: hsitaram Date: Fri, 6 Feb 2026 10:27:36 -0700 Subject: [PATCH 4/5] setting rho_x in deacetylation --- .../pretreatment_model/deacetylation_model/deacetylation.py | 1 + 1 file changed, 1 insertion(+) diff --git a/applications/Bioconversion/models/pretreatment_model/deacetylation_model/deacetylation.py b/applications/Bioconversion/models/pretreatment_model/deacetylation_model/deacetylation.py index fdf346e..e3daaa0 100644 --- a/applications/Bioconversion/models/pretreatment_model/deacetylation_model/deacetylation.py +++ b/applications/Bioconversion/models/pretreatment_model/deacetylation_model/deacetylation.py @@ -268,6 +268,7 @@ def DACy(t, y): ve_params.pt_out["Cxy_final_dewatered"] = float(Cxy_f_dw) ve_params.pt_out["Cxyo_final_dewatered"] = float(Cxyo_f_dw) ve_params.pt_out["Cace_final_dewatered"] = float(Cace_f_dw) + ve_params.pt_out['rho_x']=float(Cxy_f_dw) return ve_params.pt_out From c7f5f50f7c662df7f0887372f4deef47267081ff Mon Sep 17 00:00:00 2001 From: Young Date: Fri, 6 Feb 2026 10:29:42 -0700 Subject: [PATCH 5/5] add a run option to pt_init --- applications/Bioconversion/tests/test_model_class.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/applications/Bioconversion/tests/test_model_class.py b/applications/Bioconversion/tests/test_model_class.py index a70b1c1..dbc8ef8 100644 --- a/applications/Bioconversion/tests/test_model_class.py +++ b/applications/Bioconversion/tests/test_model_class.py @@ -31,6 +31,8 @@ def build_fs_options(): def build_pt_options(): pt_options = WidgetCollection() + pt_options.model_type = widgets.RadioButtons( + options = ['dilute acid', 'deacetylation'], value = 'dilute acid') pt_options.initial_acid_conc = OptimizationWidget('BoundedFloatText', {'value': 0.0001*1e-6}) pt_options.steam_temperature = OptimizationWidget('BoundedFloatText', {'value': 150.0, 'max': 300.0}) pt_options.initial_solid_fraction = OptimizationWidget('BoundedFloatText', {'value': 0.745}) @@ -126,6 +128,9 @@ def test_br_init(build_br_options): def test_pt_run(build_pt_options): pt_options = build_pt_options PT_model = Pretreatment(pt_options, hpc_run=False) + for k in range(10): + print("eky") + print(dir(PT_model)) PT_model.run(verbose=False, show_plots=False) for k, it in PT_model.ve.pt_out.items(): print(k, it)