Function reference

NEMO provides several functions intended for end users - these are documented below. There are also a number of internal functions in NEMO that are documented in the program's Julia code.

calculatescenario

See Calculating a scenario.

createnemodb

NemoMod.createnemodbFunction
createnemodb(path::String;
defaultvals::Dict{String, Float64} = Dict{String, Float64}(),
foreignkeys::Bool = false)

Creates an empty NEMO scenario database in SQLite. If the specified database already exists, drops and recreates NEMO tables in the database.

Arguments

  • path::String: Full path to the scenario database, including the file name.
  • defaultvals::Dict{String, Float64} = Dict{String, Float64}(): Dictionary of parameter table names and default values for val column.
  • foreignkeys::Bool = false: Indicates whether to create foreign keys within the database.
source

dropdefaultviews

dropresulttables

NemoMod.dropresulttablesFunction
dropresulttables(db::SQLite.DB, quiet::Bool = true)

Drops all tables in db whose name begins with ""v"" or ""sqlite_stat"" (both case-sensitive). The quiet parameter determines whether most status messages are suppressed.

source

logmsg

NemoMod.logmsgFunction
logmsg(msg::String, suppress=false, dtm=now()::DateTime)

Prints a log message (msg) to STDOUT. The message is suppressed if suppress == true. dtm determines the date and time included in the printed message.

Examples

julia> using Dates

julia> logmsg("Test message", false, DateTime(2020))
2020-01-Jan 00:00:00.000 Test message
source

setparamdefault

NemoMod.setparamdefaultFunction
setparamdefault(db::SQLite.DB, table::String, val::Float64)

Sets the default value for a parameter table in a NEMO scenario database.

Arguments

  • db::SQLite.DB: Scenario database containing the parameter table.
  • table::String: Table name (case-sensitive).
  • val::Float64: Parameter value (must be a floating-point number).
source

writescenariomodel

NemoMod.writescenariomodelFunction
writescenariomodel(dbpath::String;
    calcyears::Array{Int, 1} = Array{Int, 1}(),
    varstosave::String = "vdemandnn, vnewcapacity, vtotalcapacityannual,
        vproductionbytechnologyannual, vproductionnn, vusebytechnologyannual,
        vusenn, vtotaldiscountedcost",
    restrictvars::Bool = true, continuoustransmission::Bool = false,
    forcemip::Bool = false, startvalsdbpath::String = "",
    startvalsvars::String = "", quiet::Bool = false,
    writefilename::String = "nemomodel.bz2",
    writefileformat::MathOptInterface.FileFormats.FileFormat = MathOptInterface.FileFormats.FORMAT_MPS
)

Writes a file representing the optimization problem for a NEMO scenario. Returns the name of the file. All arguments except writefilename and writefileformat function as in calculatescenario. writefilename and writefileformat are described below.

Arguments

  • writefilename::String: Name of the output file. If a path is not included in the name, the file is written to the Julia working directory. If the name ends in .gz, the file is compressed with Gzip. If the name ends in .bz2, the file is compressed with BZip2.
  • writefileformat::MathOptInterface.FileFormats.FileFormat: Data format used in the output file. Common formats include MathOptInterface.FileFormats.FORMAT_MPS (MPS format) and MathOptInterface.FileFormats.FORMAT_LP (LP format). See the documentation for MathOptInterface for additional options.
source