private void createInitialTimeslots (Instant base, int initialSlots, int openSlots) { log.info("createInitialTimeslots(" + base + ", " + initialSlots + ", " + openSlots + "), at " + timeService.getCurrentTime()); //long timeslotMillis = competition.getTimeslotDuration(); // set timeslot index according to bootstrap mode //for (int i = 0; i < initialSlots - 1; i++) { // timeslotRepo.makeTimeslot(base); //} //for (int i = initialSlots - 1; i < (initialSlots + openSlots - 1); i++) { // timeslotRepo.makeTimeslot(base.plus(i * timeslotMillis)); //} }
private synchronized List<Tariff> getPendingRevokes () { Instant now = timeService.getCurrentTime(); if (now.isAfter(lastRevokeProcess)) { lastRevokeProcess = now; List<Tariff> result = new ArrayList<>(pendingRevokedTariffs); pendingRevokedTariffs.clear(); return result; } return null; // only get non-null result once/timeslot }
private long computeNextTickTime () { long current = new Date().getTime(); // not a valid test in sim mode... if (current < start) { // first tick is special //System.out.println("first tick at " + start + "; current is " + current); return start; } else { // second and subsequent ticks long simTime = timeService.getCurrentTime().getMillis(); long nextSimTime = simTime + modulo; long nextTick = start + (nextSimTime - base) / rate; //System.out.println("next tick: current " + current + "; next tick at " + nextTick); return nextTick; } }
private TimeslotUpdate makeTimeslotUpdate () { List<Timeslot> enabled = timeslotRepo.enabledTimeslots(); TimeslotUpdate msg = new TimeslotUpdate(timeService.getCurrentTime(), enabled.get(0).getSerialNumber(), enabled.get(enabled.size() - 1).getSerialNumber()); return msg; }
/** * Returns the number of individual customers who may withdraw from this * subscription without penalty. Should return the total customer count * for a non-expiring tariff. */ public int getExpiredCustomerCount () { int cc = 0; Instant now = getTimeService().getCurrentTime(); for (ExpirationRecord exp : expirations) { if (exp.getHorizon() <= now.getMillis()) { cc += exp.getCount(); } } return cc; }
log.info("sim start at " + timeService.getCurrentTime()); timeService.init(timeService.getCurrentTime());
/** * Called once/timeslot, simply calls updateModel() and generateOrders() on * each of the gencos. */ @Override public void activate(Instant now, int phase) { log.info("Activate"); List<Timeslot> openSlots = timeslotRepo.enabledTimeslots(); Instant when = timeService.getCurrentTime(); for (Genco genco : gencos) { genco.updateModel(when); genco.generateOrders(when, openSlots); } if (null != cpGenco) { cpGenco.generateOrders(when, openSlots); } if (null != misoBuyer) { misoBuyer.generateOrders(when, openSlots); } }
if (!running) return; Instant time = timeService.getCurrentTime(); log.info("step at " + time.toString());
@Override public void activate (Instant time, int phase) { log.info("Activate"); processPendingVrus(); long msec = timeService.getCurrentTime().getMillis(); if (!subsequentPublication || (msec / TimeService.HOUR) % publicationInterval == publicationOffset) { // time to publish or never published revokeTariffsForDisabledBrokers(); updateRevokedTariffs(); publishTariffs(); //removeRevokedTariffs(); processPendingSubscriptions(); subsequentPublication = true; } }
Instant start = getTimeService().getCurrentTime(); if (expirations.size() > 0 && expirations.get(expirations.size() - 1).getHorizon() == start.getMillis() + minDuration) {
if (totalMWh > 0.0) { ClearedTrade trade = new ClearedTrade(timeslot, totalMWh, clearingPrice, timeService.getCurrentTime()); log.info(trade.toString()); brokerProxyService.broadcastMessage(trade);
/** * Handles changes in tariff expiration date. */ public void handleMessage (TariffExpire update) { ValidationResult result = validateUpdate(update); if (result.tariff == null) send(result.message); else { Instant newExp = update.getNewExpiration(); if (newExp != null && newExp.isBefore(timeService.getCurrentTime())) { // new expiration date in the past log.warn("attempt to set expiration for tariff " + result.tariff.getId() + " in the past:" + newExp.toString()); send(new TariffStatus(update.getBroker(), update.getTariffId(), update.getId(), TariffStatus.Status.invalidUpdate) .withMessage("attempt to set expiration in the past")); } else { // update expiration date result.tariff.setExpiration(newExp); log.info("Tariff " + update.getTariffId() + "now expires at " + new DateTime(result.tariff.getExpiration(), DateTimeZone.UTC).toString()); success(update); } } }
service.getTimeService().getCurrentTime().plus(TimeService.HOUR); return new org.powertac.common.CapacityProfile(result, start);
Timeslot current = findCurrentTimeslot(); if (current == null) { log.error("current timeslot is null at " + timeService.getCurrentTime()); return -1;
createInitialTimeslots(timeService.getCurrentTime(), competition.getDeactivateTimeslotsAhead(), competition.getTimeslotsOpen());