aeso.csd — Current Supply/Demand (CSD) Report Access

Access to current supply demand (CSD) data. The raw report can be accessed at <http://ets.aeso.ca/ets_web/ip/Market/Reports/CSDReportServlet>.

class aeso.csd.CsdStat

Superclass of SystemStat and UnitStat

class aeso.csd.SystemStat(datetime, name, value)

Class representing a system statistic.

New in version 0.6.

Example Usage::
>>> from aeso import csd
>>> from datetime import datetime
>>> dt = datetime(2010, 4, 22)
>>> stat = csd.SystemStat(dt, 'Sample System Statistic', 10)
>>> stat.dt
datetime.datetime(2010, 4, 22, 0, 0)
>>> stat.name
'Sample System Statistic'
>>> stat.value
10
>>> dt, name, value = stat
>>> assert stat.dt == dt
>>> assert stat.name == name
>>> assert stat.value == value
dt

Entry datetime.datetime.

name

Unit name, str.

value

Value, polymorphic.

class aeso.csd.UnitStat(datetime, name, mcr, tng, dcr)

Class representing an entry in the Alberta Integrated Electric System Log. This object will iterate over its members returning self.dt, and self.description in succession.

New in version 0.6.

Example Usage::
>>> from aeso import csd
>>> from datetime import datetime
>>> dt = datetime(2010, 4, 22)
>>> stat = csd.UnitStat(dt, 'Sample Unit Statistic', 10, 5, 0)
>>> stat.dt
datetime.datetime(2010, 4, 22, 0, 0)
>>> stat.name
'Sample Unit Statistic'
>>> stat.mcr
10
>>> stat.tng
5
>>> stat.dcr
0
>>> dt, name, mcr, tng, dcr = stat
>>> assert stat.dt == dt
>>> assert stat.name == name
>>> assert stat.mcr == mcr
>>> assert stat.tng == tng
>>> assert stat.dcr == dcr
dcr

Dispatched contingency reserve.

Return type:Decimal or None
dt

Entry datetime.datetime.

mcr

Maximum continuous rating.

Return type:Decimal
name

Unit name.

tng

Total net generation.

Return type:Decimal or None
aeso.csd.parse_csd_file(f, reference_dt=None)

Yields subclasses of CsdStat objects containing information from file-like object f (as returned by urlopen()). Subclasses of CsdStat presently yielded include:

AESO presently publishes system statistics with the names (2010-03-10):

  • Alberta Total Net Generation
  • Interchange
  • Alberta Internal Load (AIL)
  • Alberta Load Responsibility
  • Contingency Reserve Required
  • Dispatched Contingency Reserve (DCR)
  • Dispatched Contingency Reserve - Gen
  • Dispatched Contingency Reserve - Other
  • BC Interchange flow
  • SK Interchange flow

These system statistics will be represented by yielded SystemStat objects.

Unit data yielded in UnitStat objects may actually be pseudo-units; For example, AESO provides data on a “Coal” unit that represents the generation output of all coal plants in the province.

Changed in version 0.6: Now yields subclasses of CsdData instead of 3-tuples and 5-tuples. The change should be transparent because CsdData subclasses have tuple behaviours like __len__, __iter__, and __getitem__.

New in version 0.5.

Example Usage:

>>> from aeso import csd
>>> from aeso import AB_TZ
>>> systemstats = []
>>> unitstats = []
>>> f = csd.urlopen()
>>> for datapoint in csd.parse_csd_file(f):
...     if isinstance(datapoint, csd.SystemStat):
...         systemstats.append(datapoint)
...     elif isinstance(datapoint, csd.UnitStat):
...         ab_dt = AB_TZ.normalize(datapoint.dt.astimezone(AB_TZ))
...         unitstats.append(datapoint)
...     else:
...         raise TypeError('Unexpected type')
...
>>> f.close()
aeso.csd.urlopen(timeout=None)

Returns an open file-object connected to AESO’s Current Supply Demand (CSD) webservice.

Parameters:timeout – optional parameter specifying timeout in seconds for blocking operations like the connection attempt. If operation times out urllib2.URLError will be raised. ValueError will be raised in Python 2.4 and 2.5 if this parameter is set to anything but None.
Return type:file-like object.

New in version 0.5.

New in version 0.7: timeout parameter.

Previous topic

aeso.atc — Available transfer capacity limits

Next topic

aeso.equilibrium — Market supply/demand equilibrium points

This Page