{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 24 : Unit Commitment"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 24.3, Page No 803"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Fc1=1.1\t\t\t#Fuel cost(1)=Rs 1.1/MBtu\n",
      "Fc2=1\t\t\t#Fuel cost(2)=1/MBtu\n",
      "Fc3=1.2\t\t\t#Fuel cost(3)=1.2/MBtu\n",
      "P1max=600.0\n",
      "P1=P1max\n",
      "\n",
      "#Calculations\n",
      "F1=600+7.1*P1+0.00141*(P1**2)\t#For P1= Pm1ax\n",
      "Favg1=F1*Fc1/600.0\t\t\t\t#Full load average production cost\n",
      "P2max=450.0\n",
      "P2=P2max\n",
      "F2=350+7.8*P2+0.00195*(P2**2)\t#For P2= P2max\n",
      "Favg2=F2*Fc2/450.0\t\t\t\t#Full load average production cost\n",
      "P3max=250.0\n",
      "P3=P3max\n",
      "F3=80+8*P3+0.0049*(P3**2)\t\t#For P3= P3max\n",
      "Favg3=F3*Fc3/250.0\t\t\t\t#Full load average production cost\n",
      "\n",
      "#Results\n",
      "print(\"Priority List is as follows\")\n",
      "print(\"Unit       Rs/MWhr     MinMW        Max MW\")\n",
      "print(\" 2           %.3f       100           %.0f \" %(Favg2,P2max))\n",
      "print(\" 1           %.4f       60            %.0f \" %(Favg1,P1max))\n",
      "print(\" 3           %.2f        50           %.0f \" %(Favg3,P3max))\n",
      "Fmax1=P1max+P2max+P3max\n",
      "Fmax2=P2max+P1max\n",
      "Fmax3=P2max\n",
      "print(\"Unit Commitment Scheme is follows\")\n",
      "print(\"Combination        Min.MW from Combination         Max.MW from Combination\")\n",
      "print(\"2+1+3                 310                              %.0f   \" %Fmax1)\n",
      "print(\"2+1                   260                              %.0f   \" %Fmax2)\n",
      "print(\"2                     100                              %.0f   \" %Fmax3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Priority List is as follows\n",
        "Unit       Rs/MWhr     MinMW        Max MW\n",
        " 2           9.455       100           450 \n",
        " 1           9.8406       60            600 \n",
        " 3           11.45        50           250 \n",
        "Unit Commitment Scheme is follows\n",
        "Combination        Min.MW from Combination         Max.MW from Combination\n",
        "2+1+3                 310                              1300   \n",
        "2+1                   260                              1050   \n",
        "2                     100                              450   \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 24.4, Page No 805"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "#Calculations\n",
      "\n",
      "def F1(P1):\n",
      "    F1=7.1*P1+.00141*(P1^2)\n",
      "    print(\"F1(%.0f)=%.1f\" %(P1,F1))\n",
      "\n",
      "def F2(P2):\n",
      "    f2=7.8*P2+.00195*(P2^2)\n",
      "    print(\"f2(%.0f)=%.0f\" %(P2,f2))\n",
      "\n",
      "def F(P1,P2):\n",
      "    F1=7.1*P1+.00141*(P1**2)\n",
      "    F2=7.8*P2+.00195*(P2**2)\n",
      "    F=F1+F2\n",
      "    print(\"F1(%.0f)+f2(%.0f)=%.0f\" %(P1,P2,F))\n",
      "\n",
      "\n",
      "    \n",
      "#Results\n",
      "P1max=600\n",
      "P2max=450\n",
      "print(\"Unit Commitment using Load 500MW\")\n",
      "F1(500)\n",
      "print(\"\\n Since min. Power of second unit is 100MW , we find\")\n",
      "F(400,100)\n",
      "F(380,120)\n",
      "F(360,140)\n",
      "print(\"\\n Therefore for load 500 MW , the load commitment on unit 1 is 400 MW and that on 2 is 100 MW which gives min. cost\")\n",
      "print(\"Next we increase the load by 50 MW and  loading unit 1 we get, \\n\")\n",
      "F1(550)\n",
      "print(\"Also if we distribute a part of load to unit 2 we get ,\")\n",
      "F(450,100)\n",
      "F(400,150)\n",
      "F(350,200)\n",
      "print(\"\\n Therefore for load 550 MW , the load commitment on unit 1 is 400 MW and that on 2 is 150 MW which gives min. cost\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Unit Commitment using Load 500MW\n",
        "F1(500)=3550.7\n",
        "\n",
        " Since min. Power of second unit is 100MW , we find\n",
        "F1(400)+f2(100)=3865\n",
        "F1(380)+f2(120)=3866\n",
        "F1(360)+f2(140)=3869\n",
        "\n",
        " Therefore for load 500 MW , the load commitment on unit 1 is 400 MW and that on 2 is 100 MW which gives min. cost\n",
        "Next we increase the load by 50 MW and  loading unit 1 we get, \n",
        "\n",
        "F1(550)=3905.8\n",
        "Also if we distribute a part of load to unit 2 we get ,\n",
        "F1(450)+f2(100)=4280\n",
        "F1(400)+f2(150)=4279\n",
        "F1(350)+f2(200)=4296\n",
        "\n",
        " Therefore for load 550 MW , the load commitment on unit 1 is 400 MW and that on 2 is 150 MW which gives min. cost\n"
       ]
      }
     ],
     "prompt_number": 2
    }
   ],
   "metadata": {}
  }
 ]
}