Package org.powertac.customer
Class AbstractCustomer
- java.lang.Object
- 
- org.powertac.customer.AbstractCustomer
 
- 
 public abstract class AbstractCustomer extends Object Abstract customer implementation- Author:
- Antonios Chrysopoulos
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected List<CustomerInfo>allCustomerInfosprotected HashMap<PowerType,List<CustomerInfo>>customerInfosprotected static org.apache.logging.log4j.Loggerlogprotected Stringnameprotected RandomSeedrs1Random Number Generatorprotected CustomerServiceAccessorservice
 - 
Constructor SummaryConstructors Constructor Description AbstractCustomer()Default constructor, requires explicit setting of nameAbstractCustomer(String name)Abstract Customer constructor with explicit name.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddCustomerInfo(CustomerInfo info)Adds an additional CustomerInfo to the listvoidchangeSubscription(Tariff tariff, Tariff newTariff, CustomerInfo customer)In this overloaded implementation of the changing subscription function, Here we just put the tariff we want to change and the whole population is moved to another random tariff.TariffEvaluatorcreateTariffEvaluator(CustomerModelAccessor cma)Creates a TariffEvaluator, populated with a pre-configured TariffEvaluationHelper.abstract voidevaluateTariffs(List<Tariff> tariffs)Called to evaluate tariffs.List<TariffSubscription>getCurrentSubscriptions()Returns the current tariff subscriptions for the first CustomerInfo.List<TariffSubscription>getCurrentSubscriptions(PowerType type)Returns the current tariff subscriptions for the first CustomerInfo with the given PowerType.longgetCustId()CustomerInfogetCustomerInfo(PowerType pt)Returns the first CustomerInfo associated with this instance and PowerType.List<CustomerInfo>getCustomerInfoList(PowerType pt)Returns the list of CustomerInfos associated with this instance and PowerType.List<CustomerInfo>getCustomerInfos()Returns the list of CustomerInfo records associated with this customer model.longgetId()Synonym for getCustId()StringgetName()Returns the name of this modelintgetPopulation(CustomerInfo customer)voidinitialize()Initializes the instance.protected org.joda.time.InstantlastSunday()protected org.joda.time.InstantnextStartOfDay()voidsaveBootstrapState()Saves model data to the bootstrap record.voidsetName(String name)Sets the name for this modelvoidsetServiceAccessor(CustomerServiceAccessor csa)Provides a reference to the service accessor, through which we can get at sim servicesvoidsetTariffMarket(TariffMarket service)protected org.joda.time.InstantstartOfDay()abstract voidstep()Called to run the model forward one step.StringtoString()
 
- 
- 
- 
Field Detail- 
logprotected static org.apache.logging.log4j.Logger log 
 - 
nameprotected String name 
 - 
customerInfosprotected HashMap<PowerType,List<CustomerInfo>> customerInfos 
 - 
allCustomerInfosprotected List<CustomerInfo> allCustomerInfos 
 - 
serviceprotected CustomerServiceAccessor service 
 - 
rs1protected RandomSeed rs1 Random Number Generator
 
- 
 - 
Constructor Detail- 
AbstractCustomerpublic AbstractCustomer() Default constructor, requires explicit setting of name
 - 
AbstractCustomerpublic AbstractCustomer(String name) Abstract Customer constructor with explicit name.
 
- 
 - 
Method Detail- 
setServiceAccessorpublic void setServiceAccessor(CustomerServiceAccessor csa) Provides a reference to the service accessor, through which we can get at sim services
 - 
initializepublic void initialize() Initializes the instance. Called after configuration, and after a call to setServices(). TODO -- do we really want this here?
 - 
saveBootstrapStatepublic void saveBootstrapState() Saves model data to the bootstrap record. Default implementation does nothing; models may override if they aggregate objects that must save state.
 - 
addCustomerInfopublic void addCustomerInfo(CustomerInfo info) Adds an additional CustomerInfo to the list
 - 
getCustomerInfopublic CustomerInfo getCustomerInfo(PowerType pt) Returns the first CustomerInfo associated with this instance and PowerType. It is up to individual models to fill out the fields.
 - 
getCustomerInfoListpublic List<CustomerInfo> getCustomerInfoList(PowerType pt) Returns the list of CustomerInfos associated with this instance and PowerType.
 - 
getCustomerInfospublic List<CustomerInfo> getCustomerInfos() Returns the list of CustomerInfo records associated with this customer model.
 - 
getCurrentSubscriptionspublic List<TariffSubscription> getCurrentSubscriptions() Returns the current tariff subscriptions for the first CustomerInfo. Useful for customer models with a single CustomerInfo.
 - 
getCurrentSubscriptionspublic List<TariffSubscription> getCurrentSubscriptions(PowerType type) Returns the current tariff subscriptions for the first CustomerInfo with the given PowerType. Useful for customer models with a single CustomerInfo per PowerType.
 - 
getPopulationpublic int getPopulation(CustomerInfo customer) 
 - 
getCustIdpublic long getCustId() 
 - 
getIdpublic long getId() Synonym for getCustId()
 - 
setNamepublic void setName(String name) Sets the name for this model
 - 
getNamepublic String getName() Returns the name of this model
 - 
steppublic abstract void step() Called to run the model forward one step.
 - 
createTariffEvaluatorpublic TariffEvaluator createTariffEvaluator(CustomerModelAccessor cma) Creates a TariffEvaluator, populated with a pre-configured TariffEvaluationHelper.
 - 
evaluateTariffspublic abstract void evaluateTariffs(List<Tariff> tariffs) Called to evaluate tariffs.
 - 
lastSundayprotected org.joda.time.Instant lastSunday() 
 - 
startOfDayprotected org.joda.time.Instant startOfDay() 
 - 
nextStartOfDayprotected org.joda.time.Instant nextStartOfDay() 
 - 
setTariffMarketpublic void setTariffMarket(TariffMarket service) 
 - 
changeSubscriptionpublic void changeSubscription(Tariff tariff, Tariff newTariff, CustomerInfo customer) In this overloaded implementation of the changing subscription function, Here we just put the tariff we want to change and the whole population is moved to another random tariff. NOTE: Used only for testing...- Parameters:
- tariff-
 
 
- 
 
-