|
| 1 | +# [Model Structures](@id structures) |
| 2 | + |
| 3 | +```@contents |
| 4 | +Pages = ["60-structures.md"] |
| 5 | +Depth = 3 |
| 6 | +``` |
| 7 | + |
| 8 | +The list of relevant structures used in this package are listed below: |
| 9 | + |
| 10 | +## EnergyProblem |
| 11 | + |
| 12 | +The `EnergyProblem` structure is a wrapper around various other relevant structures. |
| 13 | +It hides the complexity behind the energy problem, making the usage more friendly, although more verbose. |
| 14 | + |
| 15 | +### Fields |
| 16 | + |
| 17 | +- `db_connection`: A DuckDB connection to the input tables in the model |
| 18 | +- `graph`: The Graph object that defines the geometry of the energy problem. |
| 19 | +- `model`: A JuMP.Model object representing the optimization model. |
| 20 | +- `objective_value`: The objective value of the solved problem (Float64). |
| 21 | +- `variables`: A [TulipaVariable](@ref TulipaVariable) structure to store all the information related to the variables in the model. |
| 22 | +- `constraints`: A [TulipaConstraint](@ref TulipaConstraint) structure to store all the information related to the constraints in the model. |
| 23 | +- `representative_periods`: A vector of [Representative Periods](@ref representative-periods). |
| 24 | +- `solved`: A boolean indicating whether the `model` has been solved or not. |
| 25 | +- `termination_status`: The termination status of the optimization model. |
| 26 | +- `timeframe`: A structure with the number of periods in the `representative_periods` and the mapping between the periods and their representatives. |
| 27 | +- `model_parameters`: A [ModelParameters](@ref ModelParameters) structure to store all the parameters that are exclusive of the model. |
| 28 | +- `years`: A vector with the information of all the milestone years. |
| 29 | + |
| 30 | +### Constructor |
| 31 | + |
| 32 | +The `EnergyProblem` can also be constructed using the minimal constructor below. |
| 33 | + |
| 34 | +- `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`. |
| 35 | + |
| 36 | +See the [basic example tutorial](@ref basic-example) to see how these can be used. |
| 37 | + |
| 38 | +## GraphAssetData |
| 39 | + |
| 40 | +This structure holds all the information of a given asset. |
| 41 | +These are stored inside the Graph. |
| 42 | +Given a graph `graph`, an asset `a` can be accessed through `graph[a]`. |
| 43 | + |
| 44 | +## GraphFlowData |
| 45 | + |
| 46 | +This structure holds all the information of a given flow. |
| 47 | +These are stored inside the Graph. |
| 48 | +Given a graph `graph`, a flow from asset `u` to asset `v` can be accessed through `graph[u, v]`. |
| 49 | + |
| 50 | +## [Timeframe](@id timeframe) |
| 51 | + |
| 52 | +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: |
| 53 | + |
| 54 | +- `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. |
| 55 | +- `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. |
| 56 | + |
| 57 | +## [Representative Periods](@id representative-periods) |
| 58 | + |
| 59 | +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). |
| 60 | + |
| 61 | +A representative period has three fields: |
| 62 | + |
| 63 | +- `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). |
| 64 | +- `timesteps`: The number of timesteps blocks in the representative period. |
| 65 | +- `resolution`: The duration in time of each timestep. |
| 66 | + |
| 67 | +The number of timesteps and resolution work together to define the coarseness of the period. |
| 68 | +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`. |
| 69 | + |
| 70 | +## [Time Blocks](@id time-blocks) |
| 71 | + |
| 72 | +A time block is a range for which a variable or constraint is defined. |
| 73 | +It is a range of numbers, i.e., all integer numbers inside an interval. |
| 74 | +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. |
0 commit comments