BHADRA_JAYAKUMAR

EB_Cost.py

Dec 3rd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 9.95 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.      else if connected_Load > 20:
  93.           fixed cost = connected_Load*60;
  94.      else
  95.           fixed cost = connected_Load*125;
  96.           return
  97.      # Energy cost calculation for LT-IV(B)
  98.      energy_cost = consumption*5.8
  99.      return energy_cost+fixed cost
  100.  
  101. #4 ############### LT-V(A) ####################
  102. #A Two part tariff is for industrial cosumers#
  103. #Agricultaral purpose loads (single or three phase)#
  104.  
  105. def calcLT_VA(consumption, connected_Load)
  106.      
  107.      # fixed cost calculation for LT-V(A)
  108.      fixed cost = connected_Load*8;
  109.      # Energy cost calculation for LT-V(A)
  110.      energy_cost = consumption*2
  111.      return energy_cost+fixed cost
  112.  
  113. #5 ############### LT-V(B) ####################
  114. #A Two part tariff is for industrial cosumers#
  115. #Agricultaral purpose, anifarming famring sector loads (single or three phase)#
  116.  
  117. def calcLT_VB(consumption, connected_Load)
  118.      
  119.      # fixed cost calculation for LT-V(B)
  120.      fixed cost = connected_Load*8;
  121.      # Energy cost calculation for LT-V(B)
  122.      energy_cost = consumption*2.5
  123.      return energy_cost+fixed cost
  124.      
  125. #6 ############### LT-VI(A) ####################
  126. #A Two part tariff is for industrial cosumers#
  127. #Goverment or Aided institutions (single or three phase)#
  128.  
  129. def calcLT_VIA(consumption, connected_Load)
  130.      
  131.      # fixed cost calculation for LT-VI(A)
  132.      fixed cost = connected_Load*50;
  133.      # Energy cost calculation for LT-VI(A)
  134.     if consumption < 500:
  135.           energy_cost = consumption*5.5          
  136.     else:
  137.           energy_cost = consumption*6.3
  138.      return energy_cost+fixed cost
  139.  
  140. #7 ############### LT-VI(B) ####################
  141. #A Two part tariff is for industrial cosumers#
  142. #Self finacing or autonmus institutions (single or three phase)#
  143.  
  144. def calcLT_VIB(consumption, connected_Load)
  145.      
  146.      # fixed cost calculation for LT-VI(B)
  147.      fixed cost = connected_Load*70;
  148.      # Energy cost calculation for LT-VI(B)
  149.     if consumption < 500:
  150.           energy_cost = consumption*6.3          
  151.     else:
  152.           energy_cost = consumption*7.0
  153.      return energy_cost+fixed cost
  154.  
  155. #8 ############### LT-VI(C) ####################
  156. #A Two part tariff is for industrial cosumers#
  157. #Central goverment institutions (single or three phase)#
  158.  
  159. def calcLT_VIC(consumption, connected_Load)
  160.      
  161.      # fixed cost calculation for LT-VI(C)
  162.      fixed cost = connected_Load*180;
  163.      # Energy cost calculation for LT-VI(C)
  164.     if consumption < 500:
  165.           energy_cost = consumption*7.0          
  166.     else:
  167.           energy_cost = consumption*8.5
  168.      return energy_cost+fixed cost
  169.      
  170. #9 ############### LT-VI(D) ####################
  171. #A Two part tariff is for industrial cosumers#
  172. #Orphanages and anganwadies#
  173.  
  174. def calcLT_VID(consumption, con_type)
  175.      
  176.      # fixed cost is zero
  177.      # Energy cost calculation for LT-VI(D)
  178.      energy_cost = consumption*1.8
  179.      if con_type = 3:
  180.           if energy_cost< 25:
  181.                energy_cost = 25
  182.      if con_type = 1:
  183.           if energy_cost< 15:
  184.                energy_cost = 15
  185.      return energy_cost
  186.  
  187. #10 ############### LT-VI(E) ####################
  188. #A Two part tariff is for industrial cosumers#
  189. #Other goverment institutions, whose connected load below 2000W #
  190.  
  191. def calcLT_VIE(consumption, con_type)
  192.      
  193.      # fixed cost calculation for LT-IV(E)
  194.      if con_type = 1:
  195.           fixed cost = 20;
  196.      elif con_type = 3:
  197.           fixed cost = 60;
  198.      else
  199.           print("Type of connection does not exists")
  200.           return
  201.      # Energy cost calculation for LT-IV(E)    
  202.      if consumption < 50:
  203.           energy_cost = consumption*2.8
  204.     elif consumption <120:
  205.          energy_cost = consumption*3.8
  206.     elif consumption <200:
  207.          energy_cost = consumption*4.5
  208.     else:
  209.          energy_cost = consumption*6.3
  210.      return energy_cost+fixed cost
  211. #11 ############### LT-VI(F) ####################
  212. #A Two part tariff is for industrial cosumers#
  213. #Private hospitals and clinics #
  214.  
  215. def calcLT_VIE(consumption, connected_Load, con_type)
  216.      
  217.      # fixed cost calculation for LT-VI(F)
  218.      if con_type = 1:
  219.           fixed cost = 60;
  220.      elif con_type = 3:
  221.           fixed cost = 120;
  222.      else
  223.           print("Type of connection does not exists")
  224.  
  225.      # Energy cost calculation for LT-VI(F)    
  226.      if consumption < 100:
  227.           energy_cost = consumption*5.8
  228.     elif consumption <200:
  229.          energy_cost = consumption*6.5
  230.     elif consumption <300:
  231.          energy_cost = consumption*7.2
  232.     elif consumption <500:
  233.          energy_cost = consumption*7.8
  234.     else:
  235.          energy_cost = consumption*9.0
  236.      return energy_cost+fixed cost
  237.  
  238. #12 ############### LT-VII(A) ####################
  239. #A Two part tariff is for industrial cosumers#
  240. #commercial billing, connected load above 1000W #
  241.  
  242. def calcLT_VIE(consumption, connected_Load, con_type)
  243.      
  244.      # fixed cost calculation for LT-VII(A)
  245.      if con_type = 1:
  246.           fixed cost = connected_Load*60;
  247.      elif con_type = 3:
  248.           fixed cost = connected_Load*120;
  249.      else
  250.           print("Type of connection does not exists")
  251.  
  252.      # Energy cost calculation for LT-VII(A)    
  253.      if consumption < 100:
  254.           energy_cost = consumption*6.0
  255.     elif consumption <200:
  256.          energy_cost = consumption*6.7
  257.     elif consumption <300:
  258.          energy_cost = consumption*7.4
  259.     elif consumption <500:
  260.          energy_cost = consumption*8.0
  261.     else:
  262.          energy_cost = consumption*9.3
  263.      return energy_cost+fixed cost
  264.  
  265. #13 ############### LT-VII(A) ####################
  266. #A Two part tariff is for industrial cosumers#
  267. #commercial billing, connected load below 1000W #
  268.  
  269. def calcLT_VIE(consumption, connected_Load, con_type)
  270.      
  271.      # fixed cost calculation for LT-VII(A)
  272.      fixed cost = connected_Load*40;
  273.  
  274.      # Energy cost calculation for LT-VII(A)    
  275.      if consumption < 100:
  276.           energy_cost = consumption*4.7
  277.     elif consumption >300:
  278.           print "You are having wrong tariff"
  279.           energy_cost = 0
  280.     elif consumption >200:
  281.          energy_cost = consumption*5.7
  282.     else:
  283.          energy_cost = consumption*6.3
  284.      return energy_cost+fixed cost
  285.  
  286. #14 ############### LT-VI(C) ####################
  287. #A Two part tariff is for industrial cosumers#
  288. #Cinema Theaters (single or three phase)#
  289.  
  290. def calcLT_VIC(consumption, connected_Load)
  291.      
  292.      # fixed cost calculation for LT-VI(C)
  293.      fixed cost = connected_Load*90;
  294.      # Energy cost calculation for LT-VI(C)
  295.     if consumption < 1000:
  296.           energy_cost = consumption*5.90          
  297.     else:
  298.           energy_cost = consumption*7.3
  299.      return energy_cost+fixed cost
  300.  
  301. #15 ############### LT-IX ####################
  302. #A Two part tariff is for industrial cosumers#
  303. #Cinema Theaters (single or three phase)#
  304.  
  305. def calcLT_VIC(consumption)
  306.      
  307.      # fixed cost calculation for LT-IX
  308.      fixed cost = 500;
  309.      # Energy cost calculation for LT-IX
  310.      energy_cost = consumption*12.5        
  311.      return energy_cost+fixed cost
Add Comment
Please, Sign In to add comment