summaryrefslogtreecommitdiff
path: root/Principles_of_Power_System/chapter5.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Principles_of_Power_System/chapter5.ipynb')
-rwxr-xr-xPrinciples_of_Power_System/chapter5.ipynb762
1 files changed, 762 insertions, 0 deletions
diff --git a/Principles_of_Power_System/chapter5.ipynb b/Principles_of_Power_System/chapter5.ipynb
new file mode 100755
index 00000000..195b1538
--- /dev/null
+++ b/Principles_of_Power_System/chapter5.ipynb
@@ -0,0 +1,762 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:95fdfaa4e5e5dbdce2d60b65f4e1e462efff574f2746529cb62b6b5d733a0dc4"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 5: Tariff"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.1, Page Number: 91"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration:\n",
+ "M = 200 #max demand(kW)\n",
+ "LF = 0.4 #load factor\n",
+ "c1 = 100 #tarif(Rs/kW)\n",
+ "c2 = 10 #tariff(pais/kWh)\n",
+ "\n",
+ "#Calculation:\n",
+ "E = M*LF*8760 #units consumed/year\n",
+ "T = c1*M+E*c2/100 #annual charges(Rs)\n",
+ "OC = T/E #overall cost(Rs/kWh)\n",
+ "\n",
+ "#Results:\n",
+ "print \"Overall cost per kWh is \",round(OC*100,2),\"paise\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Overall cost per kWh is 12.85 paise\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.2, Page Number: 91"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "V = 220 #voltage(V)\n",
+ "I = 20 #current(A)\n",
+ "E = 8760 #kWh\n",
+ "c1 = 20 #tariff part1(paise/unit for 500hrs)\n",
+ "c2 = 10 #tariff part2 for additional unit(paise/unit)\n",
+ "\n",
+ "\n",
+ "#Calculation:\n",
+ "#assuming power factor to be unity.\n",
+ "M = V*I/1000 #max demand(kW)\n",
+ "\n",
+ "#part (i):\n",
+ "E1 = M*500 #kWh\n",
+ "C1 = c1*E1/100 #Rs\n",
+ "E2 = E-E1 #kWh\n",
+ "C2 = 10*E2/100 #kWh\n",
+ "T = C1+C2 #total annual bill(Rs)\n",
+ "T2 = T/E #equivalent flat rate(Rs/kWh)\n",
+ "\n",
+ "#Results:\n",
+ "print \"(i) Annual bill is Rs\",T\n",
+ "print \"(ii)Eqv flat rate is \",round(T2*100,1),\"paise\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(i) Annual bill is Rs 1096.0\n",
+ "(ii)Eqv flat rate is 12.5 paise\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.3, Page Number: 92"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from sympy import *\n",
+ "\n",
+ "#Variable declaration:\n",
+ "\n",
+ "#for tariff (a):\n",
+ "c1 = 100 #tariff part1(Rs)\n",
+ "c11 = 15 #tariff part2(paise/kWh)\n",
+ "\n",
+ "#for tariff (b):\n",
+ "c2 = 30 #paise/kWh\n",
+ "\n",
+ "#Calculation:\n",
+ "#Let x be the number of units at which charges \n",
+ "#due to both tariffs become equal.\n",
+ "\n",
+ "x = symbols('x')\n",
+ "x1 = solve(c1+c11*x/100 - c2*x/100 , x)[0]\n",
+ "\n",
+ "#Results:\n",
+ "print \"Tariff(a) is economical if consumption is more than\",round(float(x1),2),\"units.\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Tariff(a) is economical if consumption is more than 666.67 units.\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.4, Page Number: 92"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from sympy import *\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#for 1t tariff:\n",
+ "c11 = 30 #Rs/annum\n",
+ "c12 = 3 #paise/unit\n",
+ "\n",
+ "#for 2nd tariff:\n",
+ "c21 = 6 #paise/unit for 1st 400 units\n",
+ "c22 = 5 #paise/unit for extra units\n",
+ "\n",
+ "#Calculation:\n",
+ "#Let x (> 400) be the number of units taken per annum \n",
+ "#for which the annual charges due to both tariffs become equal.\n",
+ "\n",
+ "x=symbols('x')\n",
+ "T1 = c11+c12*x/100 #charges due to 1st tariff(Rs)\n",
+ "T2 = c21*400/100+c22*(x-400)/100 #charges due to 2nd tariff(Rs)\n",
+ "x1 = solve(T1-T2,x)[0]\n",
+ "\n",
+ "#Results:\n",
+ "print \"Required no. of units are \",round(x1),\"kWh\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Required no. of units are 1300.0 kWh\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.5, Page Number: 92"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration:\n",
+ "M = 50 #max load on the station(MW)\n",
+ "AD = 75 #aggregate demand by consumers(MW)\n",
+ "E = 18*10**7 #units/annum\n",
+ "\n",
+ "#for annual fixed charges:\n",
+ "c11 = 28*10**5 #for generation(Rs)\n",
+ "c12 = 32*10**5 #for transmission & distribution(Rs)\n",
+ "c13 = 90*10**5 #for fuel(Rs)\n",
+ "\n",
+ "#for running charges:\n",
+ "c21 = 0.9*90*10**5 #fuel cost(Rs)\n",
+ "r = 85 #% of power transmitted\n",
+ "\n",
+ "\n",
+ "#Calculation:\n",
+ "T1 = c11+c12+c13*0.1 #10% of fuel used for fixed charges(Rs)\n",
+ "C1 = T1/(AD*10**3) #Rs/kW\n",
+ "\n",
+ "\n",
+ "E1 = r*E/100 #units delivered to consumers\n",
+ "C2 = c21/E1 #cost per kWh\n",
+ "\n",
+ "#Results:\n",
+ "print \"Tariff is\",C1 ,\"Rs/kW of maximum demand plus\",round(C2*100,1),\"paise per kWh.\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Tariff is 92.0 Rs/kW of maximum demand plus 5.3 paise per kWh.\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.6, Page Number: 93"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "M = 75*10**3 #Max emand(kW)\n",
+ "LF = 0.4 #load factor\n",
+ "\n",
+ "c1 = 60 #1st part of generating cost(Rs/kW)\n",
+ "c2 = 4 #2nd part of generating cost(paise/kW)\n",
+ "\n",
+ "CT = 2000000 #annual capital charges for transmission system(Rs)\n",
+ "CD = 1500000 #annual capital charges for distribution system(Rs)\n",
+ "\n",
+ "dt = 1.2 #diversity factor of tr. system\n",
+ "dd = 1.25 #diversity factor of tr. system\n",
+ "\n",
+ "nt = 0.9 #efficiency of tr system\n",
+ "nd = 0.85 ##efficiency of distribution system\n",
+ "\n",
+ "\n",
+ "#Calculation:\n",
+ "#(i) Cost at substation:\n",
+ "#(a)Annual fixed charges:\n",
+ "\n",
+ "Tafc1 = c1*M+CT #total annual fixed cost(Rs)\n",
+ "S1 = M*dt #sum of all the max demands(kW)\n",
+ "AC1 = Tafc1/S1 #Annual cost per kW of max. demand(Rs)\n",
+ "\n",
+ "#(b) Running Charges:\n",
+ "Cs1 = c2/nt #Cost/kWh at substation(paise)\n",
+ "\n",
+ "#(ii) Cost at consumer\u2019s premises:\n",
+ "Tafc2 = Tafc1+CD #Total annual fixed charges at consumer\u2019s premises(Rs)\n",
+ "S2 = S1*dd #sum of of maximum demands of all consumers(kW)\n",
+ "AC2 = Tafc2/S2 #Annual cost per kW of maximum demand(Rs)\n",
+ "#As the distribution efficiency is 85%, therefore, for each kWh delivered from\n",
+ "#substation, only 0\u00b785 kWh reaches the consumer\u2019s premises\n",
+ "Cs2 = Cs1/nd #Cost/kWh at consumer premises(paise)\n",
+ "\n",
+ "#Result:\n",
+ "print \"(i)At sub-station, the cost is Rs\",round(AC1,2),\"per annum per kW maximum demand \"\n",
+ "print \" plus\",round(Cs1,2),\"paise per kWh\"\n",
+ "print \"\\n(ii)At consumer\u2019s premises, the cost is\",round(AC2,2),\"per annum per kW maximum demand\"\n",
+ "print \" plus\",round(Cs2,2),\"paise per kWh.\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(i)At sub-station, the cost is Rs 72.22 per annum per kW maximum demand \n",
+ " plus 4.44 paise per kWh\n",
+ "\n",
+ "(ii)At consumer\u2019s premises, the cost is 71.11 per annum per kW maximum demand\n",
+ " plus 5.23 paise per kWh.\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.7, Page Number: 94"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from sympy import *\n",
+ "\n",
+ "#Variable declaration:\n",
+ "# Fixed charges Running charges #Station \n",
+ "# (per kW) (paise/kWh)\n",
+ "Cf1 = 300; Cr1 = 25 #Diesel \n",
+ "Cf2 = 1200; Cr2 = 6.25 #Steam \n",
+ "\n",
+ "\n",
+ "#Calculation:\n",
+ "#Suppose energy supplied in one year is 100 units i.e., 100 kWh.\n",
+ "\n",
+ "#Diesel Station:\n",
+ "L = symbols('L') #load factor\n",
+ "E = 100 #kWh(say)\n",
+ "P = E/8760 #avg power, kW\n",
+ "M = P/L #max deamnd(kW)\n",
+ "C1 = Cf1*M+E*Cr1/100 #Fixed and running charges for 100 kWh\n",
+ "\n",
+ "#Steam station\n",
+ "C2 = Cf2*M+E*Cr2/100 #Fixed and running charges for 100 kWh\n",
+ "\n",
+ "L1 = solve(C1-C2,L)[0]\n",
+ "\n",
+ "#Result:\n",
+ "print \"The load fctor is \",round(L1*100,2),\"%\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The load fctor is 54.79 %\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.8, Page Number: 95"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration:\n",
+ "M = 100 #max demand(kW)\n",
+ "LF = 0.6 #load factor\n",
+ "pf = 0.8 #power factor\n",
+ "c1 = 75 #1st part tariff(Rs/kVA)\n",
+ "c2 = 15 #2nd part tariff(paise/kWh)\n",
+ "\n",
+ "#Calculation:\n",
+ "E = M*LF*8760 #units consumed/year\n",
+ "M1 = M/pf #max demand in kVA\n",
+ "AB = M1*c1+E*c2/100 #annual bill(Rs)\n",
+ "\n",
+ "#Result:\n",
+ "print \"Annual bill is Rs\",AB"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Annual bill is Rs 88215.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.9, Page Number: 95"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration:\n",
+ "M = 240 #max load(kW)\n",
+ "pf = 0.8 #power factor\n",
+ "E = 50000 #annual units consumption(kW)\n",
+ "c1 = 50 #1st part tariff(Rs/KVA)\n",
+ "c2 = 10 #2nd part tariff(paise/unit)\n",
+ "\n",
+ "#Calculation:\n",
+ "M1 = M/pf #KVA\n",
+ "AB = M1*c1+E*c2/100 #annual bill(Rs)\n",
+ "FR = AB/E #Rs\n",
+ "\n",
+ "#now\n",
+ "pf1 = 1\n",
+ "M2 = M\n",
+ "AB1 = M2*c1+E*c2/100 #Rs\n",
+ "S = AB-AB1 #annual saving(Rs)\n",
+ "\n",
+ "#Result:\n",
+ "print \"Flat rate of energy consumption is \",FR*100,\"paise\"\n",
+ "print \"Annual saving is Rs\",S"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Flat rate of energy consumption is 40.0 paise\n",
+ "Annual saving is Rs 3000.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.10, Page Number: 96"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration:\n",
+ "M = 50 #max demand(kW)\n",
+ "E = 36000 #energy consume(kWh)\n",
+ "R = 23400 #reactive power(KVAR)\n",
+ "c1 = 80 #1st part tariff(Rs/kW)\n",
+ "c2 = 8 #2nd part tariff(paise/unit)\n",
+ "c3 = 0.5 #3rd part tariff(p/kWh)for each 1% of pf below 86%\n",
+ "\n",
+ "#Calculation:\n",
+ "L = E/(24*30) #avg load(kW)\n",
+ "RP = R/(24*30) #avg reactive power(kVAR)\n",
+ "\n",
+ "theta = math.atan(RP/L) #power factor angle\n",
+ "pf = math.cos(theta) \n",
+ "PFS = E*c3*(0.86-pf) #power factor surcharge(Rs)\n",
+ "MB = c1*L+c2*E/100+PFS #monthly bill(Rs)\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"The monthly bill is Rs\",round(MB,1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The monthly bill is Rs 7268.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.11, Page Number: 96"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Variable declaration:\n",
+ "c1 = 150 #1st part tariff(Rs/KVA)\n",
+ "c2 = 8 #2nd part tariff(paise/unit)\n",
+ "LF = 0.3 #load factor\n",
+ "\n",
+ "\n",
+ "#Calculation:\n",
+ "#suppose max demand is 1kVA\n",
+ "\n",
+ "#(i)When p.f. is unity:\n",
+ "pf = 1\n",
+ "OC1 = c1*100/(8760*LF)+c2 #operating cost(Rs)\n",
+ "\n",
+ "#(ii) When p.f. is 0\u00b77\n",
+ "pf1 = 0.7\n",
+ "OC2 = c1*100/(8760*LF*pf1)+c2 #operating cost(Rs)\n",
+ "\n",
+ "#Result:\n",
+ "print \"At unity p. f., overall cost is Rs\",round(OC1,2)\n",
+ "print \"At 0.7 p. f., overall cost is Rs\",round(OC2,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "At unity p. f., overall cost is Rs 13.71\n",
+ "At 0.7 p. f., overall cost is Rs 16.15\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.12, Page Number: 97"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "\n",
+ "#variable declaration\n",
+ "L = 200 #avg load(kW)\n",
+ "pf = 0.8 #power factor\n",
+ "M = 250 #max demand(kW)\n",
+ "l = 4 #losses(%)\n",
+ "r = 12 #interest & depreciation(%)\n",
+ "C = 50 #high voltage equipment cost(Rs)\n",
+ "t = 8 #working hours\n",
+ "n = 300 #no. of working working\n",
+ "\n",
+ "#for system(i)high voltage supply:\n",
+ "c11 = 5 #1st part tariff(paise/unit)\n",
+ "c12 = 4.50 #2nd part tariff(per month per kVA)\n",
+ "\n",
+ "#for system(ii)low voltage supply:\n",
+ "c21 = 5.5 #1st part tariff(paise/unit)\n",
+ "c22 = 5 #2nd part tariff(Rs per month per kVA)\n",
+ "\n",
+ "\n",
+ "#Calculation:\n",
+ "#(i) High voltage supply:\n",
+ "\n",
+ "M1 = M/pf #Max. demand in kVA\n",
+ "#As the losses in h.v. equipment are 4%, therefore, \n",
+ "#capacity of h.v. equipment:\n",
+ "Cap = round(M1/(1-l/100),1) #capacity of h.v. equipment(kVA)\n",
+ "C1 = C*Cap #Capital investment on h.v. equipment(Rs)\n",
+ "E1 = L*t*n/(1-l/100) #units consumed(kWh)\n",
+ "T1 = C1*r/100+Cap*c12*12+c11*E1/100 #Total annual cost(Rs)\n",
+ "\n",
+ "#(i) low voltage supply:\n",
+ "M2 = M/pf #Max. demand in kVA\n",
+ "E2 = L*t*n #units consumed(kWh)\n",
+ "T2 = M2*c22*12+E2*c21/100 #kWh\n",
+ "\n",
+ "T = T2 - T1\n",
+ "\n",
+ "#Results:\n",
+ "print \"Difference in the annual costs of two systems is Rs\",T\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Difference in the annual costs of two systems is Rs 620.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.13, Page Number: 97"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#(i) Purchasing diesel set:\n",
+ "M1 = 1000 #kW\n",
+ "C1 = 400 #Rs/kW\n",
+ "r1 = 10 #annual interest depreciation(%)\n",
+ "c11 = 75 #Rs/kW\n",
+ "c12 = 5 #paise/unit\n",
+ "\n",
+ "#(ii) Purchasing from grid supply:\n",
+ "r1 = 10 #annual interest depreciation(%)\n",
+ "c21 =120 #Rs/kW\n",
+ "c22 = 3 #paise/unit\n",
+ "#after 2 years:\n",
+ "M2 = 2500 #kW\n",
+ "E = 5.5*10**6 #units reached\n",
+ "\n",
+ "#Calculation:\n",
+ "#(i) Purchasing diesel set:\n",
+ "CC = M1*C1 #Rs\n",
+ "#The present capacity of the station is 2000 kW and the expected\n",
+ "#maximum demand after two years is 2500 kW.\n",
+ "P = 2500-2000 #extra power to be generated(kW)\n",
+ "T1 = CC*r1/100+P*c11+E*c12/100 #total annual cost(Rs)\n",
+ "\n",
+ "#(ii) Purchasing from grid supply:\n",
+ "T2 = P*c21+E*c22/100 #total annual cost(Rs)\n",
+ "\n",
+ "\n",
+ "#Result:\n",
+ "print \"Alternative (ii) is cheaper by Rs\",T1-T2,\"per annum\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Alternative (ii) is cheaper by Rs 127500.0 per annum\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.14, Page Number: 98"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from pylab import *\n",
+ "from sympy import *\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration:\n",
+ "#H.V supply:\n",
+ "c11 = 70 #1st part tariff(Rs/kVA)\n",
+ "c12 = 3 #2nd part tariff(paise/kWh)\n",
+ "\n",
+ "#L.V supply:\n",
+ "c21 = 65 #1st part tariff(Rs/kVA)\n",
+ "c22 = 4 #2nd part tariff(paise/kWh)\n",
+ "\n",
+ "c = 50 #cost of transformer & switchgear for HV side(Rs/kVA)\n",
+ "r1= 2 #transformer losses(%)\n",
+ "r2 = 15 #annual fixed charges(%) of transformer & switchgear\n",
+ "n = 6 #no of working hours\n",
+ "\n",
+ "#Calculation:\n",
+ "(x,y) = symbols('x y') #say x = Factory load in kW\n",
+ " #y = No. of working days above which H.V.\n",
+ " #supply is cheaper\n",
+ "#for HV side: \n",
+ "r = x*round(1/(1-r1/100),4) #rating of transformer & switchgear(kVA)\n",
+ "E1 = x*y*round(n*1/(1-r1/100),2) #units consumed per annnum\n",
+ "T11 = x*math.floor(1/(1-r1/100)*c11*100)/100+x*round(1/(1-r1/100)*r2*c/100,2) #total fixed charges(Rs)\n",
+ "T12 = E1*c12/100 #total running charges(Rs)\n",
+ "T1 = T11+T12 #total annual charges(Rs)\n",
+ "\n",
+ "#for LV side:\n",
+ "E2 = x*y*n #units consumed per annnum\n",
+ "T21 = c21*x #total fixed charges(Rs)\n",
+ "T22 = c22*E2/100 #total running charges(Rs)\n",
+ "T2 = T21+T22 #total annual charges(Rs)\n",
+ "y11 = solve(T1-T2,y)[0]\n",
+ "\n",
+ "#Result:\n",
+ "print \"If the factory is run for more than\",math.floor(y11),'days' #the ans. is different from that in book\n",
+ "print \"then H. V. supply will be cheaper.\" #due to calculation using improper rounding."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "If the factory is run for more than 249.0 days\n",
+ "then H. V. supply will be cheaper.\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file