{ "cells": [ { "cell_type": "markdown", "source": [ "# Simulations with TAMU data and [PowerSimulations.jl](https://github.com/NREL/PowerSimulations.jl)" ], "metadata": {} }, { "cell_type": "markdown", "source": [ "**Originally Contributed by**: Clayton Barrows" ], "metadata": {} }, { "cell_type": "markdown", "source": [ "## Introduction" ], "metadata": {} }, { "cell_type": "markdown", "source": [ "This is a basic simulation example using the [TAMU Cases](https://electricgrids.engr.tamu.edu/)." ], "metadata": {} }, { "cell_type": "markdown", "source": [ "## Dependencies" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "using SIIPExamples\n", "pkgpath = dirname(dirname(pathof(SIIPExamples)))\n", "using Dates" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "### Modeling Packages" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "using PowerSystems\n", "using PowerSimulations\n", "using PowerSystemCaseBuilder" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "### Optimization packages\n", "For this simple example, we can use the HiGHS solver with a relatively relaxed tolerance." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "using HiGHS # mip solver\n", "solver = optimizer_with_attributes(HiGHS.Optimizer, \"mip_rel_gap\" => 0.5)" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "### Create a `System` from TAMU data\n", "We have included some of the TAMU cases (with truncated time series info)\n", "in the PowerSystemCaseBuilder testing, so we can just use that." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "sys = build_system(PSYTestSystems, \"tamu_ACTIVSg2000_sys\")\n", "transform_single_time_series!(sys, 24, Dates.Hour(24));" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "## Run a PCM\n", "note that the TAMU data doesn't contain startup and shutdown costs, or minimum up/down\n", "time limits, so a UC problem merely respects minmum generation levels." ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "sim_folder = mkpath(joinpath(pkgpath, \"TAMU-sim\"))\n", "models = SimulationModels(\n", " decision_models = [\n", " DecisionModel(template_unit_commitment(), sys, name = \"UC\", optimizer = solver),\n", " ],\n", ")" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "### Define and build a simulation" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "sim = Simulation(\n", " name = \"TAMU-test\",\n", " steps = 3,\n", " models = models,\n", " sequence = SimulationSequence(\n", " models = models,\n", " ini_cond_chronology = InterProblemChronology(),\n", " ),\n", " simulation_folder = sim_folder,\n", ")\n", "\n", "build!(sim)" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "### Execute the simulation" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "execute!(sim)" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "### Load and analyze results" ], "metadata": {} }, { "outputs": [], "cell_type": "code", "source": [ "sim_results = SimulationResults(sim);\n", "uc_results = get_problem_results(sim_results, \"UC\")\n", "read_realized_variable(uc_results, \"OnVariable__ThermalStandard\")" ], "metadata": {}, "execution_count": null }, { "cell_type": "markdown", "source": [ "---\n", "\n", "*This notebook was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*" ], "metadata": {} } ], "nbformat_minor": 3, "metadata": { "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.7.2" }, "kernelspec": { "name": "julia-1.7", "display_name": "Julia 1.7.2", "language": "julia" } }, "nbformat": 4 }