Tabnine Logo
MarketPosition.getOverallBalance
Code IndexAdd Tabnine to your IDE (free)

How to use
getOverallBalance
method
in
org.powertac.common.MarketPosition

Best Java code snippets using org.powertac.common.MarketPosition.getOverallBalance (Showing top 6 results out of 315)

origin: powertac/powertac-server

private double getRemaining (Broker broker,
               HashMap<Broker, Double> posns,
               int ts)
{
 Double result = posns.get(broker);
 if (null == result) {
  MarketPosition posn = broker.findMarketPositionByTimeslot(ts);
  // offset is zero for final ts
  int offset = ts - timeslotRepo.currentSerialNumber();
  double limit = mktPosnLimitFinal;
  if (enabledTimeslots.size() > 1) {
   limit -= (offset * (mktPosnLimitFinal - mktPosnLimitInitial)
        / (enabledTimeslots.size() - 1));
  }
  result = Math.max(0.0, limit - posn.getOverallBalance());
  posns.put(broker, result);
 }
 return result;
}
origin: powertac/powertac-server

/**
 * 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.
 */
@Override
public synchronized double getCurrentMarketPosition(Broker broker) 
{
 Timeslot current = timeslotRepo.currentTimeslot();
 log.debug("current timeslot: " + current.getSerialNumber());
 MarketPosition position =
   broker.findMarketPositionByTimeslot(current.getSerialNumber());
 if (position == null) {
  log.debug("null position for ts " + current.getSerialNumber());
  return 0.0;
 }
 log.info("market position for " + broker.getUsername()
      + ": " + position.getOverallBalance());
 return position.getOverallBalance();
}
origin: powertac/powertac-server

private void submitOrder (double neededKWh, Timeslot timeslot)
{
 double neededMWh = neededKWh / 1000.0;
 if (Math.abs(neededMWh) < competition.getMinimumOrderQuantity()) {
  // don't bother
  return;
 }
 Double limitPrice;
 MarketPosition posn = face.findMarketPositionByTimeslot(timeslot.getSerialNumber());
 if (posn != null)
  neededMWh -= posn.getOverallBalance();
 log.debug("needed mWh=" + neededMWh);
 if (Math.abs(neededMWh) < minMWh) {
  log.info("no power required in timeslot " + timeslot.getSerialNumber());
  return;
 }
 else {
  limitPrice = computeLimitPrice(timeslot, neededMWh);
 }
 log.info("new order for " + neededMWh + " at " + limitPrice +
      " in timeslot " + timeslot.getSerialNumber());
 Order result = new Order(face, timeslot.getSerialNumber(), neededMWh, limitPrice);
 lastOrder.put(timeslot, result);
 brokerProxyService.routeMessage(result);
}
origin: powertac/powertac-server

if (skip-- > 0 && (posn == null || posn.getOverallBalance() == 0.0))
 continue;
if (posn != null) {
 availableCapacity += posn.getOverallBalance();
origin: powertac/powertac-server

/**
 * Generates Orders in the market to sell remaining available capacity.
 */
public void generateOrders (Instant now, List<Timeslot> openSlots)
{
 log.info("Generate orders for " + getUsername());
 double[] tempCorrections =
   computeWeatherCorrections();
 int i = 0;
 for (Timeslot slot: openSlots) {
  int index = slot.getSerialNumber();
  MarketPosition posn =
   findMarketPositionByTimeslot(index);
  double start = 0.0;
  double demand = computeScaledValue(index, tempCorrections[i++]);
  if (posn != null) {
   // posn.overallBalance is negative if we have sold power in this slot
   start = posn.getOverallBalance();
  }
  double needed = demand - start;
  Order offer = new Order(this, index, needed, null);
  log.info(getUsername() + " orders " + needed +
        " ts " + index);
  brokerProxyService.routeMessage(offer);
 }
}
origin: powertac/powertac-server

if (posn != null) {
 start = -posn.getOverallBalance();
org.powertac.commonMarketPositiongetOverallBalance

Popular methods of MarketPosition

  • <init>
  • getId
  • updateBalance

Popular in Java

  • Creating JSON documents from java classes using gson
  • getApplicationContext (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • getSupportFragmentManager (FragmentActivity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now