org.powertac.common
Class TariffSubscription

java.lang.Object
  extended by org.powertac.common.TariffSubscription

public class TariffSubscription
extends Object

A TariffSubscription is an entity representing an association between a Customer and a Tariff. Instances of this class are not intended to be serialized. You get one by calling the subscribe() method on Tariff. If there is no current subscription for that Customer (which in most cases is actually a population model), then a new TariffSubscription is created and returned from the Tariff.

Author:
Carsten Block, John Collins

Constructor Summary
TariffSubscription(org.powertac.common.CustomerInfo customer, org.powertac.common.Tariff tariff)
           
 
Method Summary
 org.powertac.common.CustomerInfo getCustomer()
           
 int getCustomersCommitted()
           
 int getExpiredCustomerCount()
          Returns the number of individual customers who may withdraw from this subscription without penalty.
 long getId()
           
 org.powertac.common.Tariff getTariff()
           
 double getTotalUsage()
           
 TariffSubscription handleRevokedTariff()
          Handles the subscription switch in case the underlying Tariff has been revoked.
 void subscribe(int customerCount)
          Subscribes some number of discrete customers.
 void unsubscribe(int customerCount)
          Removes customerCount customers (at most) from this subscription, posts early-withdrawal fees if appropriate.
 void usePower(double kWh)
          Generates and returns a TariffTransaction instance for the current timeslot that represents the amount of production (negative amount) or consumption (positive amount), along with the credit/debit that results.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TariffSubscription

public TariffSubscription(org.powertac.common.CustomerInfo customer,
                          org.powertac.common.Tariff tariff)
Method Detail

getId

public long getId()

getCustomer

public org.powertac.common.CustomerInfo getCustomer()

getTariff

public org.powertac.common.Tariff getTariff()

getCustomersCommitted

public int getCustomersCommitted()

getTotalUsage

public double getTotalUsage()

subscribe

public void subscribe(int customerCount)
Subscribes some number of discrete customers. This is typically some portion of the population in a population model. We assume this is called from Tariff, as a result of calling tariff.subscribe(). Also, we record the expiration date of the tariff contract, just in case the tariff has a minDuration. For the purpose of computing expiration, all contracts are assumed to begin at 00:00 on the day of the subscription.


unsubscribe

public void unsubscribe(int customerCount)
Removes customerCount customers (at most) from this subscription, posts early-withdrawal fees if appropriate.


handleRevokedTariff

public TariffSubscription handleRevokedTariff()
Handles the subscription switch in case the underlying Tariff has been revoked. Returns the new subscription just in case the Tariff was revoked, otherwise returns null.


usePower

public void usePower(double kWh)
Generates and returns a TariffTransaction instance for the current timeslot that represents the amount of production (negative amount) or consumption (positive amount), along with the credit/debit that results. Also generates a separate TariffTransaction for the fixed periodic payment if it's non-zero.


getExpiredCustomerCount

public int getExpiredCustomerCount()
Returns the number of individual customers who may withdraw from this subscription without penalty.



Copyright © 2011 Power TAC. All Rights Reserved.