public CapacityTransaction makeCapacityTransaction (Broker broker, int peakTimeslot, double threshold, double kWh, double fee) { return new CapacityTransaction(broker, getTimeslotIndex(), peakTimeslot, threshold, kWh, fee); } }
@Override public synchronized BalancingTransaction addBalancingTransaction(Broker broker, double kWh, double charge) { BalancingTransaction btx = txFactory.makeBalancingTransaction(broker, kWh, charge); pendingTransactions.add(btx); return btx; }
@Override public synchronized CapacityTransaction addCapacityTransaction (Broker broker, int peakTimeslot, double threshold, double kWh, double fee) { CapacityTransaction ctx = txFactory.makeCapacityTransaction(broker, peakTimeslot, threshold, kWh, fee); pendingTransactions.add(ctx); return ctx; }
brokerMsg.get(broker).add(txFactory.makeBankTransaction(broker, interest)); broker.updateCash(interest); brokerMsg.get(broker).add(txFactory.makeCashPosition(broker, broker.getCashBalance())); log.info("Broker {} balance = {}", broker.getUsername(), broker.getCashBalance());
@Override public synchronized TariffTransaction addRegulationTransaction (Tariff tariff, CustomerInfo customer, int customerCount, double kWh, double charge) { TariffTransaction.Type txType = TariffTransaction.Type.CONSUME; if (kWh > 0.0) txType = TariffTransaction.Type.PRODUCE; TariffTransaction ttx = txFactory.makeTariffTransaction(tariff.getBroker(), txType, tariffRepo.findSpecificationById(tariff.getSpecId()), customer, customerCount, kWh, charge, true); if (null == ttx.getTariffSpec()) log.error("Null tariff spec in addTariffTx()"); pendingTransactions.add(ttx); return ttx; }
@Override public synchronized DistributionTransaction addDistributionTransaction (Broker broker, int nSmall, int nLarge, double transport, double distroCharge) { DistributionTransaction dtx = txFactory.makeDistributionTransaction(broker, nSmall, nLarge, transport, distroCharge); pendingTransactions.add(dtx); return dtx; }
@Override public synchronized MarketTransaction addMarketTransaction(Broker broker, Timeslot timeslot, double mWh, double price) { MarketTransaction mtx = txFactory.makeMarketTransaction(broker, timeslot, mWh, price); // post pending tx so it gets sent to broker pendingTransactions.add(mtx); updateBrokerMarketPosition(mtx); // defer posting to delivery timeslot ArrayList<MarketTransaction> theList = pendingMarketTransactions.get(timeslot); if (null == theList) { theList = new ArrayList<MarketTransaction>(); pendingMarketTransactions.put(timeslot, theList); } theList.add(mtx); return mtx; }
@Override public synchronized TariffTransaction addTariffTransaction(TariffTransaction.Type txType, Tariff tariff, CustomerInfo customer, int customerCount, double kWh, double charge) { TariffTransaction ttx = txFactory.makeTariffTransaction(tariff.getBroker(), txType, tariffRepo.findSpecificationById(tariff.getSpecId()), customer, customerCount, kWh, charge); if (null == ttx.getTariffSpec()) log.error("Null tariff spec in addTariffTx()"); pendingTransactions.add(ttx); return ttx; }
public DistributionTransaction makeDistributionTransaction (Broker broker, int nSmall, int nLarge, double transport, double distroCharge) { return new DistributionTransaction(broker, getTimeslotIndex(), nSmall, nLarge, transport, distroCharge); }
public MarketTransaction makeMarketTransaction (Broker broker, Timeslot timeslot, double mWh, double price) { return new MarketTransaction(broker, getTimeslotIndex(), timeslot, mWh, price); }
public CashPosition makeCashPosition (Broker broker, double balance) { return new CashPosition(broker, balance, getTimeslotIndex()); }
public BalancingTransaction makeBalancingTransaction (Broker broker, double kWh, double charge) { return new BalancingTransaction(broker, getTimeslotIndex(), kWh, charge); }
/** * Creates a tariff transaction that is not a regulation transaction. */ public TariffTransaction makeTariffTransaction(Broker broker, TariffTransaction.Type txType, TariffSpecification spec, CustomerInfo customer, int customerCount, double kWh, double charge) { return new TariffTransaction (broker, getTimeslotIndex(), txType, spec, customer, customerCount, kWh, charge, false); }
public BankTransaction makeBankTransaction (Broker broker, double amount) { return new BankTransaction(broker, amount, getTimeslotIndex()); }
/** * Creates a tariff transaction that could be a regulation transaction, * depending on the value of the isRegulation parameter. */ public TariffTransaction makeTariffTransaction(Broker broker, TariffTransaction.Type txType, TariffSpecification spec, CustomerInfo customer, int customerCount, double kWh, double charge, boolean isRegulation) { return new TariffTransaction (broker, getTimeslotIndex(), txType, spec, customer, customerCount, kWh, charge, isRegulation); }