Biologische Komponenten API¶
pyadm1.components.biological.digester.Digester
¶
Bases: Component
Digester component using ADM1 model.
This component wraps the ADM1 implementation and can be connected to other digesters or components in series/parallel.
Attributes:
feedstock (Feedstock): Feedstock object for substrate management.
V_liq (float): Liquid volume in m³.
V_gas (float): Gas volume in m³.
T_ad (float): Operating temperature in K.
adm1 (ADM1): ADM1 model instance.
simulator (Simulator): Simulator for ADM1.
adm1_state (List[float]): Current ADM1 state vector (37 dimensions).
Q_substrates (List[float]): Substrate feed rates in m³/d.
Example:
>>> feedstock = Feedstock(feeding_freq=48)
>>> digester = Digester("dig1", feedstock, V_liq=2000, V_gas=300)
>>> digester.initialize({"adm1_state": initial_state, "Q_substrates": [15, 10, 0, 0, 0, 0, 0, 0, 0, 0]})
Source code in pyadm1/components/biological/digester.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
Functions¶
__init__(component_id, feedstock, V_liq=1977.0, V_gas=304.0, T_ad=308.15, name=None)
¶
Initialize digester component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component_id
|
str
|
Unique identifier. |
required |
feedstock
|
Feedstock
|
Feedstock object for substrate management. |
required |
V_liq
|
float
|
Liquid volume in m³. Defaults to 1977.0. |
1977.0
|
V_gas
|
float
|
Gas volume in m³. Defaults to 304.0. |
304.0
|
T_ad
|
float
|
Operating temperature in K. Defaults to 308.15 (35°C). |
308.15
|
name
|
Optional[str]
|
Human-readable name. Defaults to component_id. |
None
|
Source code in pyadm1/components/biological/digester.py
apply_calibration_parameters(parameters)
¶
Apply calibration parameters to this digester.
Stores parameters for use during simulation. These override the substrate-dependent parameters calculated from feedstock.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
dict
|
Parameter values as {param_name: value}. |
required |
Example
digester.apply_calibration_parameters({ ... 'k_dis': 0.55, ... 'Y_su': 0.105, ... 'k_hyd_ch': 11.0 ... })
Source code in pyadm1/components/biological/digester.py
clear_calibration_parameters()
¶
Clear all calibration parameters and revert to default substrate-dependent values.
Example
digester.clear_calibration_parameters()
Source code in pyadm1/components/biological/digester.py
from_dict(config, feedstock)
classmethod
¶
Create from dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Dict[str, Any]
|
Component configuration. |
required |
feedstock
|
Feedstock
|
Feedstock object. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Digester |
Digester
|
Initialized digester component. |
Source code in pyadm1/components/biological/digester.py
get_calibration_parameters()
¶
Get currently applied calibration parameters.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Current calibration parameters as {param_name: value}. |
Example
params = digester.get_calibration_parameters() print(params)
Source code in pyadm1/components/biological/digester.py
initialize(initial_state=None)
¶
Initialize digester state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_state
|
Optional[Dict[str, Any]]
|
Initial state with keys: - 'adm1_state': ADM1 state vector (37 dims) - 'Q_substrates': Substrate feed rates If None, uses default initialization. |
None
|
Source code in pyadm1/components/biological/digester.py
step(t, dt, inputs)
¶
Perform one simulation time step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float
|
Current time in days. |
required |
dt
|
float
|
Time step in days. |
required |
inputs
|
Dict[str, Any]
|
Input data with keys: - 'Q_substrates': Fresh substrate feed rates [m³/d] - 'Q_in': Influent from previous digester [m³/d] - 'state_in': ADM1 state from previous digester (if connected) |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: Output data with keys: - 'Q_out': Effluent flow rate [m³/d] - 'state_out': ADM1 state vector for next digester - 'Q_gas': Biogas production [m³/d] - 'Q_ch4': Methane production [m³/d] - 'Q_co2': CO2 production [m³/d] - 'pH': pH value - 'VFA': VFA concentration [g/L] - 'TAC': TAC concentration [g CaCO3/L] |
Source code in pyadm1/components/biological/digester.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
to_dict()
¶
Serialize to dictionary.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: Component configuration as dictionary. |
Source code in pyadm1/components/biological/digester.py
pyadm1.components.biological.hydrolysis.Hydrolysis
¶
Bases: Component
Hydrolysis tank component (stub for future implementation).
This component models a separate hydrolysis stage in a multi-stage biogas plant.
Attributes:
| Name | Type | Description |
|---|---|---|
component_id |
Unique identifier for the component. |
|
feedstock |
Feedstock object for substrate management. |
|
V_liq |
Liquid volume of the tank [m³]. |
|
T_ad |
Operating temperature [K]. |
|
name |
Optional human-readable name. |
Source code in pyadm1/components/biological/hydrolysis.py
Functions¶
__init__(component_id, feedstock, V_liq=500.0, T_ad=318.15, name=None)
¶
Initialize the Hydrolysis tank.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component_id
|
str
|
Unique identifier. |
required |
feedstock
|
Feedstock
|
Feedstock object. |
required |
V_liq
|
float
|
Liquid volume [m³]. |
500.0
|
T_ad
|
float
|
Operating temperature [K]. |
318.15
|
name
|
Optional[str]
|
Optional name. |
None
|
Source code in pyadm1/components/biological/hydrolysis.py
from_dict(config, feedstock)
classmethod
¶
Create a Hydrolysis instance from a configuration dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Dict[str, Any]
|
Configuration dictionary. |
required |
feedstock
|
Feedstock
|
Feedstock object. |
required |
Returns:
| Type | Description |
|---|---|
Hydrolysis
|
A new Hydrolysis instance. |
Source code in pyadm1/components/biological/hydrolysis.py
initialize(initial_state=None)
¶
Initialize the component state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_state
|
Optional[Dict[str, Any]]
|
Optional dictionary containing initial state values. |
None
|
step(t, dt, inputs)
¶
Execute one simulation time step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float
|
Current simulation time [days]. |
required |
dt
|
float
|
Time step size [days]. |
required |
inputs
|
Dict[str, Any]
|
Dictionary of input values from other components. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dictionary of output values. |
Source code in pyadm1/components/biological/hydrolysis.py
to_dict()
¶
Serialize the component to a dictionary.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dictionary containing component configuration. |
Source code in pyadm1/components/biological/hydrolysis.py
pyadm1.components.biological.separator.Separator
¶
Bases: Component
Solid-liquid separator component (stub for future implementation).
This component models mechanical separation of digestate into solid and liquid fractions.
Attributes:
| Name | Type | Description |
|---|---|---|
component_id |
Unique identifier. |
|
separation_efficiency |
Efficiency of solid removal (0-1). |
|
name |
Optional name. |
Source code in pyadm1/components/biological/separator.py
Functions¶
__init__(component_id, separation_efficiency=0.95, name=None)
¶
Initialize the Separator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component_id
|
str
|
Unique identifier. |
required |
separation_efficiency
|
float
|
Separation efficiency (default: 0.95). |
0.95
|
name
|
Optional[str]
|
Optional name. |
None
|
Source code in pyadm1/components/biological/separator.py
from_dict(config)
classmethod
¶
Create instance from dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Dict[str, Any]
|
Configuration dictionary. |
required |
Returns:
| Type | Description |
|---|---|
Separator
|
New Separator instance. |
Source code in pyadm1/components/biological/separator.py
initialize(initial_state=None)
¶
Initialize component state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_state
|
Optional[Dict[str, Any]]
|
Optional initial state. |
None
|
step(t, dt, inputs)
¶
Execute one simulation step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float
|
Current time [days]. |
required |
dt
|
float
|
Time step [days]. |
required |
inputs
|
Dict[str, Any]
|
Input dictionary. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Output dictionary. |
Source code in pyadm1/components/biological/separator.py
to_dict()
¶
Serialize to dictionary.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Configuration dictionary. |