-
Notifications
You must be signed in to change notification settings - Fork 36
Time management
The CompetitionController sets up the TimeService to keep simulation time by setting four parameters:
-
base
is the start of the simulated time period represented within the simulation. -
start
is the wall-clock time at which the simulation starts. -
rate
is the ratio of time progress inside the simulation to progress outside. So if rate=600, then time passes 600 times faster in the simulation than in the real world. This rate compresses an hour into 6 seconds. -
modulo
is the smallest increment of time represented in the simulation environment. Typically this is the length of a timeslot.
The current simulation time is computed as simTime = (base + (currentTime - start) * rate)
truncated to the last time when simTime % modulo = 0
.
Other entities can retrieve the current time, or can post actions to be executed at a later time. Several convenience constants are also provided, such as HOUR, DAY, and WEEK. Simulation time is derived from system time by a simple formula, so the parameters can be communicated to brokers, who may then keep their own time. This will keep server and brokers synchronized within milliseconds as long as all platforms are running ntp.
Time is represented as milliseconds since epoch in the UTC timezone, as in Unix/Linux. For convenience in representation, we use the joda.org time library. The basic type used to represent absolute time is org.joda.time.Instant. To see some examples of time representation, see org.powertac.common.TimeServiceSchedTest, under test/integration in the powertac-common repo.
The timeline is represented by timeslots of an equal duration
Please explain the difference between an enabled and a disabled timeslot.
###Publishing tariff offers Brokers can send tariffs to the server until 24 hours prior to the possible start date of the tariff.
###Sending tariffList to Customers Published tariffs are stored by the accounting service. Each day at a specified time t (0:00) the accounting service sends a tariffList to the customers. The tariffList comprises all tariffs that will be available for the day starting at t+1d.
###Customer subscription and negotiation After receiving the tariffList customers can subscribe or negotiate a particular tariff available in the tariffList within the following 24hours. The subscription duration has to be one day or a multiple of a day. Intraday tariffs are therefore currently not possible.
###Publishing contracts If a customer decides to subscribe a particular tariff the respective broker is informed with the beginning of the contract. (24 hours after the submission deadline for the tariff.)