Interacting with Sets
- To refer to sets in equations, the set object must be an index value (1, 2, 3, etc.)
Example:
|
for year in Years, area in Areas Multiplier[area,year] = 0.50 end |
is the same as:
|
Multiplier[1,1] = 0.50 # area = 1, year = 1 Multiplier[2,1] = 0.50 # area = 2, year = 1 Multiplier[3,1] = 0.50 # area = 3, year = 1 ... Multiplier[25,1] = 0.50 # area = 25, year = 1 Multiplier[1,2] = 0.50 # area = 1, year = 2 Multiplier[2,2] = 0.50 # area = 2, year = 2 Multiplier[3,2] = 0.50 # area = 3, year = 2 ... |
- In the data struct, we define two types of set containers: with and without a final 's'. For example, Area vs Areas.
- Capitalized set names without a final 's' (ex: Area) store a vector of set keys (ex: "AB", "BC",...)
- Capitalized set names with a final 's' (ex: Areas) store the indexes as a vector of integers (ex: 1, 2, etc.)
|
Enduse (Vector of Keys) |
Enduses (Vector of Integers) |
|
Heat |
1 |
|
HW |
2 |
|
OthSub |
3 |
|
Refrig |
4 |
|
Light |
5 |
|
AC |
6 |
|
OthNSub |
7 |