Class AccountingService

    • Constructor Detail

      • AccountingService

        public AccountingService()
    • Method Detail

      • initialize

        public String initialize​(Competition competition,
                                 List<String> completedInits)
        Description copied from interface: InitializationService
        Initializes a plugin prior to the beginning of a game. The completedInits parameter is the list of plugin role names that have been successfully initialized. If sequence dependencies are satisfied (or if there are no sequence dependencies), then an implementation must complete its pre-game initialization process and return its role name. If sequence dependencies are not satisfied, then an implementation must return null. It will be called again after additional successful initializations have been completed. If initialization is not possible, then returning the string 'fail' will cause the server to log an error and shut down. This will be helpful just in case the implementation also logs a detailed error message.
        Specified by:
        initialize in interface InitializationService
      • addMarketTransaction

        public MarketTransaction addMarketTransaction​(Broker broker,
                                                      Timeslot timeslot,
                                                      double mWh,
                                                      double price)
        Description copied from interface: Accounting
        Adds a market transaction that includes both a cash component and a product commitment for a specific timeslot.
        Specified by:
        addMarketTransaction in interface Accounting
      • addDistributionTransaction

        public DistributionTransaction addDistributionTransaction​(Broker broker,
                                                                  int nSmall,
                                                                  int nLarge,
                                                                  double transport,
                                                                  double distroCharge)
        Description copied from interface: Accounting
        Adds a distribution transaction to represent charges for customer connections and energy transport.
        Specified by:
        addDistributionTransaction in interface Accounting
      • addCapacityTransaction

        public CapacityTransaction addCapacityTransaction​(Broker broker,
                                                          int peakTimeslot,
                                                          double threshold,
                                                          double kWh,
                                                          double fee)
        Description copied from interface: Accounting
        Adds a capacity transaction to represent charges for contribution to a demand peak. One is generated for each peak event.
        Specified by:
        addCapacityTransaction in interface Accounting
        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
      • getCurrentNetLoad

        public double getCurrentNetLoad​(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 Accounting
      • getCurrentMarketPosition

        public double getCurrentMarketPosition​(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 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 Accounting
        Specified by:
        activate in class TimeslotPhaseProcessor
      • processTransaction

        public void processTransaction​(TariffTransaction tx,
                                       ArrayList<Object> messages)
        Processes a tariff transaction, updating the broker's cash position and the consumption, production data in the distribution report.
      • processTransaction

        public void processTransaction​(BalancingTransaction tx,
                                       ArrayList<Object> messages)
        Processes a balancing transaction by updating the broker's cash position.
      • processTransaction

        public void processTransaction​(DistributionTransaction tx,
                                       ArrayList<Object> messages)
        Processes a distribution transaction by updating the broker's cash position.
      • processTransaction

        public void processTransaction​(CapacityTransaction tx,
                                       ArrayList<Object> messages)
        Processes a capacity transaction by updating the broker's cash position.
      • processTransaction

        public void processTransaction​(MarketTransaction tx,
                                       ArrayList<Object> messages)
        Processes a market transaction by ensuring that the market position will be sent to the broker. Actual transaction posting is deferred to delivery time
      • handleMarketTransactionsForTimeslot

        public void handleMarketTransactionsForTimeslot​(Timeslot ts)
        Processes deferred market transactions for the current timeslot by updating the broker's cash position.
      • processTransaction

        public void processTransaction​(BankTransaction tx,
                                       ArrayList<Object> messages)
        Complains if a bank transaction is among the transactions to be handled. These should be generated locally and sent directly to brokers.
      • getPendingTariffTransactions

        public List<TariffTransaction> getPendingTariffTransactions()
        Returns the current list of pending tariff transactions. This will be non-empty only after the customer model has run and before accounting has run in the current timeslot.
        Specified by:
        getPendingTariffTransactions in interface Accounting
      • getMinInterest

        public double getMinInterest()
        Returns the low end of the bank interest range.
      • getMaxInterest

        public double getMaxInterest()
        Returns the high end of the bank interest range.
      • getBankInterest

        public Double getBankInterest()
        Returns the actual bank interest once configuration is complete.