BHADRA_JAYAKUMAR

EB_Cost1.pyl

Dec 22nd, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 9.98 KB | None | 0 0
  1. def main():
  2.   print "Running as Main!"
  3.   tariff = raw_input("Plese name your tariff: ")
  4.   billfunctions(tariff)
  5. if __name__== "__main__":
  6.   main()
  7.  
  8.  
  9. def billfunctions(tariff):
  10.      if tariff == "LT-I"
  11.           readings = calcLTI_input()
  12.          
  13.           consumption =final_read-intial_read
  14.           total_cost = calcLTI(consumption, con_type)
  15.           print (total_cost)
  16.  
  17. def calcLTI_iput():
  18.      consumption = int(raw_input("If you know the exact consuption, please enter the value and leave other two entires empty, else leave this empty") or "0")
  19.      init_read = int(raw_input("Please enter the intial reading") or 0)
  20.      final_read = int(raw_input("Please enter the final reading") or 0)
  21.      type_of_conction = int(raw_input("Please enter 3 for 3Phase connection and 1 for single phase leaving empty will be traseted as signle phase connection") or 1)
  22.      readings = [consumption, init_read, final_read, type_of_conction]
  23.      return readings
  24.  
  25.  
  26.  
  27. #1 ############### LT-I ####################
  28. #A Two part tariff is for house hold cosumers#
  29. def calcLTI(consumption, con_type):
  30.      
  31.      # fixed cost calculation for LT-I
  32.      if con_type == 1:
  33.           fixed_cost = 30;
  34.      elif con_type == 3:
  35.           fixed_cost = 80;
  36.      else:
  37.           print("Type of connection does not exists")
  38.      
  39.      # Energy cost calculation for LT-I    
  40.      if consumption < 250:    # telescopic range
  41.           if consumption < 51:
  42.                 energy_cost = consumption*2.9
  43.           elif consumption <101:
  44.             energy_cost = 145+(consumption-50)*3.4
  45.           elif consumption <151:
  46.             energy_cost = 145+170+(consumption-100)*4.5
  47.           elif consumption <201:
  48.             energy_cost = 145+170+225+(consumption-150)*6.10
  49.           else:
  50.             energy_cost = 145+170+225+305+(consumption-200)*7.3
  51.            
  52.       elif consumption > 250:
  53.          if consumption < 300:
  54.               energy_cost = consumption*5.5
  55.          elif consumption <350:
  56.               energy_cost = consumption*6.2
  57.          elif consumption <400:
  58.               energy_cost = consumption*6.5
  59.          elif consumption <500:
  60.               energy_cost = consumption*6.7
  61.          else:
  62.               energy_cost = consumption*7.5
  63.      return energy_cost+fixed_cost
  64.  
  65. #2 ############### LT-IV(A) ####################
  66. #A Two part tariff is for industrial cosumers#
  67. #general purpose industrial loads (single or three phase)#
  68.  
  69. def calcLT_IVA(consumption, connected_Load):
  70.      
  71.      # fixed cost calculation for LT-IV(A)
  72.      if connected_Load < 10:
  73.           fixed_cost = connected_Load*100
  74.      elif connected_Load > 20:
  75.           fixed_cost = connected_Load*60
  76.      else
  77.           fixed_cost = connected_Load*125
  78.  
  79.      # Energy cost calculation for LT-IV(A)
  80.      energy_cost = consumption*5.2
  81.      return energy_cost+fixed_cost
  82.      
  83. #3 ############### LT-IV(B) ####################
  84. #A Two part tariff is for industrial cosumers#
  85. #IT enabled industrial loads (single or three phase)#
  86.  
  87. def calcLT_IVB(consumption, connected_Load):
  88.      
  89.      # fixed cost calculation for LT-IV(B)
  90.      if connected_Load < 10:
  91.           fixed_cost = connected_Load*100
  92.      elif connected_Load > 20:
  93.           fixed_cost = connected_Load*60
  94.      else:
  95.           fixed_cost = connected_Load*125
  96.      # Energy cost calculation for LT-IV(B)
  97.      energy_cost = consumption*5.8
  98.      return energy_cost+fixed_cost
  99.  
  100. #4 ############### LT-V(A) ####################
  101. #A Two part tariff is for industrial cosumers#
  102. #Agricultaral purpose loads (single or three phase)#
  103.  
  104. def calcLT_VA(consumption, connected_Load):
  105.      
  106.      # fixed cost calculation for LT-V(A)
  107.      fixed_cost = connected_Load*8
  108.      # Energy cost calculation for LT-V(A)
  109.      energy_cost = consumption*2
  110.      return energy_cost+fixed_cost
  111.  
  112. #5 ############### LT-V(B) ####################
  113. #A Two part tariff is for industrial cosumers#
  114. #Agricultaral purpose, anifarming famring sector loads (single or three phase)#
  115.  
  116. def calcLT_VB(consumption, connected_Load):
  117.      
  118.      # fixed cost calculation for LT-V(B)
  119.      fixed_cost = connected_Load*8
  120.      # Energy cost calculation for LT-V(B)
  121.      energy_cost = consumption*2.5
  122.      return energy_cost+fixed_cost
  123.      
  124. #6 ############### LT-VI(A) ####################
  125. #A Two part tariff is for industrial cosumers#
  126. #Goverment or Aided institutions (single or three phase)#
  127.  
  128. def calcLT_VIA(consumption, connected_Load):
  129.      
  130.      # fixed cost calculation for LT-VI(A)
  131.      fixed_cost = connected_Load*50
  132.      # Energy cost calculation for LT-VI(A)
  133.     if consumption < 500:
  134.           energy_cost = consumption*5.5          
  135.     else:
  136.           energy_cost = consumption*6.3
  137.      return energy_cost+fixed_cost
  138.  
  139. #7 ############### LT-VI(B) ####################
  140. #A Two part tariff is for industrial cosumers#
  141. #Self finacing or autonmus institutions (single or three phase)#
  142.  
  143. def calcLT_VIB(consumption, connected_Load)
  144.      
  145.      # fixed cost calculation for LT-VI(B)
  146.      fixed_cost = connected_Load*70
  147.      # Energy cost calculation for LT-VI(B)
  148.     if consumption < 500:
  149.           energy_cost = consumption*6.3          
  150.     else:
  151.           energy_cost = consumption*7.0
  152.      return energy_cost+fixed_cost
  153.  
  154. #8 ############### LT-VI(C) ####################
  155. #A Two part tariff is for industrial cosumers#
  156. #Central goverment institutions (single or three phase)#
  157.  
  158. def calcLT_VIC(consumption, connected_Load):
  159.      
  160.      # fixed cost calculation for LT-VI(C)
  161.      fixed_cost = connected_Load*180
  162.      # Energy cost calculation for LT-VI(C)
  163.     if consumption < 500:
  164.           energy_cost = consumption*7.0          
  165.     else:
  166.           energy_cost = consumption*8.5
  167.      return energy_cost+fixed_cost
  168.      
  169. #9 ############### LT-VI(D) ####################
  170. #A Two part tariff is for industrial cosumers#
  171. #Orphanages and anganwadies#
  172.  
  173. def calcLT_VID(consumption, con_type):
  174.      
  175.      # fixed cost is zero
  176.      # Energy cost calculation for LT-VI(D)
  177.      energy_cost = consumption*1.8
  178.      if con_type == 3:
  179.           if energy_cost< 25:
  180.                energy_cost = 25
  181.      if con_type == 1:
  182.           if energy_cost< 15:
  183.                energy_cost = 15
  184.      return energy_cost
  185.  
  186. #10 ############### LT-VI(E) ####################
  187. #A Two part tariff is for industrial cosumers#
  188. #Other goverment institutions, whose connected load below 2000W #
  189.  
  190. def calcLT_VIE(consumption, con_type):
  191.      
  192.      # fixed cost calculation for LT-IV(E)
  193.      if con_type == 1:
  194.           fixed_cost = 20
  195.      elif con_type == 3:
  196.           fixed_cost = 60
  197.      else :
  198.           print("Type of connection does not exists")
  199.      # Energy cost calculation for LT-IV(E)    
  200.      if consumption < 50:
  201.           energy_cost = consumption*2.8
  202.      elif consumption <120:
  203.          energy_cost = consumption*3.8
  204.      elif consumption <200:
  205.          energy_cost = consumption*4.5
  206.      else:
  207.          energy_cost = consumption*6.3
  208.      return energy_cost+fixed_cost
  209. #11 ############### LT-VI(F) ####################
  210. #A Two part tariff is for industrial cosumers#
  211. #Private hospitals and clinics #
  212.  
  213. def calcLT_VIE(consumption, connected_Load, con_type):    
  214.      # fixed cost calculation for LT-VI(F)
  215.      if con_type == 1:
  216.           fixed_cost = 60
  217.      elif con_type == 3:
  218.           fixed_cost = 120
  219.      else :
  220.           print("Type of connection does not exists")
  221.  
  222.      # Energy cost calculation for LT-VI(F)    
  223.      if consumption < 100:
  224.           energy_cost = consumption*5.8
  225.      elif consumption <200:
  226.       energy_cost = consumption*6.5
  227.      elif consumption <300:
  228.           energy_cost = consumption*7.2
  229.      elif consumption <500:
  230.           energy_cost = consumption*7.8
  231.      else:
  232.       energy_cost = consumption*9.0
  233.      return energy_cost+fixed_cost
  234.  
  235. #12 ############### LT-VII(A) ####################
  236. #A Two part tariff is for industrial cosumers#
  237. #commercial billing, connected load above 1000W #
  238.  
  239. def calcLT_VIE(consumption, connected_Load, con_type):
  240.      
  241.      # fixed cost calculation for LT-VII(A)
  242.      if con_type == 1:
  243.           fixed_cost = connected_Load*60
  244.      elif con_type == 3:
  245.           fixed_cost = connected_Load*120
  246.      else :
  247.           print("Type of connection does not exists")
  248.  
  249.      # Energy cost calculation for LT-VII(A)    
  250.      if consumption < 100:
  251.              energy_cost = consumption*6.0
  252.      elif consumption <200:
  253.          energy_cost = consumption*6.7
  254.      elif consumption <300:
  255.          energy_cost = consumption*7.4
  256.      elif consumption <500:
  257.          energy_cost = consumption*8.0
  258.      else:
  259.          energy_cost = consumption*9.3
  260.      return energy_cost+fixed_cost
  261.  
  262. #13 ############### LT-VII(A) ####################
  263. #A Two part tariff is for industrial cosumers#
  264. #commercial billing, connected load below 1000W #
  265.  
  266. def calcLT_VIE(consumption, connected_Load, con_type)
  267.      
  268.      # fixed cost calculation for LT-VII(A)
  269.      fixed_cost = connected_Load*40
  270.  
  271.      # Energy cost calculation for LT-VII(A)    
  272.         if consumption < 100:
  273.            energy_cost = consumption*4.7
  274.         elif consumption >300:
  275.            print "You are having wrong tariff"
  276.            energy_cost = 0
  277.     elif consumption >200:
  278.        energy_cost = consumption*5.7
  279.     else:
  280.           energy_cost = consumption*6.3
  281.      return energy_cost+fixed_cost
  282.  
  283. #14 ############### LT-VI(C) ####################
  284. #A Two part tariff is for industrial cosumers#
  285. #Cinema Theaters (single or three phase)#
  286.  
  287. def calcLT_VIC(consumption, connected_Load):
  288. # fixed cost calculation for LT-VI(C)
  289.      fixed_cost = connected_Load*90
  290.      # Energy cost calculation for LT-VI(C)
  291.     if consumption < 1000:
  292.           energy_cost = consumption*5.90          
  293.     else:
  294.           energy_cost = consumption*7.3
  295.      return energy_cost+fixed_cost
  296.  
  297. #15 ############### LT-IX ####################
  298. #A Two part tariff is for industrial cosumers#
  299. #Cinema Theaters (single or three phase)#
  300.  
  301. def calcLT_VIC(consumption):
  302.      
  303.      # fixed cost calculation for LT-IX
  304.      fixed_cost = 500
  305.      # Energy cost calculation for LT-IX
  306.      energy_cost = consumption*12.5        
  307.      return energy_cost+fixed_cost
Add Comment
Please, Sign In to add comment