Пример #1
0
from net.sf.chellow.monad import Monad
import scenario

Monad.getUtils()["impt"](globals(), "scenario")
db_id = globals()["db_id"]

create_future_func = scenario.make_create_future_func_simple("aahedc", ["aahedc_gbp_per_gsp_kwh"])


def hh(supply_source):
    bill = supply_source.supplier_bill
    rate_set = supply_source.supplier_rate_sets["aahedc-rate"]

    try:
        supply_source.caches["aahedc"]
    except KeyError:
        supply_source.caches["aahedc"] = {}

        try:
            future_funcs = supply_source.caches["future_funcs"]
        except KeyError:
            future_funcs = {}
            supply_source.caches["future_funcs"] = future_funcs

        try:
            future_funcs[db_id]
        except KeyError:
            future_funcs[db_id] = {"start_date": None, "func": create_future_func(1, 0)}

    for hh in supply_source.hh_data:
        bill["aahedc-msp-kwh"] += hh["msp-kwh"]
Пример #2
0
from net.sf.chellow.monad import Monad
import scenario
Monad.getUtils()['impt'](globals(), 'scenario')
db_id = globals()['db_id']

create_future_func = scenario.make_create_future_func_simple(
    'ro', ['gbp_per_msp_kwh'])


def hh(supply_source):
    bill = supply_source.supplier_bill
    rate_set = supply_source.supplier_rate_sets['ro-rate']

    try:
        supply_source.caches['ro']
    except KeyError:
        supply_source.caches['ro'] = {}

        try:
            future_funcs = supply_source.caches['future_funcs']
        except KeyError:
            future_funcs = {}
            supply_source.caches['future_funcs'] = future_funcs

        try:
            future_funcs[db_id]
        except KeyError:
            future_funcs[db_id] = {
                'start_date': None, 'func': create_future_func(1, 0)}

    for hh in supply_source.hh_data:
Пример #3
0
from net.sf.chellow.monad import Monad
import datetime
import pytz
import utils
import db
import computer
import scenario

Monad.getUtils()["impt"](globals(), "db", "utils", "computer", "scenario")
HH = utils.HH
Contract = db.Contract
db_id = globals()["db_id"]

create_future_func = scenario.make_create_future_func_simple("ccl", ["ccl_rate"])


def ccl(data_source):
    rate_set = data_source.supplier_rate_sets["ccl-rate"]

    if data_source.supply.find_era_at(data_source.sess, data_source.finish_date + HH) is None:
        sup_end = data_source.finish_date
    else:
        sup_end = None

    try:
        cache = data_source.caches["ccl"]
    except:
        data_source.caches["ccl"] = {}
        cache = data_source.caches["ccl"]

        try: