{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Tidal Power Performance Analysis\n", "\n", "The following example demonstrates a simple workflow for conducting the power performance analysis of a turbine, given turbine specifications, power data, and Acoustic Doppler Current Profiler (ADCP) water measurements.\n", "\n", "In this case, the turbine specifications can be broken down into\n", " 1. Shape of the rotor's swept area\n", " 2. Turbine rotor diameter/height and width\n", " 3. Turbine hub height (center of swept area)\n", "\n", "Additional data needed:\n", " - Power data from the current energy converter (CEC)\n", " - 2-dimensional water velocity data\n", "\n", "In this jupyter notebook, we'll be covering the following three topics:\n", " 1. CEC power-curve\n", " 2. Velocity profiles\n", " 3. CEC efficiency profile (or power coefficient profile)\n", "\n", "Start by importing the necessary tools:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "scrolled": true }, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "\n", "from mhkit.tidal import performance\n", "from mhkit.dolfyn import load" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "In this case, we'll use ADCP data from the ADCP example notebook. I am importing a dataset from the ADCP example notebook. This data retains the original timestamps (1 Hz sampling frequency) and was rotated into the principal coordinate frame (streamwise-cross_stream-up)." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "scrolled": true }, "outputs": [], "source": [ "# Open processed ADCP dataset\n", "ds = load(\"data/tidal/adcp.principal.a1.20200815.nc\")" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Next, since we don't have power data, we'll invent a mock timeseries based off the cube of water velocity, just to have something to work with." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Streamwise and hub-height water velocity\n", "streamwise_vel = ds[\"vel\"].sel(dir=\"streamwise\")\n", "hub_height_vel = abs(streamwise_vel.isel(range=10))\n", "\n", "# Emulate power data\n", "power = hub_height_vel**3 * 1e5\n", "# Emulate cut-in speed by setting power at flow speeds below 0.5 m/s to 0 W\n", "power = power.where(abs(streamwise_vel.mean(\"range\")) > 0.5, 0)" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "The first step for any of the following calculations is to first split velocity into ebb and flood tide. You'll need some background information on the site to know which direction is positive and which is negative in the data." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "ebb = streamwise_vel.where(streamwise_vel > 0)\n", "flood = streamwise_vel.where(streamwise_vel < 0)" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "With the ebb and flood velocities, we can also divide the power data into that for ebb and flood tides." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "# Make sure ebb and flood are on same timestamps\n", "power = power.interp(time=streamwise_vel[\"time\"])\n", "\n", "power_ebb = power.where(~ebb.mean(\"range\").isnull(), 0)\n", "power_flood = power.where(~flood.mean(\"range\").isnull(), 0)" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### Power-curve\n", "\n", "Now with power and velocity divided into ebb and flood tides, we can calculate the power curve for the CEC in both conditions\n" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "power_curve_ebb = performance.power_curve(\n", " power_ebb,\n", " velocity=ebb,\n", " hub_height=4.2,\n", " doppler_cell_size=0.5,\n", " sampling_frequency=1,\n", " window_avg_time=600,\n", " turbine_profile=\"circular\",\n", " diameter=3,\n", " height=None,\n", " width=None,\n", ")\n", "power_curve_flood = performance.power_curve(\n", " power_flood,\n", " velocity=flood,\n", " hub_height=4.2,\n", " doppler_cell_size=0.5,\n", " sampling_frequency=1,\n", " window_avg_time=600,\n", " turbine_profile=\"circular\",\n", " diameter=3,\n", " height=None,\n", " width=None,\n", ")" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | U_avg | \n", "U_avg_power_weighted | \n", "P_avg | \n", "P_std | \n", "P_max | \n", "P_min | \n", "
---|---|---|---|---|---|---|
U_bins | \n", "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " |
(0.0, 0.1] | \n", "0.067459 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "
(0.1, 0.2] | \n", "0.115614 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "
(0.2, 0.3] | \n", "0.249676 | \n", "0.225639 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "
(0.3, 0.4] | \n", "0.339600 | \n", "0.315561 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "
(0.4, 0.5] | \n", "0.459393 | \n", "0.437249 | \n", "2890.724986 | \n", "2660.810022 | \n", "5551.535008 | \n", "229.914964 | \n", "
(0.5, 0.6] | \n", "0.548507 | \n", "0.532974 | \n", "19677.343518 | \n", "4645.890936 | \n", "24323.234454 | \n", "15031.452582 | \n", "
(0.6, 0.7] | \n", "0.671449 | \n", "0.655362 | \n", "40369.435517 | \n", "3679.260135 | \n", "45506.306677 | \n", "37083.470337 | \n", "
(0.7, 0.8] | \n", "0.726189 | \n", "0.704845 | \n", "52413.972024 | \n", "2856.737142 | \n", "57360.861473 | \n", "50670.102583 | \n", "
(0.8, 0.9] | \n", "0.843958 | \n", "0.825916 | \n", "79944.000855 | \n", "9798.569674 | \n", "96206.928025 | \n", "66531.815452 | \n", "
(0.9, 1.0] | \n", "0.938701 | \n", "0.920960 | \n", "103970.042175 | \n", "5828.263891 | \n", "112163.977434 | \n", "99100.055332 | \n", "
(1.0, 1.1] | \n", "1.046607 | \n", "1.026293 | \n", "148511.100008 | \n", "18809.350864 | \n", "171583.550611 | \n", "124179.073981 | \n", "
(1.1, 1.2] | \n", "1.147348 | \n", "1.127691 | \n", "200340.820581 | \n", "6299.518554 | \n", "209073.741656 | \n", "187772.752668 | \n", "