Package org.powertac.samplebroker
Class PortfolioManagerService
java.lang.Object
org.powertac.samplebroker.PortfolioManagerService
- All Implemented Interfaces:
org.powertac.samplebroker.interfaces.Activatable,org.powertac.samplebroker.interfaces.Initializable,PortfolioManager
@Service public class PortfolioManagerService extends Object implements PortfolioManager, org.powertac.samplebroker.interfaces.Initializable, org.powertac.samplebroker.interfaces.Activatable
Handles portfolio-management responsibilities for the broker. This
includes composing and offering tariffs, keeping track of customers and their
usage, monitoring tariff offerings from competing brokers.
A more complete broker implementation might split this class into two or
more classes; the keys are to decide which messages each class handles,
what each class does on the activate() method, and what data needs to be
managed and shared.
- Author:
- John Collins
-
Constructor Summary
Constructors Constructor Description PortfolioManagerService()Default constructor. -
Method Summary
Modifier and Type Method Description voidactivate(int timeslotIndex)Called after TimeslotComplete msg received.doublecollectUsage(int index)Returns total usage for a given timeslot (represented as a simple index).voidhandleMessage(org.powertac.common.msg.BalancingControlEvent bce)Handles a BalancingControlEvent, sent when a BalancingOrder is exercised by the DU.voidhandleMessage(org.powertac.common.msg.CustomerBootstrapData cbd)Handles CustomerBootstrapData by populating the customer model corresponding to the given customer and power type.voidhandleMessage(org.powertac.common.msg.TariffRevoke tr)Handles a TariffRevoke message from the server, indicating that some tariff has been revoked.voidhandleMessage(org.powertac.common.msg.TariffStatus ts)Handles a TariffStatus message.voidhandleMessage(org.powertac.common.TariffSpecification spec)Handles a TariffSpecification.voidhandleMessage(org.powertac.common.TariffTransaction ttx)Handles a TariffTransaction.voidinitialize(org.powertac.samplebroker.interfaces.BrokerContext context)Per-game initialization.
-
Constructor Details
-
PortfolioManagerService
public PortfolioManagerService()Default constructor.
-
-
Method Details
-
initialize
public void initialize(org.powertac.samplebroker.interfaces.BrokerContext context)Per-game initialization. Registration of message handlers is automated.- Specified by:
initializein interfaceorg.powertac.samplebroker.interfaces.Initializable
-
collectUsage
public double collectUsage(int index)Returns total usage for a given timeslot (represented as a simple index).- Specified by:
collectUsagein interfacePortfolioManager
-
handleMessage
public void handleMessage(org.powertac.common.msg.CustomerBootstrapData cbd)Handles CustomerBootstrapData by populating the customer model corresponding to the given customer and power type. This gives the broker a running start. -
handleMessage
public void handleMessage(org.powertac.common.TariffSpecification spec)Handles a TariffSpecification. These are sent by the server when new tariffs are published. If it's not ours, then it's a competitor's tariff. We keep track of competing tariffs locally, and we also store them in the tariffRepo. -
handleMessage
public void handleMessage(org.powertac.common.msg.TariffStatus ts)Handles a TariffStatus message. This should do something when the status is not SUCCESS. -
handleMessage
public void handleMessage(org.powertac.common.TariffTransaction ttx)Handles a TariffTransaction. We only care about certain types: PRODUCE, CONSUME, SIGNUP, and WITHDRAW. -
handleMessage
public void handleMessage(org.powertac.common.msg.TariffRevoke tr)Handles a TariffRevoke message from the server, indicating that some tariff has been revoked. -
handleMessage
public void handleMessage(org.powertac.common.msg.BalancingControlEvent bce)Handles a BalancingControlEvent, sent when a BalancingOrder is exercised by the DU. -
activate
public void activate(int timeslotIndex)Called after TimeslotComplete msg received. Note that activation order among modules is non-deterministic.- Specified by:
activatein interfaceorg.powertac.samplebroker.interfaces.Activatable
-