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
    void activate​(int timeslotIndex)
    Called after TimeslotComplete msg received.
    double collectUsage​(int index)
    Returns total usage for a given timeslot (represented as a simple index).
    void handleMessage​(org.powertac.common.msg.BalancingControlEvent bce)
    Handles a BalancingControlEvent, sent when a BalancingOrder is exercised by the DU.
    void handleMessage​(org.powertac.common.msg.CustomerBootstrapData cbd)
    Handles CustomerBootstrapData by populating the customer model corresponding to the given customer and power type.
    void handleMessage​(org.powertac.common.msg.TariffRevoke tr)
    Handles a TariffRevoke message from the server, indicating that some tariff has been revoked.
    void handleMessage​(org.powertac.common.msg.TariffStatus ts)
    Handles a TariffStatus message.
    void handleMessage​(org.powertac.common.TariffSpecification spec)
    Handles a TariffSpecification.
    void handleMessage​(org.powertac.common.TariffTransaction ttx)
    Handles a TariffTransaction.
    void initialize​(org.powertac.samplebroker.interfaces.BrokerContext context)
    Per-game initialization.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • initialize

      public void initialize​(org.powertac.samplebroker.interfaces.BrokerContext context)
      Per-game initialization. Registration of message handlers is automated.
      Specified by:
      initialize in interface org.powertac.samplebroker.interfaces.Initializable
    • collectUsage

      public double collectUsage​(int index)
      Returns total usage for a given timeslot (represented as a simple index).
      Specified by:
      collectUsage in interface PortfolioManager
    • 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:
      activate in interface org.powertac.samplebroker.interfaces.Activatable