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
 void deferredUnsubscribe(int customerCount)
          Handles the actual unsubscribe operation.
 double getCurtailment()
          Returns the curtailment in kwh for the previous timeslot.
 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()
           
 double getMaxRemainingCurtailment()
          Returns the maximum curtailment possible after the customer model has run and possibly applied economic controls.
 org.powertac.common.Tariff getTariff()
           
 double getTotalUsage()
           
 void handleRevokedTariff()
          Handles the subscription switch in case the underlying Tariff has been revoked.
 void postBalancingControl(double kwh)
          Posts a BalancingControlEvent to the subscription.
 void postRatioControl(double ratio)
          Posts the ratio for an EconomicControlEvent to the subscription for the current timeslot.
 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.


deferredUnsubscribe

public void deferredUnsubscribe(int customerCount)
Handles the actual unsubscribe operation. Intended to be called by the TariffMarket to avoid subscription changes between customer consumption/production and balancing.


handleRevokedTariff

public void 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.


postRatioControl

public void postRatioControl(double ratio)
Posts the ratio for an EconomicControlEvent to the subscription for the current timeslot. .


postBalancingControl

public void postBalancingControl(double kwh)
Posts a BalancingControlEvent to the subscription. This simply updates the curtailment for the current timeslot by the amout of the control. A positive value for kwh represents a reduction in consumption, or an increase in production - in other words, a net gain for the broker's energy account balance.


getCurtailment

public double getCurtailment()
Returns the curtailment in kwh for the previous timeslot. Note that this method is not idempotent; if you call it twice in the same timeslot, the second time returns zero.


getMaxRemainingCurtailment

public double getMaxRemainingCurtailment()
Returns the maximum curtailment possible after the customer model has run and possibly applied economic controls. Since this is potentially accessed after customers have updated their subscriptions, it's possible that the value will have to be changed.


getExpiredCustomerCount

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



Copyright © 2012 Power TAC. All Rights Reserved.