volttron.platform.agent.base_market_agent package

class volttron.platform.agent.base_market_agent.MarketAgent(verbose_logging=True, **kwargs)[source]

Bases: volttron.platform.vip.agent.Agent

The MarketAgents serves as the base class for any agent that wants to praticipate in an auction market. By inheriting from this agent all the remote communication with the MarketService is handled and the sub-class can be unconcerned with those details.

join_market(market_name, buyer_seller, reservation_callback, offer_callback, aggregate_callback, price_callback, error_callback)[source]

This routine is called once to join a market as a buyer or a seller. The agent supplies call-back functions that the MarketAgents calls as the market process proceeds.

Parameters:
  • market_name – The name of the market commodity.
  • buyer_seller – A string indicating whether the agent is buying from or selling to the market.

The agent shall use the pre-defined strings provided.

Parameters:reservation_callback – This callback is called at the beginning of each round of bidding and clearing.

The agent can choose whether or not to participate in this round. If the agent wants to participate it returns true otherwise it returns false. If the agent does not specify a callback routine a reservation will be made for each round automatically. A market will only exist if there are reservations for at least one buyer and at least one seller. If the market fails to achieve the minimum participation the error callback will be called.

Parameters:offer_callback – If the agent has made a reservation for the market this routine is called.

If the agent wishes to make an offer at this time the market agent computes either supply or demand curves as appropriate and offers them to the market service by calling the make offer method. For each market joined either an offer callback or an aggregate callback is required. You can’t supply both for any single market.

Parameters:aggregate_callback – When a market has received all its buy offers it calculates an aggregate

demand curve. When the market receives all of its sell offers it calculates an aggregate supply curve. This callback delivers the aggregate curve to the market agent whenever the appropriate curve becomes available. If the market agent want to use this to make an offer it would do that using the make offer method. For each market joined either an offer callback or an aggregate callback is required. You can’t supply both for any single market.

Parameters:
  • price_callback – This callback is called when the market clears. The price callback is optional.
  • error_callback – This callback is called at appropriate time points or when an error occurs.

If a market fails to form this will be called at the offer time. If the market doesn’t receive all its offers this will be called at market clear time. If the market fails to clear this would be called at the next reservation time. This allows agents to respond at or near the normal time points. The error callback is optional.

log_event(method_name, peer, sender, bus, topic, headers, decoded_message)[source]
make_offer(market_name, buyer_seller, curve)[source]

This call makes an offer with the MarketService.

Parameters:
  • market_name – The name of the market commodity.
  • buyer_seller – A string indicating whether the agent is buying from or selling to the market.

The agent shall use the pre-defined strings provided.

Parameters:curve – The demand curve for buyers or the supply curve for sellers.
match_make_offer(peer, sender, bus, topic, headers, message)[source]
match_report_aggregate(peer, sender, bus, topic, headers, message)[source]
match_report_clear_price(peer, sender, bus, topic, headers, message)[source]
match_report_error(peer, sender, bus, topic, headers, message)[source]
match_reservation(peer, sender, bus, topic, headers, message)[source]

Submodules

volttron.platform.agent.base_market_agent.buy_sell module

volttron.platform.agent.base_market_agent.error_codes module

volttron.platform.agent.base_market_agent.market_registration module

class volttron.platform.agent.base_market_agent.market_registration.MarketRegistration(market_name, buyer_seller, reservation_callback, offer_callback, aggregate_callback, price_callback, error_callback, verbose_logging=True)[source]

Bases: object

make_offer(buyer_seller, curve, rpc_proxy)[source]
report_aggregate(timestamp, buyer_seller, aggregate_curve)[source]
report_clear_price(timestamp, price, quantity)[source]
report_error(timestamp, error_code, error_message, aux)[source]
request_offers(timestamp)[source]
request_reservations(timestamp, rpc_proxy)[source]

volttron.platform.agent.base_market_agent.offer module

class volttron.platform.agent.base_market_agent.offer.Offer(offer_type, commodity, curve)[source]

Bases: object

BUY = 'BUY'
SELL = 'SELL'
commodity()[source]
curve()[source]
type()[source]

volttron.platform.agent.base_market_agent.point module

class volttron.platform.agent.base_market_agent.point.Point(quantity, price)[source]

Bases: tuple

price

Alias for field number 1

quantity

Alias for field number 0

tuppleize()[source]
x

Alias for field number 0

y

Alias for field number 1

volttron.platform.agent.base_market_agent.poly_line module

class volttron.platform.agent.base_market_agent.poly_line.PolyLine[source]
add(point)[source]
static between(a, b, c)[source]
static ccw(p1, p2, p3)[source]
static compare(demand_curve, supply_curve)[source]
contains_none()[source]
static determinant(point1, point2)[source]
static intersection(pl_1, pl_2)[source]
static max(x1, x2)[source]
max_x()[source]
max_y()[source]
static min(x1, x2)[source]
min_x()[source]
min_y()[source]
static segment_intersection(line1, line2)[source]
static segment_intersects(l1, l2)[source]
static sum(x1, x2)[source]
tuppleize()[source]
vectorize()[source]
x(y, left=None, right=None)[source]
y(x, left=None, right=None)[source]

volttron.platform.agent.base_market_agent.poly_line_factory module

class volttron.platform.agent.base_market_agent.poly_line_factory.PolyLineFactory[source]

Bases: object

static combine(lines, increment)[source]
static fromTupples(points)[source]

volttron.platform.agent.base_market_agent.registration_manager module

class volttron.platform.agent.base_market_agent.registration_manager.RegistrationManager(rpc_proxy)[source]

Bases: object

The ReservationManager manages a list of MarketReservations for the MarketAgents. This class exists to hide the features of the underlying collection that are not relevant to managing market reservations.

make_offer(market_name, buyer_seller, curve)[source]
make_registration(market_name, buyer_seller, reservation_callback, offer_callback, aggregate_callback, price_callback, error_callback)[source]
report_aggregate(timestamp, market_name, buyer_seller, aggregate_curve)[source]
report_clear_price(timestamp, market_name, price, quantity)[source]
report_error(timestamp, market_name, error_code, error_message, aux)[source]
request_offers(timestamp, unformed_markets)[source]
request_reservations(timestamp)[source]

volttron.platform.agent.base_market_agent.rpc_proxy module

class volttron.platform.agent.base_market_agent.rpc_proxy.RpcProxy(rpc_call, verbose_logging=True)[source]

Bases: object

The purpose of the RpcProxy is to allow the MarketRegistration to make RPC calls on the agent that subclasses of the agent can’t see and therefore can’t make.

make_offer(market_name, buyer_seller, curve)[source]

This call makes an offer with the MarketService.

Parameters:
  • market_name – The name of the market commodity.
  • buyer_seller – A string indicating whether the agent is buying from or selling to the market.

The agent shall use the pre-defined strings provided.

Parameters:curve – The demand curve for buyers or the supply curve for sellers.
make_reservation(market_name, buyer_seller)[source]

This call makes a reservation with the MarketService. This allows the agent to submit a bid and receive a cleared market price.

Parameters:
  • market_name – The name of the market commodity.
  • buyer_seller – A string indicating whether the agent is buying from or selling to the market.

The agent shall use the pre-defined strings provided.