Package org.powertac.customer
Class AbstractCustomer
- java.lang.Object
-
- org.powertac.customer.AbstractCustomer
-
- Direct Known Subclasses:
EvSocialClass
public abstract class AbstractCustomer extends Object
Abstract customer implementation- Author:
- Antonios Chrysopoulos
-
-
Field Summary
Fields Modifier and Type Field Description protected List<CustomerInfo>
allCustomerInfos
protected HashMap<PowerType,List<CustomerInfo>>
customerInfos
protected static org.apache.logging.log4j.Logger
log
protected String
name
protected RandomSeed
rs1
Random Number Generatorprotected CustomerServiceAccessor
service
-
Constructor Summary
Constructors Constructor Description AbstractCustomer()
Default constructor, requires explicit setting of nameAbstractCustomer(String name)
Abstract Customer constructor with explicit name.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addCustomerInfo(CustomerInfo info)
Adds an additional CustomerInfo to the listvoid
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.TariffEvaluator
createTariffEvaluator(CustomerModelAccessor cma)
Creates a TariffEvaluator, populated with a pre-configured TariffEvaluationHelper.abstract void
evaluateTariffs(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.long
getCustId()
CustomerInfo
getCustomerInfo(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.long
getId()
Synonym for getCustId()String
getName()
Returns the name of this modelint
getPopulation(CustomerInfo customer)
void
initialize()
Initializes the instance.protected org.joda.time.Instant
lastSunday()
protected org.joda.time.Instant
nextStartOfDay()
void
saveBootstrapState()
Saves model data to the bootstrap record.void
setName(String name)
Sets the name for this modelvoid
setServiceAccessor(CustomerServiceAccessor csa)
Provides a reference to the service accessor, through which we can get at sim servicesvoid
setTariffMarket(TariffMarket service)
protected org.joda.time.Instant
startOfDay()
abstract void
step()
Called to run the model forward one step.String
toString()
-
-
-
Field Detail
-
log
protected static org.apache.logging.log4j.Logger log
-
name
protected String name
-
customerInfos
protected HashMap<PowerType,List<CustomerInfo>> customerInfos
-
allCustomerInfos
protected List<CustomerInfo> allCustomerInfos
-
service
protected CustomerServiceAccessor service
-
rs1
protected RandomSeed rs1
Random Number Generator
-
-
Constructor Detail
-
AbstractCustomer
public AbstractCustomer()
Default constructor, requires explicit setting of name
-
AbstractCustomer
public AbstractCustomer(String name)
Abstract Customer constructor with explicit name.
-
-
Method Detail
-
setServiceAccessor
public void setServiceAccessor(CustomerServiceAccessor csa)
Provides a reference to the service accessor, through which we can get at sim services
-
initialize
public void initialize()
Initializes the instance. Called after configuration, and after a call to setServices(). TODO -- do we really want this here?
-
saveBootstrapState
public void saveBootstrapState()
Saves model data to the bootstrap record. Default implementation does nothing; models may override if they aggregate objects that must save state.
-
addCustomerInfo
public void addCustomerInfo(CustomerInfo info)
Adds an additional CustomerInfo to the list
-
getCustomerInfo
public 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.
-
getCustomerInfoList
public List<CustomerInfo> getCustomerInfoList(PowerType pt)
Returns the list of CustomerInfos associated with this instance and PowerType.
-
getCustomerInfos
public List<CustomerInfo> getCustomerInfos()
Returns the list of CustomerInfo records associated with this customer model.
-
getCurrentSubscriptions
public List<TariffSubscription> getCurrentSubscriptions()
Returns the current tariff subscriptions for the first CustomerInfo. Useful for customer models with a single CustomerInfo.
-
getCurrentSubscriptions
public 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.
-
getPopulation
public int getPopulation(CustomerInfo customer)
-
getCustId
public long getCustId()
-
getId
public long getId()
Synonym for getCustId()
-
setName
public void setName(String name)
Sets the name for this model
-
getName
public String getName()
Returns the name of this model
-
step
public abstract void step()
Called to run the model forward one step.
-
createTariffEvaluator
public TariffEvaluator createTariffEvaluator(CustomerModelAccessor cma)
Creates a TariffEvaluator, populated with a pre-configured TariffEvaluationHelper.
-
evaluateTariffs
public abstract void evaluateTariffs(List<Tariff> tariffs)
Called to evaluate tariffs.
-
lastSunday
protected org.joda.time.Instant lastSunday()
-
startOfDay
protected org.joda.time.Instant startOfDay()
-
nextStartOfDay
protected org.joda.time.Instant nextStartOfDay()
-
setTariffMarket
public void setTariffMarket(TariffMarket service)
-
changeSubscription
public 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
-
-
-