@Service public class TariffMarketService extends TimeslotPhaseProcessor implements TariffMarket, InitializationService
| Constructor and Description |
|---|
TariffMarketService()
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
activate(org.joda.time.Instant time,
int phase)
This method gets called once during each timeslot.
|
List<Tariff> |
getActiveTariffList(PowerType type)
Returns the list of currently active tariffs for the given PowerType.
|
Tariff |
getDefaultTariff(PowerType type)
Returns the default tariff
|
double |
getMaxPublicationFee() |
double |
getMaxRevocationFee() |
double |
getMinPublicationFee() |
double |
getMinRevocationFee() |
Double |
getPublicationFee() |
int |
getPublicationInterval() |
int |
getPublicationOffset() |
Double |
getRevocationFee() |
void |
handleMessage(BalancingOrder msg)
Processes an incoming BalancingOrder by storing it in the tariffRepo
|
void |
handleMessage(EconomicControlEvent msg)
Processes an incoming ControlEvent from a broker
|
void |
handleMessage(TariffExpire update)
Handles changes in tariff expiration date.
|
void |
handleMessage(TariffRevoke update)
Handles tariff revocation.
|
void |
handleMessage(TariffSpecification spec)
Processes a newly-published tariff.
|
void |
handleMessage(VariableRateUpdate update)
Applies a new HourlyCharge to an existing Tariff with a variable Rate.
|
String |
initialize(Competition competition,
List<String> completedInits)
Reads configuration parameters, registers for timeslot phase activation.
|
void |
processRevokedTariffs()
Runs through the list of pending tariff revocations, marking the tariffs
and their subscriptions.
|
void |
registerNewTariffListener(NewTariffListener listener)
Registers a listener for publication of new Tariffs.
|
boolean |
setDefaultTariff(TariffSpecification newSpec)
Convenience method to set the default tariff at the beginning of the game.
|
void |
setPublicationInterval(int interval) |
void |
setPublicationOffset(int offset) |
void |
subscribeToTariff(Tariff tariff,
CustomerInfo customer,
int customerCount)
If customerCount is positive, subscribes a block of Customers
from a single Customer model to the specified Tariff, as long
as the Tariff is not expired or revoked.
|
init, setTimeslotPhasepublic String initialize(Competition competition, List<String> completedInits)
initialize in interface InitializationServicepublic double getMinPublicationFee()
public double getMaxPublicationFee()
public Double getPublicationFee()
public double getMinRevocationFee()
public double getMaxRevocationFee()
public Double getRevocationFee()
public int getPublicationInterval()
@ConfigurableValue(valueType="Integer", description="Number of timeslots between tariff publication events. Must be at most 24.") public void setPublicationInterval(int interval)
public int getPublicationOffset()
@ConfigurableValue(valueType="Integer", description="Number of timeslots from the first timeslot to delay the first publication event. It does not work well to make this zero, because brokers do not have an opportunity to post tariffs in timeslot 0.") public void setPublicationOffset(int offset)
public void handleMessage(TariffSpecification spec)
public void handleMessage(TariffExpire update)
public void handleMessage(TariffRevoke update)
public void handleMessage(VariableRateUpdate update)
public void handleMessage(EconomicControlEvent msg)
public void handleMessage(BalancingOrder msg)
public void processRevokedTariffs()
processRevokedTariffs in interface TariffMarketpublic void registerNewTariffListener(NewTariffListener listener)
TariffMarketregisterNewTariffListener in interface TariffMarketpublic void activate(org.joda.time.Instant time,
int phase)
TimeslotPhaseProcessoractivate in class TimeslotPhaseProcessorpublic List<Tariff> getActiveTariffList(PowerType type)
TariffMarketgetActiveTariffList in interface TariffMarketpublic Tariff getDefaultTariff(PowerType type)
getDefaultTariff in interface TariffMarketpublic boolean setDefaultTariff(TariffSpecification newSpec)
TariffMarketsetDefaultTariff in interface TariffMarketpublic void subscribeToTariff(Tariff tariff, CustomerInfo customer, int customerCount)
Note that you cannot unsubscribe directly from a Tariff -- you have to do that from the TariffSubscription that represents the Tariff you want to unsubscribe from.
subscribeToTariff in interface TariffMarketCopyright © 2017 Power TAC. All rights reserved.