{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Code-to-Code Comparison: IEA Task 26\n", "\n", "### National Renewable Energy Laboratory\n", "\n", "#### Rob Hammond\n", "\n", "##### 27 May 2021" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2021-05-28T03:27:56.588900Z", "iopub.status.busy": "2021-05-28T03:27:56.588067Z", "iopub.status.idle": "2021-05-28T03:27:58.524145Z", "shell.execute_reply": "2021-05-28T03:27:58.524591Z" } }, "outputs": [], "source": [ "import os\n", "import pickle\n", "from copy import deepcopy\n", "from time import perf_counter\n", "from pprint import pprint\n", "\n", "import numpy as np\n", "import pandas as pd\n", "import networkx as nx\n", "import matplotlib.pyplot as plt\n", "\n", "from wombat.core import Simulation\n", "from wombat.core.library import IEA_26, load_yaml\n", "pd.set_option(\"display.max_rows\", 1000)\n", "pd.set_option(\"display.max_columns\", 1000)\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2021-05-28T03:27:58.530498Z", "iopub.status.busy": "2021-05-28T03:27:58.529663Z", "iopub.status.idle": "2021-05-28T03:27:58.533695Z", "shell.execute_reply": "2021-05-28T03:27:58.534216Z" } }, "outputs": [ { "data": { "text/plain": [ "7.5" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "tech_salary_annual = 100000\n", "techs = 30\n", "capacity = 400 * 1000 # 400MW -> kW\n", "tech_salary_annual * techs / capacity" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2021-05-28T03:27:58.540386Z", "iopub.status.busy": "2021-05-28T03:27:58.539645Z", "iopub.status.idle": "2021-05-28T03:27:58.541696Z", "shell.execute_reply": "2021-05-28T03:27:58.542210Z" } }, "outputs": [], "source": [ "configs = [\n", " \"one_mobilization\",\n", " \"one_mobilization_100pct_reduction\",\n", " \"two_mobilizations\",\n", " \"two_mobilizations_100pct_reduction\",\n", " \"three_mobilizations\",\n", " \"three_mobilizations_100pct_reduction\",\n", "]\n", "columns = deepcopy(configs)\n", "results = {\n", " \"availability - time based\": [],\n", " \"availability - production based\": [],\n", " \"capacity factor - net\": [],\n", " \"capacity factor - gross\": [],\n", " \"power production\": [],\n", " \"task completion rate\": [],\n", " \"total annual costs\": [],\n", " \"technicians\": [],\n", " \"materials\": [],\n", " \"vessels\": [],\n", " \"ctv cost\": [],\n", " \"hlv cost\": [],\n", " \"dsv cost\": [],\n", " \"cab cost\": [],\n", " \"manual reset\": [],\n", " \"minor repair\": [],\n", " \"major repair\": [],\n", " \"major replacement\": [],\n", " \"remote reset\": [],\n", " \"annual service\": [],\n", " \"bos\": [], # substructure inspection + scour repair + substation inspection + small/large transformer repairs\n", " \"total downtime\": [],\n", " \"ctv utilization\": [],\n", " \"hlv utilization\": [],\n", " \"dsv utilization\": [],\n", " \"cab utilization\": [],\n", "}" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2021-05-28T03:27:58.561457Z", "iopub.status.busy": "2021-05-28T03:27:58.560582Z", "iopub.status.idle": "2021-05-28T04:43:28.460163Z", "shell.execute_reply": "2021-05-28T04:43:28.461354Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " iea_26_one_mobilization | 8.23 m\n", " iea_26_one_mobilization_100pct_reduction | 11.13 m\n", " iea_26_two_mobilizations | 8.89 m\n", " iea_26_two_mobilizations_100pct_reduction | 10.59 m\n", " iea_26_three_mobilizations | 9.75 m\n", " iea_26_three_mobilizations_100pct_reduction | 12.67 m\n" ] } ], "source": [ "for config in configs:\n", " # Run the simulation\n", " start = perf_counter()\n", " config = load_yaml(os.path.join(str(IEA_26), \"config\"), f\"{config}.yaml\")\n", " sim = Simulation.from_inputs(**config)\n", " sim.run()\n", " end = perf_counter()\n", " print(f\"{config['name'].rjust(45)} | {(end - start) / 60:.2f} m\")\n", " \n", " # Gather the results of interest\n", " years = sim.metrics.events.year.unique().shape[0]\n", " mil = 1000000\n", " \n", " availability = sim.metrics.time_based_availability(frequency=\"project\", by=\"windfarm\")\n", " availability_production = sim.metrics.production_based_availability(frequency=\"project\", by=\"windfarm\")\n", " cf_net = sim.metrics.capacity_factor(which=\"net\", frequency=\"project\", by=\"windfarm\")\n", " cf_gross = sim.metrics.capacity_factor(which=\"gross\", frequency=\"project\", by=\"windfarm\")\n", " power_production = sim.metrics.power_production(frequency=\"project\", by_turbine=False).values[0][0]\n", " completion_rate = sim.metrics.task_completion_rate(which=\"both\", frequency=\"project\")\n", " parts = sim.metrics.events[[\"materials_cost\"]].sum().sum()\n", " techs = sim.metrics.project_fixed_costs(frequency=\"project\", resolution=\"medium\").labor[0]\n", " total = sim.metrics.events[[\"total_cost\"]].sum().sum()\n", "\n", " equipment = sim.metrics.equipment_costs(frequency=\"project\", by_equipment=True)\n", " equipment_sum = equipment.sum().sum()\n", " ctv = equipment[[el for el in equipment.columns if \"Crew Transfer Vessel\" in el]].sum().sum()\n", " hlv = equipment[[el for el in equipment.columns if \"Jack-up Vessel\" in el]].sum().sum()\n", " dsv = equipment[[el for el in equipment.columns if \"Diving Support Vessel\" in el]].sum().sum()\n", " cab = equipment[[el for el in equipment.columns if \"Cable Laying Vessel\" in el]].sum().sum()\n", "\n", " times = sim.metrics.process_times()\n", " times = times / years / 24 / 100 # events per turbine and year\n", " \n", " utilization = sim.metrics.service_equipment_utilization(frequency=\"project\")\n", " ctv_ur = utilization[[el for el in utilization.columns if \"Crew Transfer Vessel\" in el]].mean().mean()\n", " hlv_ur = utilization[[el for el in utilization.columns if \"Jack-up Vessel\" in el]].mean().mean()\n", " dsv_ur = utilization[[el for el in utilization.columns if \"Diving Support Vessel\" in el]].mean().mean()\n", " cab_ur = utilization[[el for el in utilization.columns if \"Cable Laying Vessel\" in el]].mean().mean()\n", "\n", " # Log the results of interest\n", " results[\"availability - time based\"].append(availability)\n", " results[\"availability - production based\"].append(availability_production)\n", " results[\"capacity factor - net\"].append(cf_net)\n", " results[\"capacity factor - gross\"].append(cf_gross)\n", " results[\"power production\"].append(power_production)\n", " results[\"task completion rate\"].append(completion_rate)\n", " results[\"total annual costs\"].append((total + techs) / mil / years)\n", " results[\"technicians\"].append(techs / mil / years)\n", " results[\"materials\"].append(parts / mil / years)\n", " results[\"vessels\"].append(equipment_sum / mil / years)\n", " results[\"ctv cost\"].append(ctv / mil / years)\n", " results[\"hlv cost\"].append(hlv / mil / years)\n", " results[\"dsv cost\"].append(dsv / mil / years)\n", " results[\"cab cost\"].append(cab / mil / years)\n", " results[\"manual reset\"].append(times.loc[times.index.intersection([\"manual reset\"]), \"downtime\"].sum())\n", " results[\"minor repair\"].append(times.loc[times.index.intersection([\"minor repair\", ]), \"downtime\"].sum())\n", " results[\"major repair\"].append(times.loc[times.index.intersection([\"major repair\"]), \"downtime\"].sum())\n", " results[\"major replacement\"].append(times.loc[times.index.intersection([\"major replacement\"]), \"downtime\"].sum())\n", " results[\"remote reset\"].append(times.loc[times.index.intersection([\"remote reset\"]), \"downtime\"].sum())\n", " results[\"annual service\"].append(times.loc[times.index.intersection([\"annual service\"]), \"downtime\"].sum())\n", " ix = [\n", " \"substructure inspection\", \"substation inspection\",\n", " \"small foundation/scour repair\", \"cable replacement\",\n", " \"small transformer repair\", \"large transformer repair\"\n", " ]\n", " results[\"bos\"].append(times.loc[times.index.intersection(ix), \"downtime\"].sum())\n", " results[\"total downtime\"].append(times.loc[:, \"downtime\"].sum())\n", " results[\"ctv utilization\"].append(ctv_ur)\n", " results[\"hlv utilization\"].append(hlv_ur)\n", " results[\"dsv utilization\"].append(dsv_ur)\n", " results[\"cab utilization\"].append(cab_ur)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2021-05-28T04:43:28.479423Z", "iopub.status.busy": "2021-05-28T04:43:28.478572Z", "iopub.status.idle": "2021-05-28T04:43:28.490463Z", "shell.execute_reply": "2021-05-28T04:43:28.490971Z" } }, "outputs": [], "source": [ "# Save the results\n", "# pickled dictionary format\n", "with open(os.path.join(str(IEA_26), \"outputs\", \"results_dict.pkl\"), \"wb\") as f:\n", " pickle.dump(results, f)\n", "\n", "# dataframe/csv format\n", "results_df = pd.DataFrame(results.values(), columns=columns, index=results.keys()).fillna(0)\n", "results_df.to_csv(os.path.join(str(IEA_26), \"outputs\", \"results_data.csv\"), index_label=\"result\")" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": true, "execution": { "iopub.execute_input": "2021-05-28T04:43:28.496174Z", "iopub.status.busy": "2021-05-28T04:43:28.495454Z", "iopub.status.idle": "2021-05-28T04:43:28.520392Z", "shell.execute_reply": "2021-05-28T04:43:28.520876Z" }, "jupyter": { "outputs_hidden": true } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
one_mobilizationone_mobilization_100pct_reductiontwo_mobilizationstwo_mobilizations_100pct_reductionthree_mobilizationsthree_mobilizations_100pct_reduction
availability - time based0.660.740.840.820.950.91
availability - production based0.660.740.840.820.950.91
capacity factor - net0.390.440.490.480.560.54
capacity factor - gross0.590.590.590.590.590.59
power production27,389,328,921.0030,735,833,503.5034,598,056,055.0033,863,780,889.5039,287,511,766.0037,670,119,797.00
task completion rate1.001.001.001.001.001.00
total annual costs15.2715.2220.9920.8324.7824.46
technicians3.003.003.003.003.003.00
materials4.084.036.135.986.906.55
vessels8.198.1911.8611.8514.8814.91
ctv cost2.562.562.562.562.562.56
hlv cost3.563.567.237.2210.2510.28
dsv cost0.530.530.530.530.530.53
cab cost1.551.551.551.551.551.55
manual reset0.424.430.545.440.667.80
minor repair0.942.171.212.651.483.01
major repair0.570.670.700.830.780.90
major replacement78.5459.5949.3144.7810.969.25
remote reset0.022.360.042.570.062.85
annual service1.980.001.630.001.840.00
bos0.023.540.023.090.023.86
total downtime82.7072.8453.6859.4716.0927.81
ctv utilization0.680.350.740.400.880.46
hlv utilization1.000.981.000.980.730.71
dsv utilization0.200.230.210.230.290.23
cab utilization0.010.010.000.010.010.03
\n", "
" ], "text/plain": [ " one_mobilization \\\n", "availability - time based 0.66 \n", "availability - production based 0.66 \n", "capacity factor - net 0.39 \n", "capacity factor - gross 0.59 \n", "power production 27,389,328,921.00 \n", "task completion rate 1.00 \n", "total annual costs 15.27 \n", "technicians 3.00 \n", "materials 4.08 \n", "vessels 8.19 \n", "ctv cost 2.56 \n", "hlv cost 3.56 \n", "dsv cost 0.53 \n", "cab cost 1.55 \n", "manual reset 0.42 \n", "minor repair 0.94 \n", "major repair 0.57 \n", "major replacement 78.54 \n", "remote reset 0.02 \n", "annual service 1.98 \n", "bos 0.02 \n", "total downtime 82.70 \n", "ctv utilization 0.68 \n", "hlv utilization 1.00 \n", "dsv utilization 0.20 \n", "cab utilization 0.01 \n", "\n", " one_mobilization_100pct_reduction \\\n", "availability - time based 0.74 \n", "availability - production based 0.74 \n", "capacity factor - net 0.44 \n", "capacity factor - gross 0.59 \n", "power production 30,735,833,503.50 \n", "task completion rate 1.00 \n", "total annual costs 15.22 \n", "technicians 3.00 \n", "materials 4.03 \n", "vessels 8.19 \n", "ctv cost 2.56 \n", "hlv cost 3.56 \n", "dsv cost 0.53 \n", "cab cost 1.55 \n", "manual reset 4.43 \n", "minor repair 2.17 \n", "major repair 0.67 \n", "major replacement 59.59 \n", "remote reset 2.36 \n", "annual service 0.00 \n", "bos 3.54 \n", "total downtime 72.84 \n", "ctv utilization 0.35 \n", "hlv utilization 0.98 \n", "dsv utilization 0.23 \n", "cab utilization 0.01 \n", "\n", " two_mobilizations \\\n", "availability - time based 0.84 \n", "availability - production based 0.84 \n", "capacity factor - net 0.49 \n", "capacity factor - gross 0.59 \n", "power production 34,598,056,055.00 \n", "task completion rate 1.00 \n", "total annual costs 20.99 \n", "technicians 3.00 \n", "materials 6.13 \n", "vessels 11.86 \n", "ctv cost 2.56 \n", "hlv cost 7.23 \n", "dsv cost 0.53 \n", "cab cost 1.55 \n", "manual reset 0.54 \n", "minor repair 1.21 \n", "major repair 0.70 \n", "major replacement 49.31 \n", "remote reset 0.04 \n", "annual service 1.63 \n", "bos 0.02 \n", "total downtime 53.68 \n", "ctv utilization 0.74 \n", "hlv utilization 1.00 \n", "dsv utilization 0.21 \n", "cab utilization 0.00 \n", "\n", " two_mobilizations_100pct_reduction \\\n", "availability - time based 0.82 \n", "availability - production based 0.82 \n", "capacity factor - net 0.48 \n", "capacity factor - gross 0.59 \n", "power production 33,863,780,889.50 \n", "task completion rate 1.00 \n", "total annual costs 20.83 \n", "technicians 3.00 \n", "materials 5.98 \n", "vessels 11.85 \n", "ctv cost 2.56 \n", "hlv cost 7.22 \n", "dsv cost 0.53 \n", "cab cost 1.55 \n", "manual reset 5.44 \n", "minor repair 2.65 \n", "major repair 0.83 \n", "major replacement 44.78 \n", "remote reset 2.57 \n", "annual service 0.00 \n", "bos 3.09 \n", "total downtime 59.47 \n", "ctv utilization 0.40 \n", "hlv utilization 0.98 \n", "dsv utilization 0.23 \n", "cab utilization 0.01 \n", "\n", " three_mobilizations \\\n", "availability - time based 0.95 \n", "availability - production based 0.95 \n", "capacity factor - net 0.56 \n", "capacity factor - gross 0.59 \n", "power production 39,287,511,766.00 \n", "task completion rate 1.00 \n", "total annual costs 24.78 \n", "technicians 3.00 \n", "materials 6.90 \n", "vessels 14.88 \n", "ctv cost 2.56 \n", "hlv cost 10.25 \n", "dsv cost 0.53 \n", "cab cost 1.55 \n", "manual reset 0.66 \n", "minor repair 1.48 \n", "major repair 0.78 \n", "major replacement 10.96 \n", "remote reset 0.06 \n", "annual service 1.84 \n", "bos 0.02 \n", "total downtime 16.09 \n", "ctv utilization 0.88 \n", "hlv utilization 0.73 \n", "dsv utilization 0.29 \n", "cab utilization 0.01 \n", "\n", " three_mobilizations_100pct_reduction \n", "availability - time based 0.91 \n", "availability - production based 0.91 \n", "capacity factor - net 0.54 \n", "capacity factor - gross 0.59 \n", "power production 37,670,119,797.00 \n", "task completion rate 1.00 \n", "total annual costs 24.46 \n", "technicians 3.00 \n", "materials 6.55 \n", "vessels 14.91 \n", "ctv cost 2.56 \n", "hlv cost 10.28 \n", "dsv cost 0.53 \n", "cab cost 1.55 \n", "manual reset 7.80 \n", "minor repair 3.01 \n", "major repair 0.90 \n", "major replacement 9.25 \n", "remote reset 2.85 \n", "annual service 0.00 \n", "bos 3.86 \n", "total downtime 27.81 \n", "ctv utilization 0.46 \n", "hlv utilization 0.71 \n", "dsv utilization 0.23 \n", "cab utilization 0.03 " ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pd.options.display.float_format = '{:,.2f}'.format\n", "\n", "results_df" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.7" } }, "nbformat": 4, "nbformat_minor": 4 }