Get the available generators in a System

You can access use get_available_components or get_components to access all the available generators in an existing system.

Option 1a: Using get_available_components to get an iterator

Use get_available_components to get an iterator of all the available generators in an existing system, which also prints a summary:

julia> gen_iter = get_available_components(Generator, system)Generator Counts:
HydroDispatch: 1
RenewableDispatch: 29
RenewableNonDispatch: 31
ThermalStandard: 54

The iterator avoids unnecessary memory allocations if there are many generators, and it can be used to view or update the generator data, such as seeing each of the names:

julia> get_name.(gen_iter)115-element Vector{String}:
 "322_CT_6"
 "321_CC_1"
 "202_STEAM_3"
 "223_CT_4"
 "123_STEAM_2"
 "213_CT_1"
 "223_CT_6"
 "313_CC_1"
 "101_STEAM_3"
 "123_CT_1"
 ⋮
 "118_RTPV_10"
 "313_RTPV_10"
 "118_RTPV_5"
 "118_RTPV_1"
 "118_RTPV_9"
 "118_RTPV_6"
 "313_RTPV_8"
 "118_RTPV_4"
 "201_HYDRO_4"
Tip

Above, we use the abstract supertype Generator to get all components that are subtypes of it. You can instead get all the components of a concrete type, such as:

gen_iter = get_available_components(RenewableDispatch, system)

Option 1b: Using get_available_components to get a vector

Use collect to get a vector of the generators instead of an iterator, which could require a lot of memory:

julia> gens = collect(get_available_components(Generator, system));

Option 2: Using get_components to get an iterator

Alternatively, use get_components with a filter to check for availability:

julia> gen_iter = get_components(get_available, Generator, system)Generator Counts:
HydroDispatch: 1
RenewableDispatch: 29
RenewableNonDispatch: 31
ThermalStandard: 54

collect can also be used to turn this iterator into a vector.

See Also