Class: CurrentPredictor::Calculation

Inherits:
Object
  • Object
show all
Defined in:
lib/currentpredictor.rb

Class Method Summary collapse

Class Method Details

.basedonmeter(cost, standardcharge, pslv, previousreading, currentreading) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/currentpredictor.rb', line 39

def self.basedonmeter(cost, standardcharge,pslv,previousreading,currentreading)
    cost = cost
    standardcharge = standardcharge
    standardcharge = (standardcharge/12).to_i
    pslv = pslv
    pslv = (pslv/12).to_i
    previousreading = previousreading.to_i
    currentreading = currentreading.to_i
    meterreading = (currentreading-previousreading)
    finalcost = ((meterreading*cost)+standardcharge+pslv)
    return meterreading,finalcost
    
end

.consumption(appliances, regular, cost) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/currentpredictor.rb', line 20

def self.consumption(appliances,regular,cost)
   appconsumed = appliances
      reg = regular
   cost = cost
   sum = 0
      reg.each do |ammenties,watt|
        appconsumed.each do |key,value|
              if (key == ammenties)
                   washing = value * watt
                   sum = washing+sum
              end
          end
    end
              sum = sum/1000
              amount = sum * cost
             month = sum * 30
             value = cost * month
             return sum,month,value
end

.monthlyconsumption(matter, room, cost) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/currentpredictor.rb', line 12

def self.monthlyconsumption(matter,room,cost)
   consumption = matter
   cost = cost
   a = room
   b = (consumption*a)/12
   c = b*cost
  return a,b,c
end

.yearlyconsumption_onrooms(matter, room, cost) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/currentpredictor.rb', line 3

def self.yearlyconsumption_onrooms(matter,room,cost)
  consumption = matter
  cost = cost
  a = room
  b = consumption*a
  c = b*cost
  return a,b,c
end