Selecting One or More Set Elements

Use global function Select to create a subset of set elements.

1. To select one set value:

subset = Select(SetName,"SetKey")

2. To select more than one set value:

subset = Select(SetName,["SetKey1","SetKey2",...])

3. To select a range of set values:

subset = Select(SetName,(from="SetKey1",to="SetKeyi"))

 4. To select a collection of set elements that are not equal to an individual SetKey: 

subset = Select(SetName,!=("SetKey"))



๐Ÿ•ฎ

Example

Select one enduse, Heat, and techs Electric and Biomass:

enduse = Select(Enduse,"Heat"))

techs = Select(Tech,["Electric","Biomass"])


for area in Areas, ec in ECs, tech in techs, enduse in enduses

  DEEThermalMax[enduse,tech,ec,area] = 1

end



๐Ÿ•ฎ

Example

Select all ECs that are not "Rubber":

ecs = Select(EC,!=("Rubber"))



๏

The โ€œYearโ€ set is handled differently.

Selecting a Subset of Years

1. Use global function Yr(year) to select one year:

(1) year = Yr(2019) # turns year 2019 into index

(2) for year in Years

      Multiplier[year] = Multiplier(Yr(2019))

    end

2. Use Julia function collect to select multiple years:

(1) years = collect(Future:Final)

(2) years = collect(Yr(2030):Yr(2035))

    for year in years

      Multiplier[year] = Multiplier[year-1]

    end


Combining Multiple Set Selections

Use union to combine multiple set selections together:

subset1 = Select(SetName,"SetKey")

subset2 = Select(SetName(from="SetKey1",to="SetKeyi"))

subset = union(subset1,subset2)