{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Servicing Equipment Strategy Demonstration\n", "\n", "In this example, we will demonstrate how the results for the base case for the Dinwoodie, et al. example vary based on how each of the vessels are scheduled. The configuration details all remain the same, regardless of details, except for the strategy information, which is defined as follows:\n", " - **strategy_scheduled**: exactly the same as the base case (fsv_scheduled.yaml and hlv_scheduled.yaml)\n", " - **strategy_requests**: the FSV and HLV are called to site when 10 requests that they can service are logged (fsv_requests.yaml and hlv_requests.yaml)\n", " - **strategy_downtime**: the FSV and HLV are called to site once the windfarm's operating level hits 90% or lower (fsv_downtime.yaml and hlv_downtime.yaml)\n", " \n", " This example is set up similar to that of the validation cases to show how the results differ, and not a step-by-step guide for setting up the analyses. We refer the reader to the exensive [documentation](../API/index.md) and [How To example](how_to.md) for more on the specifics." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from copy import deepcopy\n", "from time import perf_counter\n", "\n", "import pandas as pd\n", "\n", "from wombat.core import Simulation\n", "from wombat.core.library import DINWOODIE\n", "\n", "pd.set_option(\"display.max_rows\", 1000)\n", "pd.set_option(\"display.max_columns\", 1000)\n", "pd.options.display.float_format = '{:,.2f}'.format" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "configs = [\n", " \"base_scheduled\",\n", " \"base_requests\",\n", " \"base_downtime\",\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", " \"annual direct O&M cost\": [],\n", " \"annual vessel cost\": [],\n", " \"ctv cost\": [],\n", " \"fsv cost\": [],\n", " \"hlv cost\": [],\n", " \"annual repair cost\": [],\n", " \"annual technician cost\": [],\n", " \"ctv utilization\": [],\n", " \"fsv utilization\": [],\n", " \"hlv utilization\": [],\n", "}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(f\"{'name'.rjust(28)} | {'loading'} | running\")\n", "for config in configs:\n", " print(f\"{config.rjust(28)}\", end = \" | \")\n", " \n", " # Load the simulation\n", " start = perf_counter()\n", " sim = Simulation(DINWOODIE , f\"{config}.yaml\")\n", " end = perf_counter()\n", " print(f\"{(end - start) / 60:5.2f} m\", end = \" | \")\n", " \n", " # Run the simulation\n", " start = perf_counter()\n", " sim.run()\n", " end = perf_counter()\n", " print(f\"{(end - start) / 60:2.2f} m\")\n", "\n", " # Gather the results of interest\n", " years = sim.metrics.events.year.unique().shape[0]\n", " mil = 1000000\n", " \n", " availability_time = 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=\"low\").operations[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", " hlv = equipment[[el for el in equipment.columns if \"Heavy Lift Vessel\" in el]].sum().sum()\n", " fsv = equipment[[el for el in equipment.columns if \"Field Support Vessel\" in el]].sum().sum()\n", " ctv = equipment[[el for el in equipment.columns if \"Crew Transfer Vessel\" in el]].sum().sum()\n", " \n", " utilization = sim.metrics.service_equipment_utilization(frequency=\"project\")\n", " hlv_ur = utilization[[el for el in utilization.columns if \"Heavy Lift Vessel\" in el]].mean().mean()\n", " fsv_ur = utilization[[el for el in utilization.columns if \"Field Support Vessel\" in el]].mean().mean()\n", " ctv_ur = utilization[[el for el in utilization.columns if \"Crew Transfer Vessel\" in el]].mean().mean()\n", " \n", " # Log the results of interest\n", " results[\"availability - time based\"].append(availability_time)\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[\"annual direct O&M cost\"].append((total + techs) / mil / years)\n", " results[\"annual vessel cost\"].append(equipment_sum / mil / years)\n", " results[\"ctv cost\"].append(ctv / mil / years)\n", " results[\"fsv cost\"].append(fsv / mil / years)\n", " results[\"hlv cost\"].append(hlv / mil / years)\n", " results[\"annual repair cost\"].append(parts / mil / years)\n", " results[\"annual technician cost\"].append(techs / mil / years)\n", " results[\"ctv utilization\"].append(ctv_ur)\n", " results[\"fsv utilization\"].append(fsv_ur)\n", " results[\"hlv utilization\"].append(hlv_ur)\n", " \n", " # Clear the logs\n", " sim.env.cleanup_log_files(log_only=False)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "results_df = pd.DataFrame(results.values(), columns=columns, index=results.keys()).fillna(0)\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.8.8" } }, "nbformat": 4, "nbformat_minor": 4 }