org.powertac.accounting
Class AccountingService

java.lang.Object
  extended by org.powertac.common.interfaces.TimeslotPhaseProcessor
      extended by org.powertac.accounting.AccountingService
All Implemented Interfaces:
org.powertac.common.interfaces.Accounting, org.powertac.common.interfaces.InitializationService

@Service
public class AccountingService
extends org.powertac.common.interfaces.TimeslotPhaseProcessor
implements org.powertac.common.interfaces.Accounting, org.powertac.common.interfaces.InitializationService

Implementation of Accounting

Author:
John Collins

Constructor Summary
AccountingService()
           
 
Method Summary
 void activate(org.joda.time.Instant time, int phaseNumber)
          Processes the pending transaction list, computes interest, sends updates to brokers
 org.powertac.common.BalancingTransaction addBalancingTransaction(org.powertac.common.Broker broker, double kWh, double charge)
           
 org.powertac.common.DistributionTransaction addDistributionTransaction(org.powertac.common.Broker broker, double kWh, double charge)
           
 org.powertac.common.MarketTransaction addMarketTransaction(org.powertac.common.Broker broker, org.powertac.common.Timeslot timeslot, double mWh, double price)
           
 org.powertac.common.TariffTransaction addTariffTransaction(org.powertac.common.TariffTransaction.Type txType, org.powertac.common.Tariff tariff, org.powertac.common.CustomerInfo customer, int customerCount, double kWh, double charge)
           
 Double getBankInterest()
           
 double getCurrentMarketPosition(org.powertac.common.Broker broker)
          Gets the net market position for the current timeslot.
 double getCurrentNetLoad(org.powertac.common.Broker broker)
          Returns the net load for the given broker in the current timeslot.
 double getMaxInterest()
           
 double getMinInterest()
           
 void init(org.powertac.common.PluginConfig config)
          Sets parameters, registers for timeslot phase activation.
 String initialize(org.powertac.common.Competition competition, List<String> completedInits)
           
 void processTransaction(org.powertac.common.BalancingTransaction tx, ArrayList<Object> messages)
           
 void processTransaction(org.powertac.common.BankTransaction tx, ArrayList<Object> messages)
           
 void processTransaction(org.powertac.common.DistributionTransaction tx, ArrayList<Object> messages)
           
 void processTransaction(org.powertac.common.MarketTransaction tx, ArrayList<Object> messages)
           
 void processTransaction(org.powertac.common.TariffTransaction tx, ArrayList<Object> messages)
           
 void setDefaults()
           
 
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

AccountingService

public AccountingService()
Method Detail

setDefaults

public void setDefaults()
Specified by:
setDefaults in interface org.powertac.common.interfaces.InitializationService

initialize

public String initialize(org.powertac.common.Competition competition,
                         List<String> completedInits)
Specified by:
initialize in interface org.powertac.common.interfaces.InitializationService

init

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


addMarketTransaction

public org.powertac.common.MarketTransaction addMarketTransaction(org.powertac.common.Broker broker,
                                                                  org.powertac.common.Timeslot timeslot,
                                                                  double mWh,
                                                                  double price)
Specified by:
addMarketTransaction in interface org.powertac.common.interfaces.Accounting

addTariffTransaction

public org.powertac.common.TariffTransaction addTariffTransaction(org.powertac.common.TariffTransaction.Type txType,
                                                                  org.powertac.common.Tariff tariff,
                                                                  org.powertac.common.CustomerInfo customer,
                                                                  int customerCount,
                                                                  double kWh,
                                                                  double charge)
Specified by:
addTariffTransaction in interface org.powertac.common.interfaces.Accounting

addDistributionTransaction

public org.powertac.common.DistributionTransaction addDistributionTransaction(org.powertac.common.Broker broker,
                                                                              double kWh,
                                                                              double charge)
Specified by:
addDistributionTransaction in interface org.powertac.common.interfaces.Accounting

addBalancingTransaction

public org.powertac.common.BalancingTransaction addBalancingTransaction(org.powertac.common.Broker broker,
                                                                        double kWh,
                                                                        double charge)
Specified by:
addBalancingTransaction in interface org.powertac.common.interfaces.Accounting

getCurrentNetLoad

public double getCurrentNetLoad(org.powertac.common.Broker broker)
Returns the net load for the given broker in the current timeslot. Note that this only works AFTER the customer models have run, and BEFORE the day's transactions have been processed. The value will be negative if the broker's customers are consuming more than they produce in the current timeslot.

Specified by:
getCurrentNetLoad in interface org.powertac.common.interfaces.Accounting

getCurrentMarketPosition

public double getCurrentMarketPosition(org.powertac.common.Broker broker)
Gets the net market position for the current timeslot. This only works on processed transactions, but it can be used before activation in case there can be no new market transactions for the current timeslot. This is the normal case. The value will be positive if the broker is importing power during the current timeslot.

Specified by:
getCurrentMarketPosition in interface org.powertac.common.interfaces.Accounting

activate

public void activate(org.joda.time.Instant time,
                     int phaseNumber)
Processes the pending transaction list, computes interest, sends updates to brokers

Specified by:
activate in interface org.powertac.common.interfaces.Accounting
Specified by:
activate in class org.powertac.common.interfaces.TimeslotPhaseProcessor

processTransaction

public void processTransaction(org.powertac.common.TariffTransaction tx,
                               ArrayList<Object> messages)

processTransaction

public void processTransaction(org.powertac.common.BalancingTransaction tx,
                               ArrayList<Object> messages)

processTransaction

public void processTransaction(org.powertac.common.DistributionTransaction tx,
                               ArrayList<Object> messages)

processTransaction

public void processTransaction(org.powertac.common.MarketTransaction tx,
                               ArrayList<Object> messages)

processTransaction

public void processTransaction(org.powertac.common.BankTransaction tx,
                               ArrayList<Object> messages)

getMinInterest

public double getMinInterest()

getMaxInterest

public double getMaxInterest()

getBankInterest

public Double getBankInterest()


Copyright © 2012 Power TAC. All Rights Reserved.