public void doActivities (int day, int hour) { //TODO - keep track of plugged-in state and capacity of charger TimeslotData timeslotData = todayMap[hour]; double intendedDistance = timeslotData.getIntendedDistance(); double neededCapacity = getNeededCapacity(intendedDistance); if (intendedDistance < distanceEpsilon) { return; } if (neededCapacity > currentCapacity) { log.warn("Customer {} out of juice!", getName()); return; } try { double before = currentCapacity; discharge(neededCapacity); log.info("{} {} at {}, {} kms {} kWh from {} to {}", name, timeslotData.getActivity().get().getName(), dtf.print(service.getTimeService().getCurrentDateTime()), intendedDistance, neededCapacity, before, currentCapacity); driving = true; } catch (ChargeException ce) { log.error(ce); } }