Interface Accounting


  • public interface Accounting
    Common interface for the PowerTAC accounting service. The accouting service module is responsible for bookeeping, with respect to cash (broker bank accounts) and market positions on behalf of brokers. All activities that could potentially affect cash or market positions must be recorded by making calls on the Accounting API. Summaries of accounts, along with all new transactions, are sent to brokers at the end of each timeslot.

    Accounting is also a TimeslotPhaseProcessor, running in the last phase of the simulation cycle. All processors that can generate transactions must run in earlier phases.

    Author:
    John Collins
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void activate​(org.joda.time.Instant time, int phase)
      Runs the accounting process.
      org.powertac.common.BalancingTransaction addBalancingTransaction​(org.powertac.common.Broker broker, double imbalance, double charge)
      Adds a balancing transaction to represent the cost of imbalance
      org.powertac.common.CapacityTransaction addCapacityTransaction​(org.powertac.common.Broker broker, int peakTimeslot, double threshold, double kWh, double fee)
      Adds a capacity transaction to represent charges for contribution to a demand peak.
      org.powertac.common.DistributionTransaction addDistributionTransaction​(org.powertac.common.Broker broker, int nSmall, int nLarge, double transport, double distroCharge)
      Adds a distribution transaction to represent charges for customer connections and energy transport.
      org.powertac.common.MarketTransaction addMarketTransaction​(org.powertac.common.Broker broker, org.powertac.common.Timeslot timeslot, double price, double mWh)
      Adds a market transaction that includes both a cash component and a product commitment for a specific timeslot.
      org.powertac.common.TariffTransaction addRegulationTransaction​(org.powertac.common.Tariff tariff, org.powertac.common.CustomerInfo customer, int customerCount, double kWh, double charge)
      Adds a tariff transaction representing a curtailment or balancing action to the current-hour transaction list.
      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)
      Adds a tariff transaction to the current-hour transaction list.
      double getCurrentMarketPosition​(org.powertac.common.Broker broker)
      Returns the market position for the current timeslot for a given broker.
      double getCurrentNetLoad​(org.powertac.common.Broker broker)
      Returns the current net load represented by unprocessed TariffTransactions for a specific Broker.
      Map<org.powertac.common.Broker,​Map<org.powertac.common.TariffTransaction.Type,​Double>> getCurrentSupplyDemandByBroker()
      Returns a mapping of brokers to total supply and demand among subscribed customers.
      List<org.powertac.common.TariffTransaction> getPendingTariffTransactions()
      Returns the list of pending tariff transactions for the current timeslot.
      void postBalancingControl​(org.powertac.common.msg.BalancingControlEvent bce)
      Updates a broker's cash position resulting from the Balancing Market payment for Demand Response exercise.
    • Method Detail

      • addMarketTransaction

        org.powertac.common.MarketTransaction addMarketTransaction​(org.powertac.common.Broker broker,
                                                                   org.powertac.common.Timeslot timeslot,
                                                                   double price,
                                                                   double mWh)
        Adds a market transaction that includes both a cash component and a product commitment for a specific timeslot.
      • addTariffTransaction

        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)
        Adds a tariff transaction to the current-hour transaction list.
      • addRegulationTransaction

        org.powertac.common.TariffTransaction addRegulationTransaction​(org.powertac.common.Tariff tariff,
                                                                       org.powertac.common.CustomerInfo customer,
                                                                       int customerCount,
                                                                       double kWh,
                                                                       double charge)
        Adds a tariff transaction representing a curtailment or balancing action to the current-hour transaction list.
      • addDistributionTransaction

        org.powertac.common.DistributionTransaction addDistributionTransaction​(org.powertac.common.Broker broker,
                                                                               int nSmall,
                                                                               int nLarge,
                                                                               double transport,
                                                                               double distroCharge)
        Adds a distribution transaction to represent charges for customer connections and energy transport.
      • addCapacityTransaction

        org.powertac.common.CapacityTransaction addCapacityTransaction​(org.powertac.common.Broker broker,
                                                                       int peakTimeslot,
                                                                       double threshold,
                                                                       double kWh,
                                                                       double fee)
        Adds a capacity transaction to represent charges for contribution to a demand peak. One is generated for each peak event.
        Parameters:
        broker -
        peakTimeslot - when the peak occurred
        threshold - assessment threshold
        kWh - total net demand among broker's customers during timeslot
        fee - assessed capacity fee for this peak event
      • addBalancingTransaction

        org.powertac.common.BalancingTransaction addBalancingTransaction​(org.powertac.common.Broker broker,
                                                                         double imbalance,
                                                                         double charge)
        Adds a balancing transaction to represent the cost of imbalance
      • postBalancingControl

        void postBalancingControl​(org.powertac.common.msg.BalancingControlEvent bce)
        Updates a broker's cash position resulting from the Balancing Market payment for Demand Response exercise.
      • getCurrentNetLoad

        double getCurrentNetLoad​(org.powertac.common.Broker broker)
        Returns the current net load represented by unprocessed TariffTransactions for a specific Broker. This is needed to run the balancing process.
      • getCurrentSupplyDemandByBroker

        Map<org.powertac.common.Broker,​Map<org.powertac.common.TariffTransaction.Type,​Double>> getCurrentSupplyDemandByBroker()
        Returns a mapping of brokers to total supply and demand among subscribed customers.
      • getCurrentMarketPosition

        double getCurrentMarketPosition​(org.powertac.common.Broker broker)
        Returns the market position for the current timeslot for a given broker. Needed to run the balancing process.
      • getPendingTariffTransactions

        List<org.powertac.common.TariffTransaction> getPendingTariffTransactions()
        Returns the list of pending tariff transactions for the current timeslot. List will be non-empty only after the customer models have begun reporting tariff transactions, and before the accounting service has run.
      • activate

        void activate​(org.joda.time.Instant time,
                      int phase)
        Runs the accounting process. This needs to be here to support some tests