Last updated on 16th July 2024
The model schema is used to describe the model's data output. Before reading output from a model, it's often helpful to read the Avro model schema first to know which tables and fields to expect.
The schema object will contain a list of fields containing data about the model in its current state. Some of these fields are fields which you can use to input data into the model, some are used only to output data from the model, and some can be used to input and export data.
More information on the general schema format can be found on the Avro website. https://avro.apache.org/docs/1.8.1/spec.html
Every field record may contain descriptor fields that are used to pass extra information about the fields.
This will be present for all primitive and enum fields, as well as arrays. This tells you the name of the dataset this field will be exported to (in the case of Parquet, the name of the parquet file).
This will be present for all primitive and enum fields. This tells you the name this field will be given in the dataset after export.
The user might specify a display name for this output field. This is a user-friendly name that might contain spaces or special characters so cannot be used as the field name.
Input and output fields are given a display group so they can be sorted or grouped. A lower display group should appear higher on the list of inputs.
The kind of a field is the annotation specified for the field in the model.
All top-level fields in the Simulation object will have a kind, but if some of these fields are records, the fields they contain might not have a kind. We will discuss later what sort of object might contain fields without a kind and how to read them.
This may be used where kind → Variable. It shows that the field can be given set a starting value before setup.
This might be used for a field with type record or array. The subtype lets you know what type of object this field will be, and the fields it will contain.
Possible subtypes and the fields these objects will contain
SDLongAccumulator / SDDoubleAccumulator → Accumulators are used to report data. Accumulators will always have two fields:
AgentStatistics → Agent statistics are used to report data about specific fields inside agents. Agent statistics will contain an array of fields, with each of these fields being objects with their own fields as follows:
All of these fields will be of type 'double'.
SDAgent → This will be of type array and will contain a list of records, one for each agent in the system. Each record in this array will contain a field of name _id
with the unique id of this agent and might contain some fields with kinds, used to report data about specific agents.
SDLink -> This will be of type array and will contain a list of records, one for each link in the system. Each record in this array will contain two fields
SDAgentSystem → This may contain;
Agents
of type record and subtype SDAgentList
. Every sub record in this record will be of type SDAgent
.Links
of type record and subtype SDLinkList
. Every sub record in this record will be of type SDLink
.