Skip to content

Commit

Permalink
Fix cop calculation to changed slope and offset
Browse files Browse the repository at this point in the history
  • Loading branch information
fwitte committed Jul 17, 2024
1 parent 87c7760 commit c95c760
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions workshop/model/solph-offset.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,28 @@
"\n",
"# oemof-solph model with variable partload efficiency\n",
"\n",
"The final modification in our energy system model is to implement the load dependent variable COP. To do that we can use\n",
"the `OffsetConverter`. This component requires different input compared to our previous implementations. Instead of\n",
"a conversion factor connecting input with output as shown in eq. {eq}`simple-conversion`, we define a slope and an \n",
"offset (eq. {eq}`slope-offset-conversion`). This also changes the overall efficiency value in an interesting way per eq.\n",
"{eq}`offset-efficiency`: We have nonlinear efficiency in a linear model. We can visualize the effect in\n",
"{numref}`heatpump-offset-converter`. For that we load the TESPy results and plot the compressor power and COP over the\n",
"heat production.\n",
"The final modification in our energy system model is to implement the load dependent variable COP. To do that we can\n",
"use the `OffsetConverter`. This component requires different input compared to our previous implementations. Instead of\n",
"a conversion factor connecting input with output as shown in eq. {eq}`simple-conversion`, we define a slope {math}`m`\n",
"and a normed offset {math}`E_0`. By setting the reference to the heat output of the heat pump, the compressor power\n",
"can be determined from the slope and the offset following eq. {eq}`slope-offset-conversion`.\n",
"This also changes the overall efficiency value in an interesting way per eq. {eq}`offset-efficiency`: We have nonlinear\n",
"efficiency in a linear model. We can visualize the effect in {numref}`heatpump-offset-converter`. For that we load the\n",
"TESPy results and plot the compressor power and COP over the heat production.\n",
"\n",
"```{math}\n",
":label: simple-conversion\n",
"E_\\text{out} = \\eta \\cdot E_\\text{in}\n",
"\\dot E_\\text{in} = \\frac{1}{\\text{COP}} \\cdot \\dot E_\\text{out}\n",
"```\n",
"\n",
"```{math}\n",
":label: slope-offset-conversion\n",
"E_\\text{out} = E_0 + m \\cdot \\dot E_\\text{in}\n",
"\\dot E_\\text{in} = E_0 \\cdot \\dot E_\\text{out,nominal} + m \\cdot \\dot E_\\text{out}\n",
"```\n",
"\n",
"```{math}\n",
":label: offset-efficiency\n",
"\\eta = \\frac{E_\\text{out}}{E_0 + m \\cdot \\dot E_\\text{in}}\n",
"\\text{COP} = \\frac{\\dot E_\\text{out}}{E_0 \\cdot \\dot E_\\text{out,nominal} + m \\cdot \\dot E_\\text{out}}\n",
"```\n",
"\n",
"```{glue:figure} heatpump-offset-converter\n",
Expand All @@ -54,11 +55,11 @@
"\n",
"example = tespy_coefficients.loc[7]\n",
"\n",
"heat_production_range = np.linspace(0.5, 1) * 9.1e3\n",
"compressor_power = (heat_production_range - example.loc[\"offset\"]) / example.loc[\"slope\"]\n",
"heat_nominal = 9.1e3\n",
"heat_production_range = np.linspace(0.5, 1) * heat_nominal\n",
"compressor_power = example.loc[\"offset\"] * heat_nominal + example.loc[\"slope\"] * heat_production_range\n",
"cop = heat_production_range / compressor_power\n",
"\n",
"\n",
"fig, ax = plt.subplots(2, sharex=True)\n",
"\n",
"ax[0].plot(heat_production_range, compressor_power)\n",
Expand Down Expand Up @@ -141,7 +142,7 @@
"source": [
"import oemof.solph as solph\n",
"\n",
"hp_thermal_power = 9.1 # kW\n",
"hp_thermal_power = heat_nominal / 1e3 # kW\n",
"\n",
"slope = input_data[\"slope\"][:-1]\n",
"offset = input_data[\"offset\"][:-1]\n",
Expand Down

0 comments on commit c95c760

Please sign in to comment.