Model Data
Output Data Load
Model outputs are stored in .arrow files. These files are non-human-readable, but are significantly faster to process compared to other formats like CSV or XLXS. To further process model results, they can be read-in by calling the DataFiles constructor
POMATWO.DataFiles — Type
DataFilesA container for loading and storing output data related to a model run. Each field corresponds to a specific dataset represented as a DataFrame. The constructor can be called by providing the directory that contains the results. The path to the specific results of each model run consists of the 'resultdir' and the 'scenarioname' (see section ModelRun).
Fields
params::Parameters: Configuration and model parameters loaded fromparams.jld2.CHARGE::DataFrame: Charging data for storage units.EXCHANGE::DataFrame: Cross-border or inter-zonal energy exchange data.FEEDIN::DataFrame: Feed-in data from renewable or other sources.GEN::DataFrame: Power generation data.REDISP::DataFrame: Redispatch actions and adjustments.PRS::DataFrame: Price or reserve-related data.LINEFLOW::DataFrame: AC line power flow data.DCLINEFLOW::DataFrame: DC line power flow data.NETINPUT::DataFrame: Net input to zones or nodes.NTC::DataFrame: Net Transfer Capacities between zones.STO_LVL::DataFrame: Storage level data.STO_LVL_REDISP::DataFrame: Redispatch-related storage level changes.ZonalMarketBalance::DataFrame: Market balance data aggregated per zone.NodalMarketBalance::DataFrame: Market balance data at the nodal level.NodalMarketRedispBalance::DataFrame: Redispatch-adjusted nodal market balance.
Constructor
DataFiles(dir::String)Example
results_path = joinpath("results", scen_name)
### reading in the result files
results = DataFiles(results_path)sourceThe following functions can be used to create some useful tables automatically.
POMATWO.transform_results_by_type — Function
transform_results_by_type(results, kind, zone)Aggregates generation results by plant type and time for a specified market kind and zone.
Arguments
results: DataFiles object containing generation data and parameters.kind: Symbol or string specifying the market result to extract (:REDISP,:GEN, or:DA).zone: The name or key of the market zone to filter on.
Returns
A DataFrame with time as rows and columns for each plant type, containing the sum of generation for each time step and plant type in the specified zone.
Notes
- For
kind = :REDISP, uses theGEN_REDISPfield. - For
kind = :GENor:DA, uses theGENfield (:GENand:DAare treated identically). - If an unsupported kind is given, a warning is issued and
nothingis returned.
Example
julia> transform_results_by_type(results, :DA, "DE")
4×3 DataFrame
Row │ Time wind coal
│ Int64 Float64? Float64?
─────┼───────────────────────────
1 │ 1 60.0 0.0
2 │ 2 100.0 0.0
3 │ 3 120.0 0.0
4 │ 4 140.0 40.0sourcePOMATWO.summarize_result — Function
summarize_result(result_table)Summarizes a generation results table by summing each column (plant type) over all time steps.
Arguments
result_table: DataFrame produced bytransform_results_by_type.
Returns
A DataFrame with a single row, where each column contains the total sum of generation (over all time steps) for the corresponding plant type.
Example
julia> summarize_result(transform_results_by_type(results, :DA, "DE"))
1×2 DataFrame
Row │ wind coal
│ Float64 Float64
─────┼──────────────────
1 │ 420.0 40.0sourcePOMATWO.get_redispatch_by_type_node — Function
get_redispatch_by_type_node(results::DataFiles)Calculates the difference between day-ahead generation (GEN) and redispatch generation (GEN_REDISP) for each technology type at each node across all time steps.
Arguments
results::DataFiles: DataFiles object containing generation data, redispatch data, and parameters.
Returns
A DataFrame with the following columns:
Time: Time stepnode: Node identifiertype: Technology/plant typeGEN: Day-ahead generation valueGEN_REDISP: Redispatch generation valuedifference: The difference (GEN_REDISP - GEN), representing redispatch adjustments
Positive differences indicate upward redispatch, negative values indicate downward redispatch.
Notes
- Only includes plants that appear in both GEN and REDISP data.
- Results are grouped by Time, node, and technology type.
- Empty DataFrames for GEN or REDISP will result in an empty output DataFrame.
Example
julia> redispatch_diff = get_redispatch_by_type_node(results)
100×6 DataFrame
Row │ Time node type GEN GEN_REDISP difference
│ Int64 String String Float64 Float64 Float64
─────┼──────────────────────────────────────────────────────────
1 │ 1 N1 wind 60.0 65.0 5.0
2 │ 1 N1 coal 0.0 0.0 0.0
3 │ 2 N2 gas 50.0 45.0 -5.0
⋮ │ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮sourcePOMATWO.get_market_statistics — Function
get_market_statistics(results::DataFiles, zone::String="DE")Calculate statistical overview of key market parameters for a specified zone.
Computes descriptive statistics (mean, median, standard deviation, min, max, sum) for exchange flows, lost load events, and market prices in the given zone. Returns both a summary statistics table and a time series dataframe for detailed analysis.
Arguments
results::DataFiles: DataFiles object containing model results with EXCHANGE and ZonalMarketBalance data.zone::String="DE": Zone identifier for which to calculate statistics. Defaults to "DE".
Returns
A tuple containing two DataFrames:
- Statistics DataFrame: Contains rows for each statistic (mean, median, std, min, max, sum) for three parameters (Exchange, Lost_Load, Price). Additional rows with
NaNvalues mark the presence of time series data. Columns are:metric::String: The statistical measure or "timeseries"parameter::String: The parameter name (Exchange, Lost_Load, or Price)value::Float64: The computed statistical value (or value vector for timeseries markers)
If EXCHANGE or ZonalMarketBalance data is empty, returns empty DataFrames with appropriate structure.
Notes
- Lost Load statistics include a
count_positivemetric indicating the number of time steps with positive lost load events. - Exchange values represent net flows for the specified zone.
- Prices are extracted from the MarketBalance column of ZonalMarketBalance.
Example
```julia julia> statsdf = getmarket_statistics(results, "DE")
julia> stats_df 18×3 DataFrame Row │ metric parameter value │ String String Float64 ─────┼───────────────────────────────────── 1 │ mean Exchange 150.5 2 │ median Exchange 145.0 3 │ std Exchange 45.2 ⋮ │ ⋮ ⋮ ⋮
source