adm1_performance ¶
ADM1Performance ¶
ADM1Performance(adm1_obj)
Class for ADM1 reactor performance variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adm1_obj | ADM1Reactor | ADM1Reactor instance. | required |
Attributes:
| Name | Type | Description |
|---|---|---|
dim | ndarray(2) | Reactor dimensions of the anaerobic digestor [m³]. [V_LIQ, V_GAS] |
hydrogen_concentration | float | Concentration of hydrogen in the biogas [mol ⋅ m⁻³]. |
methane_concentration | float | Concentration of methane in the biogas [mol ⋅ m⁻³]. |
carbon_dioxide_concentration | float | Concentration of carbon dioxide in the biogas [mol ⋅ m⁻³]. |
Source code in src/bsm2_python/bsm2/adm1_performance.py
def __init__(self, adm1_obj: ADM1Reactor):
self.dim = adm1_obj.dim
self.hydrogen_concentration = 0
self.methane_concentration = 0
self.carbon_dioxide_concentration = 0
energy_consumption ¶
energy_consumption(t_new, t_old, rho_h2o=997, cp_h2o=4182)
Returns the energy required to heat up the reactor from t_old to t_new.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t_new | float | The new temperature of the reactor [K]. | required |
t_old | float | The old temperature of the reactor [K]. | required |
rho_h2o | float | The density of water [kg ⋅ m⁻³]. | 997 |
cp_h2o | float | The specific heat capacity of water [J ⋅ (kg ⋅ K)⁻¹]. | 4182 |
Returns:
| Name | Type | Description |
|---|---|---|
heat_in_kwh | float | Energy required to heat up the reactor [kWh]. |
Source code in src/bsm2_python/bsm2/adm1_performance.py
def energy_consumption(self, t_new, t_old, rho_h2o=997, cp_h2o=4182):
"""Returns the energy required to heat up the reactor from t_old to t_new.
Parameters
----------
t_new : float
The new temperature of the reactor [K].
t_old : float
The old temperature of the reactor [K].
rho_h2o : float
The density of water [kg ⋅ m⁻³].
cp_h2o : float
The specific heat capacity of water [J ⋅ (kg ⋅ K)⁻¹].
Returns
-------
heat_in_kwh : float
Energy required to heat up the reactor [kWh].
"""
vol_reactor = self.dim[0]
# Q = mcΔT
heat_in_joules = rho_h2o * vol_reactor * cp_h2o * (t_new - t_old)
heat_in_kwh = heat_in_joules / (3600 * 1000) # Convert from joules to kilowatts
return heat_in_kwh
reactor_temperature ¶
reactor_temperature(heat_in_kwh, t_old, rho_h2o=997, cp_h2o=4182)
Returns the new temperature of the reactor after energy has been supplied to the reactor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
heat_in_kwh | float | Energy supplied to heat up the reactor [kWh]. | required |
t_old | float | The old temperature of the reactor [K]. | required |
rho_h2o | float | The density of water [kg ⋅ m⁻³]. | 997 |
cp_h2o | float | The specific heat capacity of water [J ⋅ (kg ⋅ K)⁻¹]. | 4182 |
Returns:
| Name | Type | Description |
|---|---|---|
t_new | float | The new temperature of the reactor [K]. |
Source code in src/bsm2_python/bsm2/adm1_performance.py
def reactor_temperature(self, heat_in_kwh, t_old, rho_h2o=997, cp_h2o=4182):
"""Returns the new temperature of the reactor after energy has been supplied to the reactor.
Parameters
----------
heat_in_kwh : float
Energy supplied to heat up the reactor [kWh].
t_old : float
The old temperature of the reactor [K].
rho_h2o : float
The density of water [kg ⋅ m⁻³].
cp_h2o : float
The specific heat capacity of water [J ⋅ (kg ⋅ K)⁻¹].
Returns
-------
t_new : float
The new temperature of the reactor [K].
"""
vol_reactor = self.dim[0]
t_new = t_old + (heat_in_kwh * 3600 * 1000) / (rho_h2o * vol_reactor * cp_h2o)
return t_new
biogas_productions ¶
biogas_productions(hydrogen_concentration, methane_concentration, carbon_dioxide_concentration)
Returns the total biogas production [kWh] from the ADM1 reactor based on the last output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hydrogen_concentration | float | Hydrogen concentration in the biogas [mol ⋅ m⁻³]. | required |
methane_concentration | float | Methane concentration in the biogas [mol ⋅ m⁻³]. | required |
carbon_dioxide_concentration | float | Carbon dioxide concentration in the biogas [mol ⋅ m⁻³]. | required |
Returns:
| Name | Type | Description |
|---|---|---|
total_energy_kwh | float | Total biogas production [kWh]. |
Source code in src/bsm2_python/bsm2/adm1_performance.py
def biogas_productions(self, hydrogen_concentration, methane_concentration, carbon_dioxide_concentration):
"""Returns the total biogas production [kWh] from the ADM1 reactor based on the last output.
Parameters
----------
hydrogen_concentration : float
Hydrogen concentration in the biogas [mol ⋅ m⁻³].
methane_concentration : float
Methane concentration in the biogas [mol ⋅ m⁻³].
carbon_dioxide_concentration : float
Carbon dioxide concentration in the biogas [mol ⋅ m⁻³].
Returns
-------
total_energy_kwh : float
Total biogas production [kWh].
"""
# convert the concentration to kg/m3
hydrogen_concentration = hydrogen_concentration * 2.016 / 1000
methane_concentration = methane_concentration * 16.04 / 1000
carbon_dioxide_concentration = carbon_dioxide_concentration * 44.01 / 1000
# calculate the total energy in the biogas
self.hydrogen_concentration = hydrogen_concentration
self.methane_concentration = methane_concentration
self.carbon_dioxide_concentration = carbon_dioxide_concentration
methane_lhv = 890 # [kWh/kg]
hydrogen_lhv = 33 # [kWh/kg]
total_energy_kwh = (
self.hydrogen_concentration * hydrogen_lhv + self.methane_concentration * methane_lhv
) * self.dim[1]
return total_energy_kwh