Beispiel #1
0
def leak_on_reset():
    # create a problem
    loads_times = make_loads_times(Pdt=[20,30,40,50])
    generators = [
        powersystems.Generator(name='expensive', costcurveequation='30P+0.01P^2'),
        powersystems.Generator(name='cheap', costcurveequation='20P+0.005P^2')
        ]
    
    # solve it
    power_system, times = solve_problem(generators, **loads_times)
    # reset the model - no pyomo components should persist
    power_system.reset_model()
        
    test_counts = get_counts('uc')    
    assert sum(test_counts.values()) == 0
Beispiel #2
0
def line_limit_low():
    '''
    Create a two bus system
        -cheap gen on busA
        -expensive gen and load on busB, 
        -line (from B to A) limit lower than load
    Ensure that: 
        - the line is at its limit 
        - the congestion price is equal to the diff. in LMPs
    '''
    pmin = -100
    generators = [make_cheap_gen(bus='A'), make_expensive_gen(bus='B')]
    lines = [powersystems.Line(pmin=pmin, frombus='B', tobus='A')]
    power_system, times = solve_problem(generators,
                                        do_reset_config=False,
                                        lines=lines,
                                        **make_loads_times(Pd=225, bus='B'))
    Pline = lines[0].power(times[0])
    lmps = [b.price(times[0]) for b in power_system.buses]
    congestion_price = lines[0].price(times[0])
    assert Pline == pmin and congestion_price == -1 * (lmps[1] - lmps[0])
Beispiel #3
0
def line_limit_low():
    '''
    Create a two bus system
        -cheap gen on busA
        -expensive gen and load on busB, 
        -line (from B to A) limit lower than load
    Ensure that: 
        - the line is at its limit 
        - the congestion price is equal to the diff. in LMPs
    '''
    pmin = -100
    generators=[
        make_cheap_gen(bus='A'),
        make_expensive_gen(bus='B')
    ]    
    lines=[powersystems.Line(pmin=pmin, frombus='B', tobus='A')]
    power_system,times=solve_problem(generators, do_reset_config=False,
        lines=lines, **make_loads_times(Pd=225,bus='B'))
    Pline = lines[0].power(times[0])
    lmps=[b.price(times[0]) for b in power_system.buses]
    congestion_price = lines[0].price(times[0])
    assert Pline==pmin and congestion_price == -1*(lmps[1] - lmps[0])