TulipaIO

TulipaIO is part of the Tulipa ecosystem of packages. The main package in this ecosystem is TulipaEnergyModel.jl. Check that package first for more information on the ecosystem.

Usage

TulipaIO is used to provide input to TulipaEnergyModel and other packages in the ecosystem. Here is some basic usage:

First, we read a fake CSV file with the relevant information.

using TulipaIO: TulipaIO
using DuckDB: DBInterface, DB

con = DBInterface.connect(DB)
table_name = TulipaIO.create_tbl(con, filepath) # filepath is the path to a CSV
"assets_data"

Then we can run SQL commands using the DuckDB interface. It returns a DuckDB.QueryResult, which we convert to Dict to visualize:

DBInterface.execute(con, "SELECT name, variable_cost FROM $table_name WHERE type = 'conversion'") |> Dict
Dict{String, Float64} with 7 entries:
  "Valhalla_H2_generator" => 0.0
  "Valhalla_Fuel_cell"    => 0.0
  "Valhalla_Heat_pump"    => 0.0
  "Asgard_CCGT"           => 0.0015
  "Midgard_CCGT"          => 0.0015
  "Valhalla_Electrolyser" => 0.0
  "Valhalla_GT"           => 0.0015

This allows simple conversion to DataFrame as well:

using DataFrames: DataFrame
DataFrame(DBInterface.execute(con, "SELECT name, type, investable, variable_cost FROM $table_name WHERE name LIKE 'Asgard_%'"))
4×4 DataFrame
Rownametypeinvestablevariable_cost
String?String?Bool?Float64?
1Asgard_Batterystoragetrue0.003
2Asgard_Solarproducertrue0.001
3Asgard_E_demandconsumerfalse0.0
4Asgard_CCGTconversiontrue0.0015

Contributors

Suvayu Ali
Suvayu Ali

💻 👀 🤔
Abel Soares Siqueira
Abel Soares Siqueira

💻 👀 🤔
Lauren Clisby
Lauren Clisby

💻 👀 🤔 📆
Diego Alejandro Tejada Arango
Diego Alejandro Tejada Arango

💻 👀