Energiekomponenten API¶
pyadm1.components.energy.chp.CHP
¶
Bases: Component
Combined Heat and Power unit.
Converts biogas to electricity and heat with configurable efficiency.
Attributes:
| Name | Type | Description |
|---|---|---|
P_el_nom |
float
|
Nominal electrical power in kW. |
eta_el |
float
|
Electrical efficiency (0-1). |
eta_th |
float
|
Thermal efficiency (0-1). |
load_factor |
float
|
Current operating point (0-1). |
Example
chp = CHP("chp1", P_el_nom=500, eta_el=0.40, eta_th=0.45) chp.initialize() result = chp.step(t=0, dt=1/24, inputs={"Q_ch4": 1000})
Source code in pyadm1/components/energy/chp.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 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 | |
Functions¶
__init__(component_id, P_el_nom=500.0, eta_el=0.4, eta_th=0.45, name=None)
¶
Initialize CHP unit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component_id
|
str
|
Unique identifier. |
required |
P_el_nom
|
float
|
Nominal electrical power in kW. Defaults to 500.0. |
500.0
|
eta_el
|
float
|
Electrical efficiency (0-1). Defaults to 0.40. |
0.4
|
eta_th
|
float
|
Thermal efficiency (0-1). Defaults to 0.45. |
0.45
|
name
|
Optional[str]
|
Human-readable name. Defaults to component_id. |
None
|
Source code in pyadm1/components/energy/chp.py
from_dict(config)
classmethod
¶
Create from dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Dict[str, Any]
|
Component configuration. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
CHP |
CHP
|
Initialized CHP component. |
Source code in pyadm1/components/energy/chp.py
initialize(initial_state=None)
¶
Initialize CHP state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_state
|
Optional[Dict[str, Any]]
|
Initial state with keys: - 'load_factor': Initial load factor (0-1) If None, uses default initialization. |
None
|
Source code in pyadm1/components/energy/chp.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_ch4': Methane flow rate [m³/d] (direct input) - 'Q_gas_supplied_m3_per_day': Available biogas from storage [m³/d] - 'load_setpoint': Desired load factor [0-1] (optional) |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: Output data with keys: - 'P_el': Electrical power [kW] - 'P_th': Thermal power [kW] - 'Q_gas_consumed': Biogas consumption [m³/d] - 'Q_gas_out_m3_per_day': Gas demand for connected storages [m³/d] - 'Q_ch4_remaining': Remaining methane [m³/d] |
Source code in pyadm1/components/energy/chp.py
to_dict()
¶
Serialize to dictionary.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: Component configuration as dictionary. |
Source code in pyadm1/components/energy/chp.py
pyadm1.components.energy.heating.HeatingSystem
¶
Bases: Component
Heating system for maintaining digester temperature.
Calculates heat demand and energy consumption based on temperature difference and available waste heat from CHP.
Attributes:
| Name | Type | Description |
|---|---|---|
target_temperature |
Target digester temperature in K. |
|
heat_loss_coefficient |
Heat loss coefficient in kW/K. |
|
feedstock |
Feedstock used to derive per-substrate density and c_p for the sensible-heat term. Optional — when omitted, only the UAΔT loss term contributes to demand. |
Example
heating = HeatingSystem("heat1", target_temperature=308.15, heat_loss_coefficient=0.5) heating.initialize() result = heating.step(t=0, dt=1/24, inputs={"T_digester": 308.15, "P_th_available": 200})
Source code in pyadm1/components/energy/heating.py
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 | |
Functions¶
__init__(component_id, target_temperature=308.15, heat_loss_coefficient=0.5, name=None, feedstock=None)
¶
Initialize heating system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component_id
|
str
|
Unique identifier. |
required |
target_temperature
|
float
|
Target digester temperature in K. Defaults to 308.15 (35°C). |
308.15
|
heat_loss_coefficient
|
float
|
Heat loss coefficient in kW/K. Defaults to 0.5. |
0.5
|
name
|
Optional[str]
|
Human-readable name. Defaults to component_id. |
None
|
feedstock
|
Optional :class: |
None
|
Source code in pyadm1/components/energy/heating.py
from_dict(config)
classmethod
¶
Create from dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Dict[str, Any]
|
Component configuration. |
required |
Returns:
| Type | Description |
|---|---|
HeatingSystem
|
Initialized heating system component. |
Source code in pyadm1/components/energy/heating.py
initialize(initial_state=None)
¶
Initialize heating system state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_state
|
Optional[Dict[str, Any]]
|
Initial state (not used currently). |
None
|
Source code in pyadm1/components/energy/heating.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: - 'T_digester': Current digester temperature [K] - 'T_ambient': Ambient temperature [K] - 'V_liq': Liquid volume [m³] - 'P_th_available': Available thermal power from CHP [kW] - 'Q_substrates': Substrate feed rates [m³/d] |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Output data with keys: - 'Q_heat_supplied': Heat supplied [kW] - 'P_th_used': Thermal power used from CHP [kW] - 'P_aux_heat': Auxiliary heating needed [kW] |
Source code in pyadm1/components/energy/heating.py
to_dict()
¶
Serialize to dictionary.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Component configuration as dictionary. |
Source code in pyadm1/components/energy/heating.py
pyadm1.components.energy.gas_storage.GasStorage
¶
Bases: Component
Gas storage component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component_id
|
str
|
unique id |
required |
storage_type
|
str
|
'membrane' | 'dome' | 'compressed' |
'membrane'
|
capacity_m3
|
float
|
usable gas volume at STP (m^3) |
1000.0
|
p_min_bar
|
float
|
minimum operating pressure (bar) |
0.95
|
p_max_bar
|
float
|
maximum safe pressure (bar) |
1.05
|
name
|
Optional[str]
|
optional human-readable name |
None
|
Source code in pyadm1/components/energy/gas_storage.py
39 40 41 42 43 44 45 46 47 48 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 | |
Functions¶
__init__(component_id, storage_type='membrane', capacity_m3=1000.0, p_min_bar=0.95, p_max_bar=1.05, initial_fill_fraction=0.1, name=None)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component_id
|
str
|
unique id |
required |
storage_type
|
str
|
'membrane' | 'dome' | 'compressed' |
'membrane'
|
capacity_m3
|
float
|
usable gas volume at STP (m^3) |
1000.0
|
p_min_bar
|
float
|
minimum operating pressure (bar) |
0.95
|
p_max_bar
|
float
|
maximum safe pressure (bar) |
1.05
|
initial_fill_fraction
|
float
|
initial stored fraction of capacity (0-1) |
0.1
|
name
|
Optional[str]
|
optional human-readable name |
None
|
Source code in pyadm1/components/energy/gas_storage.py
from_dict(config)
classmethod
¶
Create GasStorage from dict produced by to_dict.
Source code in pyadm1/components/energy/gas_storage.py
initialize(initial_state=None)
¶
Initialize storage state; initial_state may contain stored_volume_m3, pressure_setpoint_bar.
Source code in pyadm1/components/energy/gas_storage.py
step(t, dt, inputs)
¶
One simulation step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float
|
|
required |
dt
|
float
|
|
required |
inputs
|
Dict[str, Any]
|
Inputs dictionary may contain: - 'Q_gas_in_m3_per_day' : gas inflow from digesters/other sources (m^3/day) - 'Q_gas_out_m3_per_day' : requested gas outflow (demand) (m^3/day) - 'set_pressure' : desired pressure setpoint (bar) (optional) - 'vent_to_flare' : bool, if True allow venting to flare when overpressure (default True) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
object |
Dict[str, Any]
|
Returns outputs_data with keys: - 'stored_volume_m3' - 'pressure_bar' - 'utilization' (0-1) - 'vented_volume_m3' (this timestep) - 'Q_gas_supplied_m3_per_day' (actual supply that was delivered) |
Source code in pyadm1/components/energy/gas_storage.py
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 | |
to_dict()
¶
Serialize configuration + current state.
Source code in pyadm1/components/energy/gas_storage.py
pyadm1.components.energy.flare.Flare
¶
Bases: Component
Flare component for combusting vented biogas.
The flare accepts an input Q_gas_in_m3_per_day and will combust it.
It reports vented_volume_m3 for the current timestep and cumulative_vented_m3.
Parameters¶
component_id : str Unique id for the flare component. destruction_efficiency : float Fraction of methane destroyed (0..1). Default 0.98. name : Optional[str] Human readable name.
Source code in pyadm1/components/energy/flare.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 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 | |
Functions¶
from_dict(config)
classmethod
¶
Instantiate Flare from dict created by to_dict.
Source code in pyadm1/components/energy/flare.py
initialize(initial_state=None)
¶
Initialize flare internal state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_state
|
Optional[Dict[str, Any]]
|
optional dict with 'cumulative_vented_m3' to restore state. |
None
|
Source code in pyadm1/components/energy/flare.py
step(t, dt, inputs)
¶
Process one timestep and combust incoming gas.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float
|
current simulation time [days] |
required |
dt
|
float
|
timestep length [days] |
required |
inputs
|
Dict[str, Any]
|
dictionary that may contain: - 'Q_gas_in_m3_per_day': inflow (m³/day) - 'CH4_fraction': methane fraction in the gas (0..1). Default 0.6 |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
outputs_data dict with keys: - 'vented_volume_m3' (this timestep) - 'cumulative_vented_m3' - 'CH4_destroyed_m3' (m³ of CH4 destroyed this step) |
Source code in pyadm1/components/energy/flare.py
to_dict()
¶
Serialize flare configuration and state.
Source code in pyadm1/components/energy/flare.py
pyadm1.components.energy.boiler.Boiler
¶
Bases: Component
Auxiliary gas boiler for backup and peak heating.
Covers the residual heat demand (P_aux_heat from :class:HeatingSystem)
that CHP waste heat cannot supply. Supports biogas-only, natural-gas-only,
or dual-fuel operation.
Attributes:
| Name | Type | Description |
|---|---|---|
P_th_nom |
float
|
Nominal thermal output [kW]. |
efficiency |
float
|
Rated thermal efficiency at full load (0-1). |
fuel_type |
str
|
Fuel mode: |
lhv_biogas |
float
|
Lower heating value of biogas [kWh/m3]. |
lhv_natural_gas |
float
|
LHV of natural gas [kWh/m3]. |
Example
boiler = Boiler("boiler_1", P_th_nom=200.0, fuel_type="dual", ... efficiency=0.92) boiler.initialize() out = boiler.step(t=0, dt=1/24, ... inputs={"P_th_demand": 80.0, ... "Q_gas_available_m3_per_day": 50.0})
Source code in pyadm1/components/energy/boiler.py
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 | |
Functions¶
__init__(component_id, P_th_nom=200.0, efficiency=0.9, fuel_type='dual', lhv_biogas=_LHV_BIOGAS, lhv_natural_gas=_LHV_NATURAL_GAS, name=None)
¶
Initialize boiler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component_id
|
str
|
Unique identifier. |
required |
P_th_nom
|
float
|
Nominal thermal power [kW]. Default 200. |
200.0
|
efficiency
|
float
|
Rated full-load thermal efficiency (0-1). Default 0.90. |
0.9
|
fuel_type
|
str
|
Fuel mode — |
'dual'
|
lhv_biogas
|
float
|
Lower heating value of biogas [kWh/m3]. Default 6.0 (KTBL 2013 at 60% CH4). |
_LHV_BIOGAS
|
lhv_natural_gas
|
float
|
Lower heating value of natural gas [kWh/m3]. Default 10.0 (DVGW G 260 H-gas). |
_LHV_NATURAL_GAS
|
name
|
Optional[str]
|
Human-readable display name. |
None
|
Source code in pyadm1/components/energy/boiler.py
from_dict(config)
classmethod
¶
Create Boiler from dictionary (produced by :meth:to_dict).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Dict[str, Any]
|
Configuration dictionary. |
required |
Returns:
| Type | Description |
|---|---|
Boiler
|
Initialized Boiler instance. |
Source code in pyadm1/components/energy/boiler.py
initialize(initial_state=None)
¶
Initialize boiler state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_state
|
Optional[Dict[str, Any]]
|
Optional dict with keys:
- |
None
|
Source code in pyadm1/components/energy/boiler.py
step(t, dt, inputs)
¶
Perform one simulation time step.
The boiler fires to satisfy P_th_demand up to its nominal
capacity. Gas is drawn first from available biogas (if provided),
then from the natural gas grid if the fuel mode allows it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float
|
Current simulation time [days]. |
required |
dt
|
float
|
Time step [days]. |
required |
inputs
|
Dict[str, Any]
|
Dict with optional keys:
- |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict with keys:
- |
Source code in pyadm1/components/energy/boiler.py
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 | |
to_dict()
¶
Serialize configuration and cumulative state to dictionary.