Ejemplo n.º 1
0
def simulate(group_num,
             rtn_t0=15,
             plant='plant3',
             model='rtn1',
             price=[10.0] * 24,
             price_id='0',
             work_dir='/',
             run_clex=True):
    test_case = json.load(open('data/%s_%s.json' % (plant, model), 'r'))

    test_case['energy_price'] = price

    test_case['model'] = model
    test_case['rtn_t0'] = rtn_t0
    test_case['group_num'] = group_num
    test_case['case'] = plant
    doc = '%s_%s_G%d_t%d_p%s' % (plant, model, group_num, rtn_t0, price_id)
    test_case['doc'] = doc
    test_case['price_id'] = price_id

    for key in test_case['group2heats'].keys():
        if int(key) > test_case['group_num']:
            del test_case['group2heats'][key]

    if run_clex:
        run_rtn(test_case, None, work_dir)

    # steel_util.check_model(test_case, None, ref_name='rtn2_G1_t15_case2')
    steel_util.draw_schedule(test_case, work_dir)
Ejemplo n.º 2
0
def simulate(group_num, rtn_t0=15, plant='plant1', model='rtn2', suffix='', heu=False, acc=False, heu_all=False):
    test_case = json.load(open('data/%s_%s.json' % (plant, model), 'r'))

    # test_case['energy_price'] = [10, 20] + [h*h+5 for h in range(21, -1, -1)]
    # json.dump(test_case, open('data/a2_rtn2.json', 'w+'), indent=2)

    test_case['model'] = model
    test_case['rtn_t0'] = rtn_t0
    test_case['group_num'] = group_num
    test_case['case'] = plant
    doc = '%s_%s_G%d_t%d' % (plant, model, group_num, rtn_t0)

    opt_options = {'heuristic_eaf': heu,
                   'obj_f_type': 'MAKE_SPAN',
                   # 'impose_group_order_stages': [1],
                   'heuristic_all': heu_all,
                   'accurate_wait': acc}

    if 'accurate_wait' in opt_options and opt_options['accurate_wait']:
        doc += '_acc'
        opt_options['task_order'] = True
    if 'heuristic_eaf' in opt_options and opt_options['heuristic_eaf']:
        doc += '_heu'
    if 'heuristic_all' in opt_options and opt_options['heuristic_all']:
        doc += '_all'
    if bool_heat_trick:
        doc += '_trick'
    if 'obj_f_type' in opt_options and opt_options['obj_f_type'] == 'MAKE_SPAN':
        doc = 'span_%s' % doc
    test_case['doc'] = doc + suffix

    # log.info('Opt options ...')
    # log.info(json.dumps(opt_options, indent=2))

    for key in test_case['group2heats'].keys():
        if int(key) > test_case['group_num']:
            del test_case['group2heats'][key]

    original_process_time = copy.deepcopy(test_case['equip2process_time'])
    if bool_heat_trick:
        t_step = 1
        for g, heats in test_case['group2heats'].items():
            d_t = t_step*len(heats)
            for heat in heats:
                d_t -= t_step
                for u in test_case['equip2process_time'].keys():
                    test_case['equip2process_time'][u][str(heat)] -= d_t

    if bool_solve_opt:
        run_rtn(test_case, opt_options)

    if bool_check_model:
        steel_util.check_model(test_case, opt_options, ref_name='rtn2_G1_t15_case2')

    if bool_display:
        if bool_heat_trick:
            test_case['equip2process_time'] = original_process_time
        steel_util.draw_schedule(test_case, opt_options)
def simulate(group_num, rtn_t0=15, plant='plant3', model='rtn1', price=[10.0]*24, price_id='0',
             work_dir='/', run_clex=True):
    test_case = json.load(open('data/%s_%s.json' % (plant, model), 'r'))

    test_case['energy_price'] = price

    test_case['model'] = model
    test_case['rtn_t0'] = rtn_t0
    test_case['group_num'] = group_num
    test_case['case'] = plant
    doc = '%s_%s_G%d_t%d_p%s' % (plant, model, group_num, rtn_t0, price_id)
    test_case['doc'] = doc
    test_case['price_id'] = price_id

    for key in test_case['group2heats'].keys():
        if int(key) > test_case['group_num']:
            del test_case['group2heats'][key]

    if run_clex:
        run_rtn(test_case, None, work_dir)

    # steel_util.check_model(test_case, None, ref_name='rtn2_G1_t15_case2')
    steel_util.draw_schedule(test_case, work_dir)