Updated Notebook files

This commit is contained in:
Radu C. Martin 2021-07-30 16:21:14 +02:00
parent 0afd8dfc79
commit c915a9e472
25 changed files with 1073 additions and 909 deletions

View file

@ -1,5 +1,12 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Library to compute solar angles and irradiation components:"
]
},
{
"cell_type": "code",
"execution_count": 1,
@ -9,6 +16,13 @@
"import pvlib"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Math libraries:"
]
},
{
"cell_type": "code",
"execution_count": 2,
@ -65,6 +79,13 @@
"| 8 | 21.07.2017 20:00 | 24.07.2017 06:00 |"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First, manually check one experiment to see the available and the missing data."
]
},
{
"cell_type": "markdown",
"metadata": {},
@ -110,6 +131,28 @@
"measured_vals"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The available data has, therefore, the following columns:"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"| Power | HVAC Electrical Power consumption |\n",
"|-------------|-----------------------------------|\n",
"| Setpoint | HVAC Setpoint Temperature |\n",
"| OutsideTemp | Outside Temperature measurement |\n",
"| SupplyTemp | HVAC Air Supply Temperature |\n",
"| InsideTemp | Inside Temperature measurement 1 |\n",
"| LakeTemp | Inside Temperature measurement 2 |\n",
"| SolRad | Solar Irradiation measurement |\n",
"| SolRad_DA | Solar Irradiation, daily average |"
]
},
{
"cell_type": "markdown",
"metadata": {},
@ -117,6 +160,13 @@
"## Transform MATLAB struct to a Dataframe"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Transform one matlab array to a dataframe:"
]
},
{
"cell_type": "code",
"execution_count": 7,
@ -136,6 +186,13 @@
" return df_field"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Iterate over the all the experiments and compute the corresponding dataframes:"
]
},
{
"cell_type": "code",
"execution_count": 8,
@ -147,6 +204,13 @@
" dict_dfs[var] = df_from_mb_struct(mat_exp1[exp_id], var)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Combine all the dataframes together:"
]
},
{
"cell_type": "code",
"execution_count": 9,
@ -373,6 +437,13 @@
"### Export plots necessary in the report"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Plot the electrical power consumption of the HVAC system (including the fans):"
]
},
{
"cell_type": "code",
"execution_count": 10,
@ -410,6 +481,13 @@
"plt.savefig(\"../Thesis/Plots/Fan_baseline.pdf\", bbox_inches='tight')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Plot the setpoint and measured temperatures:"
]
},
{
"cell_type": "code",
"execution_count": 11,
@ -727,6 +805,13 @@
"<img src=\"Images/solar_angles.png\" alt=\"Diagram of the zenith/azimuth angles definition\" width=\"500\"/>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Compute the solar position angles for all the experimental times of day:"
]
},
{
"cell_type": "code",
"execution_count": 16,
@ -1022,6 +1107,13 @@
"## Compute the Solar radiation components"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Compute `DNI`, `DHI` and `KT` from `GHI`, `zenith` and `datetime` info:"
]
},
{
"cell_type": "code",
"execution_count": 20,
@ -1118,6 +1210,13 @@
"df_erbs.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Compute the `GHI` from the Erbs DNI and DHI and compare it with the initially measured values as a sanity check:"
]
},
{
"cell_type": "code",
"execution_count": 21,
@ -1127,13 +1226,6 @@
"erbs_ghi = df_erbs['dhi'] + df_erbs['dni']*np.cos(np.radians(df_solarposition['zenith']))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Compare `erbs_ghi` with measured ghi to confirm they are the same:"
]
},
{
"cell_type": "code",
"execution_count": 22,
@ -1460,6 +1552,13 @@
"df['SolRad']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Confirm that `poa_components` computes the same values as `get_ground_diffuse` and `get_sky_diffuse`:"
]
},
{
"cell_type": "code",
"execution_count": 27,
@ -1481,6 +1580,13 @@
"print(df_ground_diffuse.equals(df_poa_components['poa_ground_diffuse']))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Plot all the computed irradiance values, compare them to the glocal irradiation, as a sanity check:"
]
},
{
"cell_type": "code",
"execution_count": 28,
@ -1511,6 +1617,20 @@
"# Compile the WDB vector"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This section compiles the WDB vector as defined in the CARNOT documentation from all the measurements/calculations."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Start by adding the timevalue required by CARNOT -- the number of seconds since the start of the simulation:"
]
},
{
"cell_type": "code",
"execution_count": 29,
@ -1566,6 +1686,13 @@
"df_wdb['poa_diffuse'] = df_poa_components['poa_diffuse']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Set the unknown values to their respective default values:"
]
},
{
"cell_type": "code",
"execution_count": 33,
@ -1628,6 +1755,13 @@
"df_wdb['time'] = df_wdb['time'].astype('int')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Make sure all the required columns are present and are in the correct order:"
]
},
{
"cell_type": "code",
"execution_count": 37,
@ -1719,7 +1853,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.5"
"version": "3.9.6"
},
"toc-autonumbering": true,
"toc-showcode": false,