@Test public void testDoActivities () { mockSeed.setIntSeed(new int[]{0, 0}); initialize("male"); evCustomer.makeDayPlanning(0, 1); assertEquals(50, evCustomer.getCurrentCapacity(), 1E-06); evCustomer.doActivities(0, 5); assertFalse(evCustomer.isDriving()); evCustomer.doActivities(0, 6); assertTrue(evCustomer.isDriving()); assertEquals(45.0, evCustomer.getCurrentCapacity(), 1E-06); }
public void doActivities (int day, int hour) { 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); } }
EvCustomer { public void doActivities (int day, int hour) { 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); } } }
EvCustomer { public void doActivities (int day, int hour) { 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); } } EvCustomer(String name); }
EvCustomer { public void doActivities (int day, int hour) { 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); } } EvCustomer(String name); String getName(); long getId(); CustomerInfo initialize(SocialGroup socialGroup,
                                  String gender,
                                  Map<Integer, Activity> activities,
                                  List<GroupActivity> groupActivities,
                                  CarType car,
                                  EvSocialClass esc,
                                  CustomerServiceAccessor service,
                                  Config config); void evaluateTariffs(List<Tariff> tariffs); void step(Timeslot timeslot); void doActivities(int day, int hour); double getDominantLoad(); double[] getLoads(int day, int hour); double getCurrentCapacity(); @StateChange void setCurrentCapacity(double currentCapacity); void discharge(double kwh); void charge(double kwh); double getNeededCapacity(double distance); double getDischargingCapacity(); }
EvCustomer { public void doActivities (int day, int hour) { 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); } } EvCustomer(String name); String getName(); long getId(); CustomerInfo initialize(SocialGroup socialGroup,
                                  String gender,
                                  Map<Integer, Activity> activities,
                                  List<GroupActivity> groupActivities,
                                  CarType car,
                                  EvSocialClass esc,
                                  CustomerServiceAccessor service,
                                  Config config); void evaluateTariffs(List<Tariff> tariffs); void step(Timeslot timeslot); void doActivities(int day, int hour); double getDominantLoad(); double[] getLoads(int day, int hour); double getCurrentCapacity(); @StateChange void setCurrentCapacity(double currentCapacity); void discharge(double kwh); void charge(double kwh); double getNeededCapacity(double distance); double getDischargingCapacity();  }