-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
356 additions
and
425 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# [Model Parameters](@id schemas) | ||
|
||
The optimization model parameters with the input data must follow the schema below for each table. To create these tables we currently use CSV files that follow this same schema and then convert them into tables using TulipaIO, as shown in the basic example of the [Tutorials](@ref basic-example) section. | ||
|
||
The schemas can be accessed at any time after loading the package by typing `TulipaEnergyModel.schema_per_table_name` in the Julia console. Here is the complete list of model parameters in the schemas per table (or CSV file): | ||
|
||
```@eval | ||
using Markdown, TulipaEnergyModel | ||
Markdown.parse( | ||
join(["- **`$filename`**\n" * | ||
join( | ||
[" - `$f: $t`" for (f, t) in schema], | ||
"\n", | ||
) for (filename, schema) in TulipaEnergyModel.schema_per_table_name | ||
] |> sort, "\n") | ||
) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# [Model Structures](@id structures) | ||
|
||
```@contents | ||
Pages = ["60-structures.md"] | ||
Depth = 3 | ||
``` | ||
|
||
The list of relevant structures used in this package are listed below: | ||
|
||
## EnergyProblem | ||
|
||
The `EnergyProblem` structure is a wrapper around various other relevant structures. | ||
It hides the complexity behind the energy problem, making the usage more friendly, although more verbose. | ||
|
||
### Fields | ||
|
||
- `db_connection`: A DuckDB connection to the input tables in the model | ||
- `graph`: The Graph object that defines the geometry of the energy problem. | ||
- `model`: A JuMP.Model object representing the optimization model. | ||
- `objective_value`: The objective value of the solved problem (Float64). | ||
- `variables`: A [TulipaVariable](@ref TulipaVariable) structure to store all the information related to the variables in the model. | ||
- `constraints`: A [TulipaConstraint](@ref TulipaConstraint) structure to store all the information related to the constraints in the model. | ||
- `representative_periods`: A vector of [Representative Periods](@ref representative-periods). | ||
- `solved`: A boolean indicating whether the `model` has been solved or not. | ||
- `termination_status`: The termination status of the optimization model. | ||
- `timeframe`: A structure with the number of periods in the `representative_periods` and the mapping between the periods and their representatives. | ||
- `model_parameters`: A [ModelParameters](@ref ModelParameters) structure to store all the parameters that are exclusive of the model. | ||
- `years`: A vector with the information of all the milestone years. | ||
|
||
### Constructor | ||
|
||
The `EnergyProblem` can also be constructed using the minimal constructor below. | ||
|
||
- `EnergyProblem(connection)`: Constructs a new `EnergyProblem` object with the given `connection` that has been created and the data loaded into it using [TulipaIO](https://github.com/TulipaEnergy/TulipaIO.jl). The `graph`, `representative_periods`, `timeframe`, and `years` are computed using `create_internal_structures`. | ||
|
||
See the [basic example tutorial](@ref basic-example) to see how these can be used. | ||
|
||
## GraphAssetData | ||
|
||
This structure holds all the information of a given asset. | ||
These are stored inside the Graph. | ||
Given a graph `graph`, an asset `a` can be accessed through `graph[a]`. | ||
|
||
## GraphFlowData | ||
|
||
This structure holds all the information of a given flow. | ||
These are stored inside the Graph. | ||
Given a graph `graph`, a flow from asset `u` to asset `v` can be accessed through `graph[u, v]`. | ||
|
||
## [Timeframe](@id timeframe) | ||
|
||
The timeframe is the total period we want to analyze with the model. Usually this is a year, but it can be any length of time. A timeframe has two fields: | ||
|
||
- `num_periods`: The timeframe is defined by a certain number of periods. For instance, a year can be defined by 365 periods, each describing a day. | ||
- `map_periods_to_rp`: Indicates the periods of the timeframe that map into a [representative period](@ref representative-periods) and the weight of the representative period to construct that period. | ||
|
||
## [Representative Periods](@id representative-periods) | ||
|
||
The [timeframe](@ref timeframe) (e.g., a full year) is described by a selection of representative periods, for instance, days or weeks, that nicely summarize other similar periods. For example, we could model the year into 3 days, by clustering all days of the year into 3 representative days. Each one of these days is called a representative period. _TulipaEnergyModel.jl_ has the flexibility to consider representative periods of different lengths for the same timeframe (e.g., a year can be represented by a set of 4 days and 2 weeks). To obtain the representative periods, we recommend using [TulipaClustering](https://github.com/TulipaEnergy/TulipaClustering.jl). | ||
|
||
A representative period has three fields: | ||
|
||
- `weight`: Indicates how many representative periods are contained in the [timeframe](@ref timeframe); this is inferred automatically from `map_periods_to_rp` in the [timeframe](@ref timeframe). | ||
- `timesteps`: The number of timesteps blocks in the representative period. | ||
- `resolution`: The duration in time of each timestep. | ||
|
||
The number of timesteps and resolution work together to define the coarseness of the period. | ||
Nothing is defined outside of these timesteps; for instance, if the representative period represents a day and you want to specify a variable or constraint with a coarseness of 30 minutes. You need to define the number of timesteps to 48 and the resolution to `0.5`. | ||
|
||
## [Time Blocks](@id time-blocks) | ||
|
||
A time block is a range for which a variable or constraint is defined. | ||
It is a range of numbers, i.e., all integer numbers inside an interval. | ||
Time blocks are used for the periods in the [timeframe](@ref timeframe) and the timesteps in the [representative period](@ref representative-periods). Time blocks are disjunct (not overlapping), but do not have to be sequential. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters