|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.powertac.server.CompetitionControlService
@Service public class CompetitionControlService
This is the competition controller. It has three major roles in the server:
preGame() method must be called to
set up the environment and allow configuration of the next game, through
a web (or REST) interface.init() method must be
called. There are two versions of this method; the init()
version runs a "bootstrap" simulation that runs the customer models and
the wholesale market for a limited period of time to collect an initial
dataset from which brokers can bootstrap their internal models. During
a bootstrap simulation, external brokers cannot log in; only the default
broker is active. The init(filename) version loads bootstrap
data from the named file, validates it, and then opens up the
broker login process, most of which is delegated to the BrokerProxy.step() method is called every
timeslotLength seconds. This runs through
timeslotPhaseCount phases, calling the activate()
methods on registered components. Phases start at 1; by default there
are four phases.timeslotCount, the
simulation is ended.
| Constructor Summary | |
|---|---|
CompetitionControlService()
|
|
| Method Summary | |
|---|---|
void |
init()
Runs the initialization process, starts the simulation thread, waits for it to complete, then shuts down and prepares for the next simulation run. |
boolean |
isBootstrapMode()
True just in case the sim is running in bootstrap mode |
boolean |
loginBroker(String username)
Logs in a broker, just in case the broker is on the authorizedBrokerList. |
void |
pause()
Signals that the clock is paused due to server overrun. |
void |
preGame()
Pre-game server setup - creates the basic configuration elements to make them accessible to the web-based game-setup functions. |
boolean |
preGame(File bootFile)
Sets up the simulator, with config overrides provided in a file containing a sequence of PluginConfig instances. |
void |
receiveMessage(org.powertac.common.msg.BrokerAuthentication msg)
Authenticate Broker. |
void |
receiveMessage(Object msg)
|
void |
receiveMessage(org.powertac.common.msg.PauseRelease msg)
Releases a broker-initiated pause. |
void |
receiveMessage(org.powertac.common.msg.PauseRequest msg)
Allows a broker to request a pause. |
void |
registerTimeslotPhase(org.powertac.common.interfaces.TimeslotPhaseProcessor thing,
int phase)
Allows instances of TimeslotPhaseProcessor to register themselves to be activated during one of the processing phases in each timeslot. |
void |
resume(long newStart)
Signals that the clock is resumed. |
void |
runOnce()
Runs a simulation that is already set up. |
void |
runOnce(File datasetFile)
Loads a bootstrap dataset, starts a simulation |
void |
runOnce(Writer datasetWriter)
Runs a bootstrap sim, saves the bootstrap dataset in a file |
void |
setAlwaysAuthorizedBrokers(List<String> brokerList)
Sets the list of broker usernames that are always authorized, even in bootstrap mode. |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
|
void |
setAuthorizedBrokerList(ArrayList<String> brokerList)
Sets the list of brokers allowed and expected to log in before starting a simulation. |
void |
setBootstrapDiscardedTimeslots(int count)
Sets the number of timeslots to discard at the beginning of a bootstrap run. |
void |
setBootstrapTimeslotMillis(long length)
Allows Spring to set the boostrap timeslot length |
void |
stop()
Signals the simulation thread to stop after processing is completed in the current timeslot. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CompetitionControlService()
| Method Detail |
|---|
public void preGame()
preGame in interface org.powertac.common.interfaces.CompetitionControlpublic boolean preGame(File bootFile)
public void init()
public void setAlwaysAuthorizedBrokers(List<String> brokerList)
public void setAuthorizedBrokerList(ArrayList<String> brokerList)
setAuthorizedBrokerList in interface org.powertac.common.interfaces.CompetitionControlpublic void setBootstrapDiscardedTimeslots(int count)
public void runOnce()
runOnce in interface org.powertac.common.interfaces.CompetitionControlpublic void runOnce(File datasetFile)
public void runOnce(Writer datasetWriter)
public boolean loginBroker(String username)
loginBroker in interface org.powertac.common.interfaces.CompetitionControlpublic void stop()
public void registerTimeslotPhase(org.powertac.common.interfaces.TimeslotPhaseProcessor thing,
int phase)
registerTimeslotPhase in interface org.powertac.common.interfaces.CompetitionControlpublic boolean isBootstrapMode()
isBootstrapMode in interface org.powertac.common.interfaces.CompetitionControlpublic void pause()
public void resume(long newStart)
public void receiveMessage(org.powertac.common.msg.PauseRequest msg)
receiveMessage in interface org.powertac.common.interfaces.CompetitionControlpublic void receiveMessage(org.powertac.common.msg.PauseRelease msg)
receiveMessage in interface org.powertac.common.interfaces.CompetitionControlpublic void receiveMessage(org.powertac.common.msg.BrokerAuthentication msg)
public void setBootstrapTimeslotMillis(long length)
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic void receiveMessage(Object msg)
receiveMessage in interface org.powertac.common.interfaces.BrokerMessageListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||