compressor ¶
Compressor ¶
Compressor(gas, p_in, p_out, eta, max_gas_flow, t_in, opex_factor)
A class that represents a compressor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gas | GasMix | Mixture of gas. Contains fractions of each gas. | required |
p_in | float | Inlet pressure [bar]. | required |
p_out | float | Outlet pressure [bar]. | required |
eta | float | Electrical efficiency [-]. | required |
max_gas_flow | float | Maximum flow of gas compressor is designed to handle [Nm³/h]. | required |
t_in | float | Inlet temperature [°C]. | required |
opex_factor | float | Factor for the operational expenditure [1/h]. | required |
Source code in src/bsm2_python/energy_management/compressor.py
def __init__(
self, gas: GasMix, p_in: float, p_out: float, eta: float, max_gas_flow: float, t_in: float, opex_factor: float
):
self.gas = gas
self.p_in = p_in
self.p_out = p_out
self.eta = eta
self.t_in = t_in
self.t_out = (
((self.t_in + 273.15) * ((self.p_out / self.p_in) ** (self.gas.kappa - 1)) - (self.t_in + 273.15))
/ self.eta
+ (self.t_in + 273.15)
- 273.15
)
self.max_gas_flow = max_gas_flow
self.max_el_power_uptake = (
self.gas.cp
* (t_in + 273.15)
* max_gas_flow
* self.gas.rho_norm
/ self.eta
* ((self.p_out / self.p_in) ** ((self.gas.kappa - 1) / self.gas.kappa) - 1)
) / 3600
self.opex_factor = opex_factor
self.capex = 88000 * pow(self.max_el_power_uptake, 0.55) # source https://doi.org/10.1016/j.egypro.2013.06.183
calculate_load ¶
calculate_load(gas_flow)
Calculates the load of the compressor based on the gas flow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gas_flow | float | Gas flow [Nm³/h]. | required |
Returns:
| Type | Description |
|---|---|
float | Load of the compressor [-]. |
Source code in src/bsm2_python/energy_management/compressor.py
def calculate_load(self, gas_flow: float) -> float:
"""Calculates the load of the compressor based on the gas flow.
Parameters
----------
gas_flow : float
Gas flow [Nm³/h].
Returns
-------
float
Load of the compressor [-].
"""
if self.max_gas_flow > 0:
threshold = 1e-5
if gas_flow - self.max_gas_flow > threshold:
raise ValueError('gas flow too high for compressor')
else:
return float(gas_flow / self.max_gas_flow)
else:
return 0
produce ¶
produce()
Returns the production of the compressor. Compressor does not produce anything, only here to satisfy the Module interface.
Source code in src/bsm2_python/energy_management/compressor.py
@staticmethod
def produce() -> np.ndarray:
"""Returns the production of the compressor.
Compressor does not produce anything, only here to satisfy the Module interface.
"""
return np.array([0.0])
consume ¶
consume()
Returns the consumption of the compressor.
Returns:
| Type | Description |
|---|---|
ndarray | Consumption of the compressor [kW]. [electricity] |
Source code in src/bsm2_python/energy_management/compressor.py
def consume(self) -> np.ndarray:
"""Returns the consumption of the compressor.
Returns
-------
np.ndarray
Consumption of the compressor [kW]. \n
[electricity]
"""
return np.array([self._load * self.max_el_power_uptake])
calculate_maintenance_time ¶
calculate_maintenance_time()
Returns the maintenance time of the compressor.
(Currently not implemented)
Source code in src/bsm2_python/energy_management/compressor.py
@staticmethod
def calculate_maintenance_time() -> float:
"""Returns the maintenance time of the compressor. <br>
(Currently not implemented)
"""
return 0.0
check_failure ¶
check_failure()
Returns if the compressor has failed.
(Currently not implemented)
Source code in src/bsm2_python/energy_management/compressor.py
@staticmethod
def check_failure() -> bool:
"""Returns if the compressor has failed. <br>
(Currently not implemented)
"""
return False