{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Mixed Orientation\n\nUsing multiple Arrays in a single PVSystem.\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Residential and Commercial systems often have fixed-tilt arrays\ninstalled at different azimuths.  This can be modeled by using\nmultiple :py:class:`~pvlib.pvsystem.Array` objects (one for each\norientation) with a single :py:class:`~pvlib.pvsystem.PVSystem` object.\n\nThis particular example has one east-facing array (azimuth=90) and one\nwest-facing array (azimuth=270), which aside from orientation are identical.\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "from pvlib import pvsystem, modelchain, location\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\narray_kwargs = dict(\n    module_parameters=dict(pdc0=1, gamma_pdc=-0.004),\n    temperature_model_parameters=dict(a=-3.56, b=-0.075, deltaT=3)\n)\n\narrays = [\n    pvsystem.Array(pvsystem.FixedMount(30, 270), name='West-Facing Array',\n                   **array_kwargs),\n    pvsystem.Array(pvsystem.FixedMount(30, 90), name='East-Facing Array',\n                   **array_kwargs),\n]\nloc = location.Location(40, -80)\nsystem = pvsystem.PVSystem(arrays=arrays, inverter_parameters=dict(pdc0=3))\nmc = modelchain.ModelChain(system, loc, aoi_model='physical',\n                           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\nfig, ax = plt.subplots()\nfor array, pdc in zip(system.arrays, mc.results.dc):\n    pdc.plot(label=f'{array.name}')\nmc.results.ac.plot(label='Inverter')\nplt.ylabel('System Output')\nplt.legend()\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
}