Skip to content

chp

CHP

CHP(max_gas_power_uptake, efficiency_rules, minimum_load, mttf, mttr, load_change_time, capex, biogas, storage_rules, *, stepless_intervals)

A class that represents a combined heat and power unit.

Parameters:

Name Type Description Default
max_gas_power_uptake int

Maximum power of gas the CHP can process [kW].

required
efficiency_rules ndarray

A 2D array with the efficiency rules of the CHP showing efficiency at different loads.

[[gas load state 1, eta_el1, eta_th1], [gas load state 2, eta_el2, eta_th2], ...]

required
minimum_load float

Minimum load the CHP can operate at.

required
mttf int

Mean time to failure (Time between two maintenances) [h].

required
mttr int

Mean time to repair [h].

required
load_change_time float

Time after changing the load until a new change can be made [hours].

required
capex int

Capital expenditure of the CHP.

required
biogas GasMix

Mixture of gas. Contains fractions of each gas.

required
storage_rules ndarray

A 2D array with the storage rules of the CHP showing the gas load at different fill levels.

[[threshold1, tendency1, gas load1], [threshold2, tendency2, gas load2], ...]

required
stepless_intervals boolean

Describes whether the CHP can operate at any load between minimum_load and 1.

required
Source code in src/bsm2_python/energy_management/chp.py
def __init__(
    self,
    max_gas_power_uptake: int,
    efficiency_rules: np.ndarray,
    minimum_load: float,
    mttf: int,
    mttr: int,
    load_change_time: float,
    capex: int,
    biogas: GasMix,
    storage_rules: np.ndarray,
    *,
    stepless_intervals: bool,
):
    self.max_gas_power_uptake = max_gas_power_uptake
    self.efficiency_rules = efficiency_rules
    self.storage_rules = storage_rules
    self.stepless_intervals = stepless_intervals
    self.minimum_load = minimum_load
    self.mttf = mttf
    self.mttr = mttr
    self.load_change_time = load_change_time
    self._products = np.array([0.0, 0.0])
    self._consumption = np.array([0.0])
    self._load = 0.0
    self.capex = capex
    self.biogas = biogas
    # costs for operation & maintenance, €/h at full load
    # costs chp o&m €/kWh: -8 * 10^(-7) * P(CHP) + 0.0132  10.1016/j.apenergy.2014.03.085
    # self.max_gas_power_uptake * self.get_efficiencies(1)[0] * 1 is power electric at load = 1
    self.o_and_m = (
        (-8 * pow(10, -7) * self.max_gas_power_uptake * self.get_efficiencies(1)[0] * 1 + 0.0132)
        * self.max_gas_power_uptake
        * self.get_efficiencies(1)[0]
        * 1
    )

get_efficiencies

get_efficiencies(load)

Returns the efficiency of the CHP at a certain load.

Parameters:

Name Type Description Default
load float

Load of the CHP.

required

Returns:

Type Description
ndarray

Array with the electrical and thermal efficiency of the CHP.

[eta_el, eta_th]

Source code in src/bsm2_python/energy_management/chp.py
def get_efficiencies(self, load: float):
    """Returns the efficiency of the CHP at a certain load.

    Parameters
    ----------
    load : float
        Load of the CHP.

    Returns
    -------
    np.ndarray
        Array with the electrical and thermal efficiency of the CHP. \n
        [eta_el, eta_th]
    """

    threshold = 1e-5
    if load - self.minimum_load < -threshold:
        if load > threshold:
            # logger.warning('Load below minimum load, efficiencies set to 0')
            pass
        return np.array([0.0, 0.0])
    else:
        closest_rule = np.argmin(np.abs(self.efficiency_rules[:, 0] - load))
        # electrical efficiency, thermal efficiency
        return np.array([self.efficiency_rules[closest_rule, 1], self.efficiency_rules[closest_rule, 2]])

get_consumption

get_consumption(load)

