Package org.powertac.customer
Class CustomerModelService
- java.lang.Object
-
- org.powertac.common.interfaces.TimeslotPhaseProcessor
-
- org.powertac.customer.CustomerModelService
-
- All Implemented Interfaces:
BootstrapState
,CustomerServiceAccessor
,InitializationService
,NewTariffListener
@Service public class CustomerModelService extends TimeslotPhaseProcessor implements InitializationService, BootstrapState, NewTariffListener, CustomerServiceAccessor
Manages a set of customer models. Each must be configurable as ConfigurableInstances. Each gets supplied a set of service interfaces. In each timeslot, each model has its step() method called. When tariffs are published, each has its evaluateTariffs() method called. At the end of a boot session, each has its bootstrap state saved to the boot record.- Author:
- John Collins
-
-
Constructor Summary
Constructors Constructor Description CustomerModelService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate(org.joda.time.Instant time, int phaseNumber)
This method gets called once during each timeslot.CustomerRepo
getCustomerRepo()
Returns a reference to a CustomerRepoRandomSeedRepo
getRandomSeedRepo()
Returns a reference to a RandomSeedRepoServerConfiguration
getServerConfiguration()
Returns a reference to a ServerConfiguration serviceTariffMarket
getTariffMarket()
Returns a reference to the TariffMarketTariffRepo
getTariffRepo()
Returns a reference to a TariffRepoTariffSubscriptionRepo
getTariffSubscriptionRepo()
Returns a reference to a TariffSubscriptionRepoTimeService
getTimeService()
Returns a reference to the TimeServiceTimeslotRepo
getTimeslotRepo()
Returns a reference to a TimeslotRepoWeatherReportRepo
getWeatherReportRepo()
Returns a reference to a WeatherReportRepoString
initialize(Competition competition, List<String> completedInits)
Initializes a plugin prior to the beginning of a game.void
publishNewTariffs(List<Tariff> tariffs)
Called periodically with a list of newly-published Tariffsvoid
saveBootstrapState()
Saves state at the conclusion of a bootstrap session as configuration items.-
Methods inherited from class org.powertac.common.interfaces.TimeslotPhaseProcessor
init, setTimeslotPhase
-
-
-
-
Method Detail
-
initialize
public String initialize(Competition competition, List<String> completedInits)
Description copied from interface:InitializationService
Initializes a plugin prior to the beginning of a game. The completedInits parameter is the list of plugin role names that have been successfully initialized. If sequence dependencies are satisfied (or if there are no sequence dependencies), then an implementation must complete its pre-game initialization process and return its role name. If sequence dependencies are not satisfied, then an implementation must return null. It will be called again after additional successful initializations have been completed. If initialization is not possible, then returning the string 'fail' will cause the server to log an error and shut down. This will be helpful just in case the implementation also logs a detailed error message.- Specified by:
initialize
in interfaceInitializationService
-
activate
public void activate(org.joda.time.Instant time, int phaseNumber)
Description copied from class:TimeslotPhaseProcessor
This method gets called once during each timeslot. To get called, the module must first call the register(phaseNumber) method on CompetitionControl. The call will give the current simulation time and phase number in the arguments.- Specified by:
activate
in classTimeslotPhaseProcessor
-
publishNewTariffs
public void publishNewTariffs(List<Tariff> tariffs)
Description copied from interface:NewTariffListener
Called periodically with a list of newly-published Tariffs- Specified by:
publishNewTariffs
in interfaceNewTariffListener
-
saveBootstrapState
public void saveBootstrapState()
Description copied from interface:BootstrapState
Saves state at the conclusion of a bootstrap session as configuration items. State can then be restored at the beginning of the sim session through the normal configuration process. The usual way to save state is to call ServerPropertiesService.saveBootstrapState(arg), where arg is either a single configurable object (configured with configureMe() or configureSingleton()), or a list of objects annotated withConfigurableInstance
.- Specified by:
saveBootstrapState
in interfaceBootstrapState
-
getCustomerRepo
public CustomerRepo getCustomerRepo()
Description copied from interface:CustomerServiceAccessor
Returns a reference to a CustomerRepo- Specified by:
getCustomerRepo
in interfaceCustomerServiceAccessor
-
getRandomSeedRepo
public RandomSeedRepo getRandomSeedRepo()
Description copied from interface:CustomerServiceAccessor
Returns a reference to a RandomSeedRepo- Specified by:
getRandomSeedRepo
in interfaceCustomerServiceAccessor
-
getTariffRepo
public TariffRepo getTariffRepo()
Description copied from interface:CustomerServiceAccessor
Returns a reference to a TariffRepo- Specified by:
getTariffRepo
in interfaceCustomerServiceAccessor
-
getTariffSubscriptionRepo
public TariffSubscriptionRepo getTariffSubscriptionRepo()
Description copied from interface:CustomerServiceAccessor
Returns a reference to a TariffSubscriptionRepo- Specified by:
getTariffSubscriptionRepo
in interfaceCustomerServiceAccessor
-
getTimeslotRepo
public TimeslotRepo getTimeslotRepo()
Description copied from interface:CustomerServiceAccessor
Returns a reference to a TimeslotRepo- Specified by:
getTimeslotRepo
in interfaceCustomerServiceAccessor
-
getTimeService
public TimeService getTimeService()
Description copied from interface:CustomerServiceAccessor
Returns a reference to the TimeService- Specified by:
getTimeService
in interfaceCustomerServiceAccessor
-
getWeatherReportRepo
public WeatherReportRepo getWeatherReportRepo()
Description copied from interface:CustomerServiceAccessor
Returns a reference to a WeatherReportRepo- Specified by:
getWeatherReportRepo
in interfaceCustomerServiceAccessor
-
getServerConfiguration
public ServerConfiguration getServerConfiguration()
Description copied from interface:CustomerServiceAccessor
Returns a reference to a ServerConfiguration service- Specified by:
getServerConfiguration
in interfaceCustomerServiceAccessor
-
getTariffMarket
public TariffMarket getTariffMarket()
Description copied from interface:CustomerServiceAccessor
Returns a reference to the TariffMarket- Specified by:
getTariffMarket
in interfaceCustomerServiceAccessor
-
-