Beispiel #1
0
# Prepare for plotting.
pylab.figure()  #figsize=(16,8))
pylab.ion()
plot = MultilinePlotter(autoscale=1.1, xlim=[0, nf], ylim=[0, 1])

# Read ideal system cost and set-point values determined using OPF.
f_dc = scipy.io.mmread("../data/fDC.mtx").flatten()
f_ac = scipy.io.mmread("../data/fAC.mtx").flatten()
Pg_dc = scipy.io.mmread("../data/PgDC.mtx")
Pg_ac = scipy.io.mmread("../data/PgAC.mtx")
Qg_ac = scipy.io.mmread("../data/QgAC.mtx")

rday = range(nf)
for i in range(len(case.online_generators)):
    plot.setData(i, rday, numpy.zeros(nf))
plot.setData(3, rday, f_dc[:nf])
plot.setData(4, rday, f_ac[:nf])
plot.setData(5, rday, numpy.zeros(nf))  # reward
#plot.setData(6, rday, Pg_ac[:nf] * 10)

plot.setLineStyle(0, color="red")
plot.setLineStyle(1, color="green")
plot.setLineStyle(2, color="blue")
plot.setLineStyle(3, color="black")
plot.setLineStyle(4, color="gray")
plot.setLineStyle(5, color="orange")
#plot.setLineStyle(6, color="black")
plot.setLineStyle(linewidth=2)
plot.update()
Beispiel #2
0
                       xlim=[0, 200],
                       ylim=[0, 200],
                       maxLines=3 * len(experiment.agents))
#plc.graphColor = plc.graphColor[:len(experiment.agents)]
plc.setLineStyle(linewidth=2)

for i, generator in enumerate(case.generators):
    if generator.pcost_model == pylon.PW_LINEAR:
        x = scipy.array([x for x, _ in generator.p_cost])
        y = scipy.array([y for _, y in generator.p_cost])
    elif generator.pcost_model == pylon.POLYNOMIAL:
        x = scipy.arange(0., generator.p_max, 5)
        y = scipy.polyval(scipy.array(generator.p_cost), x)
    else:
        raise
    plc.setData(i, x, y)

# Solve an initial OPF.
# pylon.OPF(case, market.loc_adjust=='dc').solve()

# Save action and reward data for plotting.
agentMap = {}
for agent in experiment.agents:
    agentMap[agent.name] = (scipy.zeros((1, )), scipy.zeros((1, )))

## Save data in tables for plotting with PGF/Tikz.
#tableMap = {"state": {}, "action": {}, "reward": {}}
#timestr = time.strftime("%Y%m%d%H%M", time.gmtime())
#tableDir = tempfile.mkdtemp(prefix=timestr)
#for a in experiment.agents:
#    for t in ("state", "action", "reward"):
Beispiel #3
0
# Prepare for plotting.
pylab.figure()#figsize=(16,8))
pylab.ion()
plot = MultilinePlotter(autoscale=1.1, xlim=[0, nf], ylim=[0, 1])

# Read ideal system cost and set-point values determined using OPF.
f_dc = scipy.io.mmread("../data/fDC.mtx").flatten()
f_ac = scipy.io.mmread("../data/fAC.mtx").flatten()
Pg_dc = scipy.io.mmread("../data/PgDC.mtx")
Pg_ac = scipy.io.mmread("../data/PgAC.mtx")
Qg_ac = scipy.io.mmread("../data/QgAC.mtx")

rday = range(nf)
for i in range(len(case.online_generators)):
    plot.setData(i, rday, numpy.zeros(nf))
plot.setData(3, rday, f_dc[:nf])
plot.setData(4, rday, f_ac[:nf])
plot.setData(5, rday, numpy.zeros(nf)) # reward
#plot.setData(6, rday, Pg_ac[:nf] * 10)

plot.setLineStyle(0, color="red")
plot.setLineStyle(1, color="green")
plot.setLineStyle(2, color="blue")
plot.setLineStyle(3, color="black")
plot.setLineStyle(4, color="gray")
plot.setLineStyle(5, color="orange")
#plot.setLineStyle(6, color="black")
plot.setLineStyle(linewidth=2)
plot.update()
Beispiel #4
0
pylab.ion()
plc = MultilinePlotter(autoscale=1.1, xlim=[0, 200], ylim=[0, 200],
                       maxLines=3 * len(experiment.agents))
#plc.graphColor = plc.graphColor[:len(experiment.agents)]
plc.setLineStyle(linewidth=2)

for i, generator in enumerate(case.generators):
    if generator.pcost_model == pylon.PW_LINEAR:
        x = scipy.array([x for x, _ in generator.p_cost])
        y = scipy.array([y for _, y in generator.p_cost])
    elif generator.pcost_model == pylon.POLYNOMIAL:
        x = scipy.arange(0., generator.p_max, 5)
        y = scipy.polyval(scipy.array(generator.p_cost), x)
    else:
        raise
    plc.setData(i, x, y)

# Solve an initial OPF.
# pylon.OPF(case, market.loc_adjust=='dc').solve()

# Save action and reward data for plotting.
agentMap = {}
for agent in experiment.agents:
    agentMap[agent.name] = (scipy.zeros((1,)), scipy.zeros((1,)))

## Save data in tables for plotting with PGF/Tikz.
#tableMap = {"state": {}, "action": {}, "reward": {}}
#timestr = time.strftime("%Y%m%d%H%M", time.gmtime())
#tableDir = tempfile.mkdtemp(prefix=timestr)
#for a in experiment.agents:
#    for t in ("state", "action", "reward"):