Returns the consumption of the CHP at a certain load.

Parameters:

Name Type Description Default
load float

Load of the CHP.

required

Returns:

Type Description
ndarray

Gas consumption of the CHP at the given load [Nm³/h].

[biogas consumption]

Source code in src/bsm2_python/energy_management/chp.py
def get_consumption(self, load: float):
    """Returns the consumption of the CHP at a certain load.

    Parameters
    ----------
    load : float
        Load of the CHP.

    Returns
    -------
    np.ndarray
        Gas consumption of the CHP at the given load [Nm³/h]. \n
        [biogas consumption]
    """

    threshold = 1e-5
    if load - self.minimum_load < -threshold:
        if load > threshold:
            # logger.warning('Load below minimum load, consumption set to 0')
            pass
        return np.array([0.0])
    else:
        return np.array([self.max_gas_power_uptake * load / self.biogas.h_u])

get_products

get_products(load)

Returns the products of the CHP at a certain load.

Parameters:

Name Type Description Default
load float

Load of the CHP.

required

Returns:

Type Description
ndarray

Array with the electrical and thermal power produced by the CHP [kW, kW].

[el_power, th_power]

Source code in src/bsm2_python/energy_management/chp.py
def get_products(self, load: float):
    """Returns the products of the CHP at a certain load.

    Parameters
    ----------
    load : float
        Load of the CHP.

    Returns
    -------
    np.ndarray
        Array with the electrical and thermal power produced by the CHP [kW, kW]. \n
        [el_power, th_power]
    """

    threshold = 1e-5
    if load - self.minimum_load < -threshold:
        if load > threshold:
            # logger.warning('Load below minimum load, products set to 0')
            pass
        return np.array([0.0, 0.0])
    else:
        el_power = self.max_gas_power_uptake * self.get_efficiencies(load)[0] * load
        th_power = self.max_gas_power_uptake * self.get_efficiencies(load)[1] * load
        return np.array([el_power, th_power])

consume

consume()

Returns the consumption of the CHP at the current load.

Returns:

Type Description
ndarray

Gas consumption of the CHP at the current load [Nm³/h].

[biogas consumption]

Source code in src/bsm2_python/energy_management/chp.py
def consume(self) -> np.ndarray:
    """Returns the consumption of the CHP at the current load.

    Returns
    -------
    np.ndarray
        Gas consumption of the CHP at the current load [Nm³/h]. \n
        [biogas consumption]
    """

    return self.get_consumption(self._load)

produce

produce()

Returns the products of the CHP at the current load.

Returns:

Type Description
ndarray

Products of the CHP at the current load [kW, kW].

[el_power, th_power]

Source code in src/bsm2_python/energy_management/chp.py
def produce(self) -> np.ndarray:
    """Returns the products of the CHP at the current load.

    Returns
    -------
    np.ndarray
        Products of the CHP at the current load [kW, kW]. \n
        [el_power, th_power]
    """

    return self.get_products(self._load)

calculate_maintenance_time

calculate_maintenance_time()

Returns the duration of the maintenance.

Returns:

Type Description
float

Duration of the maintenance [hours].

Source code in src/bsm2_python/energy_management/chp.py
def calculate_maintenance_time(self) -> float:
    """Returns the duration of the maintenance.

    Returns
    -------
    float
        Duration of the maintenance [hours].
    """

    return self.mttr

check_failure

check_failure()

Returns whether the CHP goes into maintenance or not.

Returns:

Type Description
bool
  • True: If the CHP goes into maintenance.
  • False: Otherwise.
Source code in src/bsm2_python/energy_management/chp.py
def check_failure(self) -> bool:
    """Returns whether the CHP goes into maintenance or not.

    Returns
    -------
    bool
        - True: If the CHP goes into maintenance.
        - False: Otherwise.
    """

    if self.time_since_last_maintenance > 0:
        return self.time_since_last_maintenance >= self.mttf
    else:
        return False