org.powertac.tariffmarket
Class TariffMarketService

java.lang.Object
  extended by org.powertac.common.interfaces.TimeslotPhaseProcessor
      extended by org.powertac.tariffmarket.TariffMarketService
All Implemented Interfaces:
org.powertac.common.interfaces.BrokerMessageListener, org.powertac.common.interfaces.TariffMarket

@Service
public class TariffMarketService
extends org.powertac.common.interfaces.TimeslotPhaseProcessor
implements org.powertac.common.interfaces.TariffMarket, org.powertac.common.interfaces.BrokerMessageListener

Implements the Tariff Market abstraction. Incoming tariff-related messages from brokers are received and processed, tariffs are published periodically, and subscriptions are processed on behalf of customers.

Author:
John Collins

Constructor Summary
TariffMarketService()
          Default constructor
 
Method Summary
 void activate(org.joda.time.Instant time, int phase)
           
 List<org.powertac.common.Tariff> getActiveTariffList(org.powertac.common.enumerations.PowerType type)
           
 org.powertac.common.Tariff getDefaultTariff(org.powertac.common.enumerations.PowerType type)
          Returns the default tariff
 int getPublicationInterval()
           
 double getTariffPublicationFee()
           
 double getTariffRevocationFee()
           
 void init(org.powertac.common.PluginConfig config)
          Reads configuration parameters, registers for timeslot phase activation.
 org.powertac.common.msg.TariffStatus processTariff(org.powertac.common.msg.TariffExpire update)
          Handles changes in tariff expiration date.
 org.powertac.common.msg.TariffStatus processTariff(org.powertac.common.msg.TariffRevoke update)
          Handles tariff revocation.
 org.powertac.common.msg.TariffStatus processTariff(org.powertac.common.TariffSpecification spec)
          Processes a newly-published tariff.
 org.powertac.common.msg.TariffStatus processTariff(org.powertac.common.msg.VariableRateUpdate update)
          Applies a new HourlyCharge to an existing Tariff with a variable Rate.
 void receiveMessage(Object msg)
          Receives and dispatches an incoming broker message.
 void registerNewTariffListener(org.powertac.common.interfaces.NewTariffListener listener)
           
 boolean setDefaultTariff(org.powertac.common.TariffSpecification newSpec)
           
 org.powertac.common.TariffSubscription subscribeToTariff(org.powertac.common.Tariff tariff, org.powertac.common.CustomerInfo customer, int customerCount)
          Subscribes a block of Customers from a single Customer model to this Tariff, as long as this Tariff has not expired.
 
Methods inherited from class org.powertac.common.interfaces.TimeslotPhaseProcessor
init, setTimeslotPhase
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TariffMarketService

public TariffMarketService()
Default constructor

Method Detail

init

public void init(org.powertac.common.PluginConfig config)
Reads configuration parameters, registers for timeslot phase activation.


getTariffPublicationFee

public double getTariffPublicationFee()

getTariffRevocationFee

public double getTariffRevocationFee()

getPublicationInterval

public int getPublicationInterval()

receiveMessage

public void receiveMessage(Object msg)
Receives and dispatches an incoming broker message. We do this synchronously with the incoming message traffic, rather than on the timeslot phase signal, to minimize latency for broker feedback.

Specified by:
receiveMessage in interface org.powertac.common.interfaces.BrokerMessageListener

processTariff

public org.powertac.common.msg.TariffStatus processTariff(org.powertac.common.TariffSpecification spec)
Processes a newly-published tariff.

Specified by:
processTariff in interface org.powertac.common.interfaces.TariffMarket

processTariff

public org.powertac.common.msg.TariffStatus processTariff(org.powertac.common.msg.TariffExpire update)
Handles changes in tariff expiration date.

Specified by:
processTariff in interface org.powertac.common.interfaces.TariffMarket

processTariff

public org.powertac.common.msg.TariffStatus processTariff(org.powertac.common.msg.TariffRevoke update)
Handles tariff revocation.

Specified by:
processTariff in interface org.powertac.common.interfaces.TariffMarket

processTariff

public org.powertac.common.msg.TariffStatus processTariff(org.powertac.common.msg.VariableRateUpdate update)
Applies a new HourlyCharge to an existing Tariff with a variable Rate.

Specified by:
processTariff in interface org.powertac.common.interfaces.TariffMarket

registerNewTariffListener

public void registerNewTariffListener(org.powertac.common.interfaces.NewTariffListener listener)
Specified by:
registerNewTariffListener in interface org.powertac.common.interfaces.TariffMarket

activate

public void activate(org.joda.time.Instant time,
                     int phase)
Specified by:
activate in class org.powertac.common.interfaces.TimeslotPhaseProcessor

subscribeToTariff

public org.powertac.common.TariffSubscription subscribeToTariff(org.powertac.common.Tariff tariff,
                                                                org.powertac.common.CustomerInfo customer,
                                                                int customerCount)
Subscribes a block of Customers from a single Customer model to this Tariff, as long as this Tariff has not expired. If the subscription succeeds, then the TariffSubscription instance is return, otherwise null.

Note that you cannot unsubscribe directly from a Tariff -- you have to do that from the TariffSubscription that represents the Tariff you want to unsubscribe from.

Specified by:
subscribeToTariff in interface org.powertac.common.interfaces.TariffMarket

getActiveTariffList

public List<org.powertac.common.Tariff> getActiveTariffList(org.powertac.common.enumerations.PowerType type)
Specified by:
getActiveTariffList in interface org.powertac.common.interfaces.TariffMarket

getDefaultTariff

public org.powertac.common.Tariff getDefaultTariff(org.powertac.common.enumerations.PowerType type)
Returns the default tariff

Specified by:
getDefaultTariff in interface org.powertac.common.interfaces.TariffMarket

setDefaultTariff

public boolean setDefaultTariff(org.powertac.common.TariffSpecification newSpec)
Specified by:
setDefaultTariff in interface org.powertac.common.interfaces.TariffMarket


Copyright © 2011 Power TAC. All Rights Reserved.