Internal API

Dieter.convert_jump_container_to_dfMethod

Returns a DataFrame with the values of the variables from the JuMP container var. The column names of the DataFrame can be specified for the indexing columns in dim_names, and the name of the data value column by a Symbol value_col e.g. :Value

source
Dieter.initialise_data_dir_structureMethod

Initialise a basic file structure for accessing the model data. The default directory structure is: <datapath>/ ├── base │   ├── availability.csv │   ├── load.csv │   ├── storages.csv │   └── technologies.csv ├── ev │   ├── ev.csv │   ├── evdemand.csv │   └── evpower.csv ├── h2 │   └── h2technologies.csv └── heat ├── buildings.csv ├── dhwdemand.csv ├── heat.csv ├── heatdemand.csv ├── heattechnologies.csv └── temperature.csv

source
Dieter.map_idcolMethod

Return a dictionary of Dicts from a DataFrame with column-names as keys, and each Dict has a key-value pair of idcols => data-value. Column symbols listed in `skipcols` are skipped.

Examples

julia> df = DataFrame(x=1:4, y=11:14, z=2:5)
4×3 DataFrame
│ Row │ x     │ y     │ z     │
│     │ Int64 │ Int64 │ Int64 │
├─────┼───────┼───────┼───────┤
│ 1   │ 1     │ 11    │ 2     │
│ 2   │ 2     │ 12    │ 3     │
│ 3   │ 3     │ 13    │ 4     │
│ 4   │ 4     │ 14    │ 5     │

julia> map_idcol(df, 1, skip_cols=[:z])
Dict{Symbol,Dict} with 1 entry:
  :y => Dict(4=>14,2=>12,3=>13,1=>11)
source
Dieter.parse_base_technologies!Method

Expected Dieter model parameters read into dtr.parameters: ExistingCapacity, FuelCost, FixedCost, VariableCost, OvernightCost, CurtailmentCost, LoadIncreaseCost, LoadDecreaseCost, Lifetime, MaxCapacity, MaxEnergy, TechTypeCategory, Renewable, Dispatchable, FuelSource, Efficiency, CarbonContent, CO2_price

source
Dieter.split_df_tupleMethod

split_df_tuple is a function that transforms a DataFrame with a Tuple{N,M...} type column. It outputs an augmented DataFrame with the tuples split into two columns of type N, M... resp.

The function splits the column InputCol of type Tuple into individual columns named with OutputCols vector of Symbols. Note that the Symbols in OutputCols need to be of the name length and order to correspond to the splitting Tuples.

Arguments

  • df : a DataFrame
  • InputCol : a Symbol for a column of type Tuple{Types...}
  • OutputCols: a Vector of Symbols for new column names,

Returns

  • ::DataFrame

Examples

``` julia> using DataFramesMeta, DataFrames

julia> df = DataFrame(A_N = [("a",1),("b",2)], V = [8,9]);

julia> splitdftuple(df, :AN, [:A, :N]) 2×4 DataFrame │ Row │ AN │ V │ A │ N │ │ │ Tuple… │ Int64 │ String │ Int64 │ ├─────┼──────────┼───────┼────────┼───────┤ │ 1 │ ("a", 1) │ 8 │ a │ 1 │ │ 2 │ ("b", 2) │ 9 │ b │ 2 │ ```

source
Dieter.table2dfMethod

Function to convert an Array{Any,2} with a header row of column name strings to a DataFrame

  • Thanks: https://stackoverflow.com/questions/25894634/dataframe-from-array-with-header
source
Dieter.tableToDictMethod
tableToDict(tab::Array{Any,2}; keycols::Array{Int64,1}=[1])

Create a dictionary from an array in table form, where the table tab has:

  • key-index or indices given in the keycol array (integer column position), and
  • the column names for data appear in the first row.
source
Dieter.@defMacro

The def macro is used to build other macros that can insert the same block of Julia code into different parts of a program. This is macro is used to generate a standard set of fields inside a model type hierarchy. (Thanks: InfrastructureModels.jl; see http://www.stochasticlifestyle.com/type-dispatch-design-post-object-oriented-programming-julia/)

source