Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cooling demand #415

Merged
merged 7 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions atlite/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,81 @@ def heat_demand(cutout, threshold=15.0, a=1.0, constant=0.0, hour_shift=0.0, **p
)


# cooling demand
def convert_cooling_demand(ds, threshold, a, constant, hour_shift):
# Temperature is in Kelvin; take daily average
T = ds["temperature"]
T = T.assign_coords(
time=(T.coords["time"] + np.timedelta64(dt.timedelta(hours=hour_shift)))
)

T = T.resample(time="1D").mean(dim="time")
threshold += 273.15
cooling_demand = a * (T - threshold)

cooling_demand = cooling_demand.clip(min=0.0)

return (constant + cooling_demand).rename("cooling_demand")


def cooling_demand(
cutout, threshold=23.0, a=1.0, constant=0.0, hour_shift=0.0, **params
):
"""
Convert outside temperature into daily cooling demand using the degree-day
approximation.

Since "daily average temperature" means different things in
different time zones and since xarray coordinates do not handle
time zones gracefully like pd.DateTimeIndex, you can provide an
hour_shift to redefine when the day starts.

E.g. for Moscow in summer, hour_shift = 3, for New York in summer,
hour_shift = -4

This time shift applies across the entire spatial scope of ds for
all times. More fine-grained control will be built in a some
point, i.e. space- and time-dependent time zones.

WARNING: Because the original data is provided every month, at the
month boundaries there is untidiness if you use a time shift. The
resulting xarray will have duplicates in the index for the parts
of the day in each month at the boundary. You will have to
re-average these based on the number of hours in each month for
the duplicated day.

Parameters
----------
threshold : float
Outside temperature in degrees Celsius below which there is no
cooling demand. The default 23C is taken as a more liberal
estimation following European computational practices
(e.g. UK Met Office and European commission take as thresholds
22C and 24C, respectively)
a : float
Linear factor relating cooling demand to outside temperature.
constant : float
Constant part of cooling demand that does not depend on outside
temperature (e.g. due to ventilation).
hour_shift : float
Time shift relative to UTC for taking daily average

Note
----
You can also specify all of the general conversion arguments
documented in the `convert_and_aggregate` function.

"""
return cutout.convert_and_aggregate(
convert_func=convert_cooling_demand,
threshold=threshold,
a=a,
constant=constant,
hour_shift=hour_shift,
**params,
)


# solar thermal collectors
def convert_solar_thermal(
ds, orientation, trigon_model, clearsky_model, c0, c1, t_store
Expand Down
3 changes: 3 additions & 0 deletions atlite/cutout.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from atlite.convert import (
coefficient_of_performance,
convert_and_aggregate,
cooling_demand,
csp,
dewpoint_temperature,
heat_demand,
Expand Down Expand Up @@ -644,6 +645,8 @@ def layout_from_capacity_list(self, data, col="Capacity"):

convert_and_aggregate = convert_and_aggregate

cooling_demand = cooling_demand

heat_demand = heat_demand

temperature = temperature
Expand Down
2 changes: 1 addition & 1 deletion doc/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ relevant quantities, mainly you can create data for
* **Solar (PV)** power generation: Using predefined or custom panel properties.
* **Solar (thermal)** heat generation from solar collectors.
* **Hydro (run-off)** power generation.
* **Heating demand** (based on degree-day approx.).
* **Heating and cooling demand** (based on degree-day approx.).

How it works
========================
Expand Down
2 changes: 2 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@

* The option ``capacity_factor_timeseries`` can be selected when creating capacity factors to obtain
the capacity factor of the selected resource per grid cell.

* The methods ``convert_cooling_demand`` and ``cooling_demand`` are implemented to evaluate cooling demand using the cooling degree-days approximation.