Skip to content

Commit

Permalink
Fix electricity sources for IN_DL (#1903)
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudh-ramesh authored and corradio committed Jul 22, 2019
1 parent f5934f5 commit 2e8ea17
Showing 1 changed file with 24 additions and 35 deletions.
59 changes: 24 additions & 35 deletions parsers/IN_DL.py
Expand Up @@ -5,6 +5,14 @@
from .lib import zonekey
from .lib import IN

plants = {
"CCGT-Bawana": "Gas",
"DMSWSL-Dsidc": "G2E",
"EDWPL-Gazipur": "G2E",
"GT": "Gas",
"Pragati": "Gas",
"TOWMP-Okhla": "G2E"
}

def fetch_consumption(zone_key='IN-DL', session=None, target_datetime=None, logger=None):
"""Fetch Delhi consumption"""
Expand Down Expand Up @@ -32,7 +40,13 @@ def fetch_production(zone_key='IN-DL', session=None, target_datetime=None, logge
"""Fetch Delhi production"""
if target_datetime:
raise NotImplementedError('This parser is not yet able to parse past dates')


energy = {
"Gas": 0,
"G2E": 0,
"Coal": 0
}

zonekey.assert_zone_key(zone_key, 'IN-DL')

html = web.get_response_soup(zone_key, 'http://www.delhisldc.org/Redirect.aspx?Loc=0804', session)
Expand All @@ -43,53 +57,28 @@ def fetch_production(zone_key='IN-DL', session=None, target_datetime=None, logge
prod_table = html.find("table", {"id": "ContentPlaceHolder3_dgenco"})
prod_rows = prod_table.findAll('tr')

# BTPS https://en.wikipedia.org/wiki/Badarpur_Thermal_Power_Station
btps = read_value(prod_rows[1])

# CCGT https://en.wikipedia.org/wiki/Pragati-III_Combined_Cycle_Power_Plant = Pragati-3
ccgt = read_value(prod_rows[2])

# DMSWSL (Delhi Municipal Solid Waste Solutions Limited): Garbage-to-electricity
dmswsl = read_value(prod_rows[3])

# EDWPL (East Delhi Waste Processing Company Limited): Garbage-to-electricity
edwpl = read_value(prod_rows[4])

# GT (Gas Turbine) https://en.wikipedia.org/wiki/IPGCL_Gas_Turbine_Power_Station
gt = read_value(prod_rows[5])

# Pragati https://en.wikipedia.org/wiki/Pragati-I_Combined_Cycle_Gas_Power_Station = Pragati-1
pragati = read_value(prod_rows[6])

# TOWMP (Timarpur Okhla Waste Management Company Pvt. Ltd.): Garbage-to-electricity
towmp = read_value(prod_rows[7])

# Coal production
coal = btps

# Gas production
gas = ccgt + pragati + gt

# Unknown production
garbage = dmswsl + edwpl + towmp
for plant in range(1, len(plants) + 1):
energy[plants[read_name(prod_rows[plant])]] += read_value(prod_rows[plant])

data = {
'zoneKey': zone_key,
'datetime': india_date_time.datetime,
'production': {
'coal': coal,
'gas': gas,
'biomass': garbage
'coal': energy["Coal"],
'gas': energy["Gas"],
'biomass': energy["G2E"]
},
'source': 'delhisldc.org',
}

return data

def read_value(row):
value = float(row.findAll('td')[2].text)
def read_value(row, index=2):
value = float(row.findAll('td')[index].text)
return value if value >= 0.0 else 0.0

def read_name(row, index=0):
return row.findAll('td')[index].text


if __name__ == '__main__':
Expand Down

0 comments on commit 2e8ea17

Please sign in to comment.