DataTable

A DataTable holds plain rows of data — imported records or decision variables that the optimiser writes to. It is the only table type that supports decision variables and ComboField.

class DataTable(id)[source]

Bases: Table

Data Tables are used wherever plain data is required, including all input tables. Notably, optimiser decision variables can only appear in Data Tables, as these cells contain plain data that the optimiser writes.

In addition to holding data fields, Data Tables often include calculated fields, which can capture a significant portion of the model’s logic. For instance, in the ElectraNet 18-month planner, the Work_Orders table handles most of the model’s logic.

add_data_field(id, data_type, tracking_group=None)[source]

Adds a DataField to the table.

Parameters:
  • id (str) – The id of the data field.

  • data_type (BaseDataType) – The data type of the field.

  • tracking_group (str | None) – Group identifier for change tracking.

Returns:

The created DataField object.

Return type:

DataField

add_combo_field(id, formula, calculate_in_optimiser)[source]

Adds a ComboField to the table.

Parameters:
  • id (str) – The id of the calculated field.

  • formula (Operand | float | int | bool | str) – The formula used to calculate the field.

  • calculate_in_optimiser (bool) – Specifies whether the formula is evaluated during optimisation.

Returns:

The created ComboField object.

Return type:

ComboField