{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Dual-Axis Tracking\n\nExample of a custom Mount class.\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Dual-axis trackers can track the sun in two dimensions across the sky dome\ninstead of just one like single-axis trackers.  This example shows how to\nmodel a simple dual-axis tracking system using ModelChain with a custom\nMount class.\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "from pvlib import pvsystem, location, modelchain\nimport pandas as pd\nimport matplotlib.pyplot as plt"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "New Mount classes should extend ``pvlib.pvsystem.AbstractMount``\nand must implement a ``get_orientation(solar_zenith, solar_azimuth)`` method:\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "class DualAxisTrackerMount(pvsystem.AbstractMount):\n    def get_orientation(self, solar_zenith, solar_azimuth):\n        # no rotation limits, no backtracking\n        return {'surface_tilt': solar_zenith, 'surface_azimuth': solar_azimuth}\n\n\nloc = location.Location(40, -80)\narray = pvsystem.Array(\n    mount=DualAxisTrackerMount(),\n    module_parameters=dict(pdc0=1, gamma_pdc=-0.004, b=0.05),\n    temperature_model_parameters=dict(a=-3.56, b=-0.075, deltaT=3))\nsystem = pvsystem.PVSystem(arrays=[array], inverter_parameters=dict(pdc0=3))\nmc = modelchain.ModelChain(system, loc, spectral_model='no_loss')\n\ntimes = pd.date_range('2019-01-01 06:00', '2019-01-01 18:00', freq='5min',\n                      tz='Etc/GMT+5')\nweather = loc.get_clearsky(times)\nmc.run_model(weather)\n\nmc.results.ac.plot()\nplt.ylabel('Output Power')\nplt.show()"
      ]
    }
  ],
  "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.9"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}