StateLogFormat

From powerwiki
Revision as of 19:55, 9 January 2019 by Grampajohn (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The state log generated by the Power TAC simulation is in a simple flat format that's intended to record "significant" state changes while the simulator runs. It is not in XML or JSON format because it's not just objects that are logged, and because object references are all indirect; there is no nesting. Each record is a single line in a text file.

The format of each line is formatted as

 msec:class::id::method::arg::arg...

Fields are

msec
Milliseconds since process start. Note that this is not time in the simulation environment, but "wall clock" time in the real world. Entries in the trace log are also prefixed with the same msec field, which makes it easy to line up trace log entries with state log entries.
class
The fully-qualified name of the class of the object being logged.
id
The numeric ID of the object. A few logged types do not have ID values, in which case this field is null. The most common example is org.powertac.common.TimeService.
method
The name of the method that was called. For object creation events, this is new if the object was created directly in the simulation, or -rr if the object was received from some broker and created by the Java read-resolve process.
arg
Method, constructor, or read-resolve argument. In many cases this is the ID of some other object. Note that for read-resolve records, an object reference often precedes the object being referenced. For example, when a broker sends a new TariffSpecification, its Rate instances are sent first, and each Rate includes a reference (ID value) for the TariffSpecification. These individual objects are logged as they arrive.

The meaning and order of arguments are specific to the object and method. For new and other method calls, the order and meanings of the arguments comes from the signature of the constructor or method. For example, this entry

 87891:org.powertac.common.Order::7181::new::1890::384::-25.711287199520743::140.37846147503572

represents creation of a new Order instance inside the simulation server. The constructor is

 Order (Broker broker, int timeslot, double mWh, Double limitPrice)

Here we have a new Order, ID 7181, being created by broker ID 1890, offering to sell 25.7 MWh for at least $140.38. Who is broker 1890?

 6038:org.powertac.genco.CpGenco::1890::new::lmp::true::true

It's a CpGenco inside the simulation, which generates the supply curve in the wholesale market.

For read-resolve records, the arguments are documented in the @Domain annotation on the class. Here are the fields for the Rate class:

 @Domain (fields = {"tariffId", "weeklyBegin", "weeklyEnd", "dailyBegin", "dailyEnd",
                    "tierThreshold", "fixed", "minValue", "maxValue",
                    "noticeInterval", "expectedMean", "maxCurtailment"})

and here is an incoming Rate instance:

 88062:org.powertac.common.Rate::700796501::‑rr::700796500::-1::-1::-1::-1::0.0::true::0.014::0.0::0::0.0::0.0

Here are the read-resolve arguments for TariffSpecification:

 @Domain(fields = {"broker", "powerType", "minDuration",
                   "signupPayment", "earlyWithdrawPayment", "periodicPayment",
                   "supersedes"})

Here is the incoming TariffSpecification for the Rate we just saw:

 88062:org.powertac.common.TariffSpecification::700796500::‑rr::4793::WIND_PRODUCTION::432000000::0.0::-10.0::-6.0::null

We can see that the ID for this object is the same as the "tariffId" field in the Rate, and that the first argument is the broker ID. The minDuration is in msec -- if you convert to hours, it's 120 hours or 5 days. Which broker is this? It was created much earlier:

 49974:org.powertac.common.Broker::4793::new::AgentUDE