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}:
 "201_HYDRO_4"
 "122_WIND_1"
 "324_PV_3"
 "312_PV_1"
 "102_PV_1"
 "101_PV_1"
 "324_PV_2"
 "313_PV_2"
 "104_PV_1"
 "101_PV_2"
 ⋮
 "313_RTPV_3"
 "118_RTPV_10"
 "313_RTPV_10"
 "118_RTPV_5"
 "118_RTPV_1"
 "118_RTPV_9"
 "118_RTPV_6"
 "313_RTPV_8"
 "118_RTPV_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:

julia> gen_iter = get_available_components(RenewableDispatch, system)RenewableDispatch Counts:
RenewableDispatch: 29

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