GAMS utility functions¶
This module has the utility functions used to populate the GAMS databases used in the GAMS model.
-
addGeneratorSets
(db, genFleet)¶ Add generator sets to database
Add gen sets & subsets
- Parameters
db – gams database object
genFleet – 2d list ith generator fleet data
- Returns
list with gams sets created
-
isolateGenSymbols
(genFleet, genPlantType)¶ Gen symbols: g1, g2, etc., where # = row in gen fleet
- Parameters
genFleet – 2d list with generator fleet data
genPlantType – string with PlantType
- Returns
list with generator symbols
-
addHourSet
(db, hours)¶ Add set with simulation hours to database
Add all hours
- Parameters
db – GAMS database object
hours – 1d list with hours to be included on set
- Returns
list with: gams set with simulation hours and list with hour symbols
-
addHourSeasonSubsets
(db, repHrsBySeason)¶ Define season subsets of hours
Inputs: GAMS db, dict of (season:rep hrs)
- Parameters
db – GAMS database object
repHrsBySeason – dict of (season:rep hrs)
-
addHourSpecialSubset
(db, specialHrs)¶ Define special subsets of hours
Inputs: GAMS db, 1d list of special hours
- Parameters
db – GAMS database object
specialHrs – 1d list of special hours
-
addPeakHourSubset
(db, peakDemandHourZonal, genparam)¶ Define peak demand hour subset
- Parameters
db – GAMS database object
peakDemandHourZonal –
- Returns
list with: gams set with peak hours and list with peak hour symbols
-
addZoneSets
(db, ipmZoneNums)¶ Add sets with zones to database
- Parameters
db – GAMS database object
ipmZoneNums –
- Returns
list with: gams set with zones and list with zone symbols
-
addLineSets
(db, lines)¶ Add line sets
- Parameters
db – GAMS database object
lines – list with line names
- Returns
gams set with line names
-
addCellSet
(db, cellsToZones)¶ ADD CELLS FOR NEW TECHS SET
- Parameters
db – GAMS database object
cellsToZones – (dict) dictionary mapping cells to zones
- Returns
gams set with cell names
-
addNewTechsSets
(db, newTechsCE, plantTypesCurtailed, blocksWind=None, blocksSolar=None)¶ Add set with new techs to database
- Parameters
db – GAMS database object
newTechsCE – (2d list) new techs
plantTypesCurtailed – (list) types of plants that have climate-induced capacity deratings
- Returns
list with all gams sets and lists with symbols created
-
isolateTechSymbols
(newTechsCE, ptCurtailed, blocksWind=None, blocksSolar=None)¶ Takes in new techs (2d list), and returns tech types as: all types, renew (wind or solar) types, or types that can be curtailed
- Parameters
newTechsCE – 2d list with new techs data
ptCurtailed – 1-d list with plant types that are curtailed
blocksWind – 1-d list with indexes of blocks of wind
blocksSolar – 1-d list with indexes of blocks of solar
- Returns
lists with symbols created for each set (techSymbols, techCurtailedSymbols, techRenewSymbols, techNotCurtailedSymbols)
-
addSet
(db, setSymbols, setName, setDescription, setDim)¶ Generic function to add set to gams database
- Parameters
db – GAMS database object
setSymbols – (list) list with symbols of each element
setName – (string) name of set
setDescription – (string) description of set
setDim – (int) dimension of set
- Returns
gams set created
-
addDemandParam
(db, demandCEZonal, zoneSet, hourSet, gcmSet, hoursForCE, ipmZones, ipmZoneNums, scaleMWtoGW)¶ Add hourly demand parameters (either dict of gcm:zone:hourly demand or dict of zone:demand) for both CE and UC models
- Parameters
db – gams data base object
demandCEZonal – (dict) nested dictionary with hourly demand by gcm/zone
zoneSet – gams set object with zone names
hourSet – gams set object with hours of simulation
gcmSet – gams set object with gcm names
hourSymbols – list with hours of simulation
ipmZones – list with zone names
ipmZoneNums – list with zone numbers
scaleMWtoGW – (float) scaling factor MW to GW
-
createDictIndexedByZone
(dataDict, ipmZones, ipmZoneNums, *args)¶ creates a dictionary indexed by zone names used in GAMS (z1, z2,…)
Inputs: dictionary of zone:list, optional scalar. Outputs: dictionary of zone symbol:list.
- Parameters
dataDict – dictionary with data indexed by zone (using actual zone names)
ipmZones – list with zones names
ipmZoneNums – list with zone numbers
args – additional arguments (scaling factors)
- Returns
dictionary indexed by zone names used in GAMS (z1, z2,…)
-
addEguParams
(db, genFleet, genSet, genSymbols, ipmZones, ipmZoneNums, scaleLbToShortTon, scaleMWtoGW)¶ ADD EXISTING GENERATOR PARAMETERS
- Parameters
db – data base object
genFleet – 2d list with gen fleet
genSet – gams set object with existing generators
genSymbols – list with symbols of generators
ipmZones – symbols of ipm zones (symbols follow gams model nomenclature)
ipmZoneNums – indexes of ipm zones
scaleLbToShortTon – (float) conversion factor (pounds to short tons)
scaleMWtoGW – (float) conversions factor (MW to GW)
-
getEguParamZoneDict
(genFleet, zoneCol, ipmZones, ipmZoneNums)¶ Create a dictionary mapping generator to ipm zone
- Parameters
genFleet – 2d list with gen fleet
zoneCol – (int) column with zone name
ipmZones – list with ipm zone names
ipmZoneNums – list with ipm zone numbers
- Returns
dict of {genSymbol:zone num}
-
addEguOpCostParam
(db, genFleet, genSet, genSymbols, scaleLbToShortTon, scaleMWtoGW, scaleDollarsToThousands, *co2Price)¶ Add op cost parameter for existing gens
- Parameters
db – data base object
genFleet – 2d list with gen fleet
genSet – gams set object with existing generators
genSymbols – list with symbols of generators
scaleLbToShortTon – (float) conversion factor lb to short ton
scaleMWtoGW – (float) conversion factor MW to GW (1/1000)
scaleDollarsToThousands – (float) conversion factor dollars to thousand dollars
co2Price – (float) value of CO2 price
-
addEguHourlyParams
(db, hourlyCapacsCE, gcmSet, genSet, hourSet, hoursForCE, scaleMWtoGW)¶ Add existing generator hourly capacities to gdx database
Add hourly HR & capac param
- Parameters
db – gams data base object
hourlyCapacsCE – (dict) hourly capacities of existing generators
gcmSet – gams set object with gcm names
genSet – gams set object with existing generators
hourSet – gams set object with hours of simulation
hoursForCE – list with hours of simulation
scaleMWtoGW – (float) conversion factor MW to GW (1/1000)
-
getHourly2dParamDict
(hourlyParam, hoursForCE, scalar)¶ Creates dictionary of (key,hourSymbol)
for capac or HR, key=gen; for demand or wind & solar gen, key=zone
- Parameters
hourlyParam – (dict) nested dictionary with hourly parameters
hoursForCE – (list) hours of simulation (considering all gcms)
scalar – (float) scaling factor
- Returns
dictionary with tuples (key,hourSymbol) as keys
-
addExistingRenewableMaxGenParams
(db, gcmSet, zoneSet, ipmZones, ipmZoneNums, hourSet, hoursForCE, hourlySolarGenCEZonal, hourlyWindGenCEZonal, scaleMWtoGW)¶ Add existing renewable combined maximum generation values to database
Converts 1d list of param vals to hour-indexed dicts, then adds dicts to GAMS db
- Parameters
db – gams data base object
zoneSet – gams set object with zones
ipmZones – list with ipm zones
ipmZoneNums – list with ipm zone numbers
hourSet – gams set object with hours of simulation
hourSymbols – list with symbols of hours of simulation
hourlySolarGenCEZonal – (dict) hourly solar generation by zone
hourlyWindGenCEZonal – (dict) hourly wind generation by zone
scaleMWtoGW – (float) scaling factors MW to GW
-
getParamIndexedByHourDict
(paramVals, hourSymbols, *scalar)¶ Stores set of values into dictionary keyed by hour
- Parameters
paramVals – set of param values (1d list)
hourSymbols – hour symbols (1d list)
scalar – optional scalar
- Returns
dictionary of (hour symbol:param val)
-
addLineSourceAndSink
(db, lineSet, lines, ipmZones, ipmZoneNums)¶ Add zone and line constraints
Add parameter mapping lines to zone sources & sinks (pLinesources(l),pLinesinks(l))
- Parameters
db – gams data base object
lineSet – gams set object with lines names
lines – list with lines names
ipmZones – list with zone names
ipmZoneNums – list with zone numbers
-
addLineCapacs
(db, lineCapacs, lineSet, lines, scaleMWtoGW)¶ Add line capacities (pLinecapacs(l)). lineCapacs already a dict of line:capac;
convert to GW
- Parameters
db – gams data base object
lineCapacs – (dict) capacities of transmission lines
lineSet – gams set with lines names
lines – list with lines names
scaleMWtoGW – (float) scaling factor MW to GW
-
addPumpHydroParams
(db, genFleetForCE, phEff, phMaxSoc, phInitSoc, pumpHydroGenSet, pumpHydroGenSymbols, scaleMWtoGW)¶ ADD PUMPED HYDRO PARAMETERS
- Parameters
db – gams data base object
genFleetForCE – 2d list with gen fleet
phEff – (float) pumped hydro efficiency (%)
phMaxSoc – (float) pumped hydro maximum state of charge (multiplier of capacity)
phInitSoc – (float) pumped hydro initial state of charge (% of maxsoc)
pumpHydroGenSet – gams set with pumped hydro generators
pumpHydroGenSymbols – list with pumped hydro generators symbols
scaleMWtoGW – (float) scaling factor MW to GW
-
getSocDict
(genFleetForCE, phMaxSoc, pumpHydroGenSymbols, scaleMWtoGW)¶ Get state of charge for pumped hydro. phMaxSoc equals multiple of capacity
- Parameters
genFleetForCE – 2d list with gen fleet
phMaxSoc – (float) pumped hydro maximum state of charge (multiplier of capacity)
pumpHydroGenSymbols – list with pumped hydro generators symbols
scaleMWtoGW – (float) scaling factor MW to GW
- Returns
(dict) {pumped hydro symbol: max state of charge (in MW)}
-
addTechParams
(db, newTechsCE, scaleMWtoGW, scaleDollarsToThousands, scaleLbToShortTon, ptCurtailed)¶ Add new tech parameters to gdx database for CE
- Parameters
db – gams data base object
newTechsCE – 2d list with parameters of new techs
scaleMWtoGW – (float) scaling factor MW to GW
scaleDollarsToThousands – (float) scaling factor dollars to thousands
scaleLbToShortTon – (float) scaling factor lb to short tons
ptCurtailed – (list) list of techs that have climate-induced capacity derating
-
getTechParamDict
(newTechsCE, techSymbols, paramColName, ptCurtailed, *scalar)¶ Creates dict of (techSymbol:paramVal) for given parameter name
- Parameters
newTechsCE – 2d list with parameters of new techs
techSymbols – (list) names of new techs
paramColName – (int) index of column of desired parameter in newTechsCE
ptCurtailed – (list) list of techs that have climate-induced capacity derating
scalar – (float) scaling factor
- Returns
dict of (techSymbol:paramVal) for given parameter name
-
getTechOpCostDict
(newTechs, ptCurtailed, scalar)¶ Takes in techs and returns dictionary of (tech:opCost)
- Parameters
newTechs – 2d list with parameters of new techs
ptCurtailed – (list) list of techs that have climate-induced capacity derating
scalar – (float) scaling factor
- Returns
dictionary of {tech:opCost}
-
addTechCurtailedHourlyCapac
(db, hourlyCurtailedTechCapacsCE, gcmSet, cellSet, techCurtailedSet, hourSet, hoursForCE, scaleMWtoGW)¶ Add hourly curtailed tech capac.
Input capacs: (tech,loc):[capacs]. Output dict added to db: idxed by (loc,tech,hr)
- Parameters
db – gams data base object
hourlyCurtailedTechCapacsCE –
cellSet – gams set with grid cell names
techCurtailedSet – gams set with names of techs that have climate-induced capacity deratings
hourSet – gams set with hours of simulation
hoursForCE – list with hours of simulation
scaleMWtoGW – (float) scaling factor MW to GW
-
getHourlyTechParamDict
(hourlyParam, hoursForCE, scalar)¶ Creates dictionary of (gcm, locSymbol, techSymbol, hourSymbol):capac or HR
- Parameters
hourlyParam – (dict) dictionary with hourly values for (tech, cell) tuples
hoursForCE – list with hours of simulation
scalar – (float) scaling factor
- Returns
(dict) {(gcm, locSymbol, techSymbol, hourSymbol): value}
-
addCellsToZones
(db, cellSet, cellsToZones, ipmZones, ipmZoneNums)¶ ADD MAP FROM CELLS TO ZONES
- Parameters
db – gams data base object
cellSet – gams set with grid cell names
cellsToZones – (dict) dictionary mapping cells to zones
ipmZones – list with ipm zone names
ipmZoneNums – list with ipm zone numbers
-
addPlanningReserveParam
(db, planningReserveZonal, ipmZones, ipmZoneNums, zoneSet, zoneSymbols, scaleMWtoGW)¶ Add planning reserve margin fraction parameters
Add zonal planning reserve
- Parameters
db – gams data base object
planningReserveZonal – (dict) dictionary with planning reserve margin (in MW) for each zone
ipmZones – list with ipm zone names
ipmZoneNums – list with ipm zone numbers
zoneSet – gams set with zone names
zoneSymbols – list with zone names
scaleMWtoGW – (float) scaling factor MW to GW
-
addPeakHourToZoneParam
(db, peakDemandHourZonal, peakHourSet, peakHrSymbols, ipmZones, ipmZoneNums)¶ Add map of peak hour to zone
- Parameters
db – gams data base object
peakDemandHourZonal – (dict) hours of peak demand in each zone
peakHourSet – gams set with peak hours
peakHrSymbols – list with peak hours
ipmZones – list with ipm zone names
ipmZoneNums – list with ipm zone numbers
-
addDiscountRateParam
(db, discountRate)¶ Add discount rate parameter to gdx database
- Parameters
db – gams data base object
discountRate – (float) annual discount rate
-
addExistingPlantFirmFractions
(db, genFleet, genSet, genSymbols, firmCapacityCreditsExistingGens)¶ Add firm fraction for existing generators
Firm fraction goes towards meeting planning reserve margin
- Parameters
db – gams data base object
genFleet – 2d list with gen fleet
genSet – gams set object with existing generators
genSymbols – list with symbols of generators
firmCapacityCreditsExistingGens –
-
getFirmCreditExistingGenDict
(genFleet, firmCapacityCreditsExistingGens)¶ Returns dict of (genSymbol:capacCredit) based on plant type of each generator
- Parameters
genFleet – 2d list with gen fleet
firmCapacityCreditsExistingGens –
- Returns
-
addRenewTechCFParams
(db, renewTechSet, renewTechSymbols, gcmSet, zoneSet, hourSet, hoursForCE, newWindCFsCEZonal, newSolarCFsCEZonal, ipmZones, ipmZoneNums)¶ Add hourly capacity factors for new renewable techs
Add CFs for new renew builds. Input: CFs as zone:[CF]
Output: dict added to GAMS file as (z,tech,h):[CFs]
- Parameters
db – gams data base object
renewTechSet – gams set with renewable techs
renewTechSymbols – list with renewable tech names
zoneSet – gams set with zone names
hourSet – gams set with hours of simulation
hourSymbols – list with hours of simulation
newWindCFsCEZonal – dict with CFs for new wind gens
newSolarCFsCEZonal – dict with CFs for new solar gens
ipmZones – list with ipm zone names
ipmZoneNums – list with ipm zone numbers
-
addCppEmissionsCap
(db, co2CppSercCurrYearLimit)¶ Add co2 emission caps for CE model
- Parameters
db – gams data base object
co2CppSercCurrYearLimit – annual co2 upper bound (in short tons)
-
addSeasonDemandWeights
(db, seasonDemandWeights)¶ Add weights to scale representative seasonal demand up to complete season period
- Parameters
db – gams data base object
seasonDemandWeights – dictionary with season weights
-
addMaxNumNewRenew
(db, newWindCFsCEZonal, newSolarCFsCEZonal, ipmZones, ipmZoneNums)¶ Add limit on max number of new renewable builds (Wind and Solar) per zone and aggregated block
- Parameters
db – GAMS database object
-
addMaxNumNewBuilds
(db, newTechsCE, zoneSet, ipmZones, ipmZoneNums, typeSet, maxAddedZonalCapacPerTech, ptCurtailed)¶ Add limit of max number of new builds per plant type in each zone
- Parameters
db – gams data base object
newTechsCE – 2d list with parameters of new techs
zoneSet – gams set object with zone names
ipmZones – list with ipm zone names
ipmZoneNums – list with ipm zone numbers
typeSet – gams set object with types of new techs (no cooling info)
maxAddedZonalCapacPerTech – (numeric or dict) maximum of each type per zone
ptCurtailed – list with techs that have climate-induced capacity deratings
-
addHydroMaxGenPerSeason
(db, hydroGenSet, gcmSet, hydroPotPerSeason, scaleMWtoGW)¶ Add max hydro generation per time block
hydroPotPerSeason is a dict of season:genSymbol:gen (MWh), so just need to scale it. Note that sesaon can be ‘special’!
- Parameters
db – gams data base object
hydroGenSet – gams set object with hydro generators
hydroGenSymbols – list with names of hydro generators
hydroPotPerSeason – (dict) {season:genSymbol:gen (MWh)}
scaleMWtoGW – (float) scaling factor MW to GW
-
addHydroMaxGenUC
(db, hydroGenSet, hydroPot, scaleMWtoGW)¶ Add max hydro gen for days in UC run
- Parameters
db – gams data base object
hydroGenSet – gams set object with hydro generators
hydroPot – dict of genSymbol:gen (MWh)
scaleMWtoGW – (float) scaling factor MW to GW
-
addEguUCParams
(db, fleetUC, genSet, genSymbols, scaleMWtoGW, scaleDollarsToThousands)¶ Add UC parameters
- Parameters
db – gams data base object
fleetUC – 2d list with gen fleet
genSet – gams set object with existing generators
genSymbols – list with symbols of generators
scaleMWtoGW – (float) scaling factor MW to GW
scaleDollarsToThousands – (float) scaling factor dollars to thousands
-
addRegReserveParameters
(db, regUp, regDown, rrToRegTime, hourSet, hourSymbols, zoneSet, modelName, genparam)¶ Add reg reserve parameters
- Parameters
db – gams data base object
regUp – (2d list) hourly values of regulated up reserve by zone
regDown – (2d list) hourly values of regulated down reserve by zone
rrToRegTime – (float) scaling factor for reserve time frame
hourSet – gams set with hours of simulation
hourSymbols – list with simulation hours
zoneSet – gams set with zones
modelName – (string) name of model
genparam – object of class
Generalparameters
-
addFlexReserveParameters
(db, flexRes, rrToFlexTime, hourSet, hourSymbols, zoneSet, modelName, genparam)¶ Add reserve parameter quantities
- Parameters
db – gams data base object
flexRes – (2d list) hourly values of flexibility reserve by zone
rrToFlexTime – (float) scaling factor for flexibility reserve time frame
hourSet – gams set with hours of simulation
hourSymbols – list with simulation hours
zoneSet – gams set with zones
modelName – (string) name of model
genparam – object of class
Generalparameters
-
addContReserveParameters
(db, contRes, rrToContTime, hourSet, hourSymbols, zoneSet, genparam)¶ - Parameters
db – gams data base object
contRes – (2d list) hourly values of contigency reserve by zone
rrToContTime – (float) scaling factor for contigency reserve time frame
hourSet – gams set with hours of simulation
hourSymbols – list with simulation hours
zoneSet – gams set with zones
genparam – object of class
Generalparameters
-
addEguInitialConditions
(db, genSet, genSymbols, fleetUC, onOffInitial, genAboveMinInitial, mdtCarriedInitial, scaleMWtoGW)¶ Add initial conditions
- Parameters
db – gams data base object
genSet – gams set object with existing generators
genSymbols – list with symbols of generators
fleetUC – 2d list with gen fleet
onOffInitial – (list) initial status of generator (on/off)
genAboveMinInitial – (list) initial state of generation above minimum for each generator
mdtCarriedInitial – (list) initial state of min down time for each generator
scaleMWtoGW – (float) scaling factor MW to GW
-
getInitialCondsDict
(fleetUC, initialCondValues, *scalar)¶ Create dictionary with initial conditions for individual generators for UC run
- Parameters
fleetUC – 2d list with gen fleet
initialCondValues – (1d list) values of intial conditions (same order of gen fleet)
scalar – (float) scaling factor
- Returns
(dict) {gen symbol: value}
-
addEguEligibleToProvideRes
(db, fleetUC, genSet, genSymbols, *stoMarket)¶ Which generators are eligible to provide reserves
Add parameter for which existing generators can provide flex, cont, or reg reserves
- Parameters
db – gams data base object
fleetUC – 2d list with gen fleet
genSet – gams set object with existing generators
genSymbols – list with symbols of generators
stoMarket –
-
getEligibleSpinDict
(fleetOrTechsData, fleetOrTechsFlag, *stoMktOrPtCurt)¶ Returns dict of whether units can provide spin reserves or not based on the plant type
- Parameters
fleetOrTechsData –
fleetOrTechsFlag –
stoMktOrPtCurt –
- Returns
-
addCostNonservedEnergy
(db, cnse, scaleMWtoGW, scaleDollarsToThousands)¶ Add cost of CNSE
- Parameters
db – GAMS database object
cnse – value of cost of non served energy ($/MWh)
scaleMWtoGW – conversion factor MW to GW
scaleDollarsToThousands – conversion factor to thousands dollars
-
addCo2Price
(db, co2Price, scaleDollarsToThousands)¶ Add CO2 price
- Parameters
db – GAMS database object
co2Price – value of CO2 price ($/MWh)
scaleDollarsToThousands – conversion factor to thousands dollars
-
add0dParam
(db, paramName, paramDescrip, paramValue)¶ Generic function to add a scalar (0-dimension) parameter to database
- Parameters
db – gams database object
paramName – (string) name of parameter
paramDescrip – (string) description of parameter
paramValue – (float) value of parameter
-
add1dParam
(db, paramDict, idxSet, setSymbols, paramName, paramDescrip)¶ Generic function to add a 1-dimensional (vector) parameter to database
- Parameters
db – gams database object
paramDict – simple dictionary with data.
idxSet – gams set object of domain of parameter array
setSymbols – (list) list with symbol names
paramName – (string) name of parameter
paramDescrip – (string) description of parameter
- Returns
gams parameter object created
-
add2dParam
(db, param2dDict, idxSet1, idxSet2, paramName, paramDescrip)¶ Generic function to add a 2-dimensional (matrix) parameter to database
- Parameters
db – gams database object
param2dDict – dictionary with data. keys are a tuple (key1, key2)
idxSet1 – gams set object of first domain of parameter array
idxSet2 – gams set object of second domain of parameter array
paramName – (string) name of parameter
paramDescrip – (string) description of parameter
- Returns
gams parameter object created
-
add_NdParam
(db, paramDict, list_idxSet, paramName, paramDescrip)¶ Generic function to add a N-dimensional parameter to database
paramDict is a simple dictionary (it MUST NOT BE a nested dictionary). See function ‘nested_dict_to_dict()’ to convert a nested dictionary into a simple dictionary where the key is a tuple with combination of nested keys
- Parameters
db – gams database object
paramDict – simple dictionary with data. keys must be a tuple with N values
list_idxSet – 1d list of size N with GAMS sets for domain of parameters (must be in the correct orders)
paramName – (string) name of parameter
paramDescrip – (string) description of parameter
- Returns
gams parameter object
-
createGenSymbol
(row, headers)¶ Create gen symbols
- Parameters
row – row of genFleet 2d list with data of single generator
headers – list of headers
- Returns
string with gen code
-
createTechSymbol
(row, headers, ptCurtailed)¶ Create cooling tech symbols
- Parameters
row – row of genFleet 2d list with data of single generator
headers – 1-d list with header
ptCurtailed – 1-d list with curtailed technologies
- Returns
string with symbol
-
separateGenSymbol
(genSymbol)¶ Split generator symbol into plant code and unit code
- Parameters
genSymbol – string with gen symbol
- Returns
tuple with strings of plant code and unit code
-
getTechFromTechSymbol
(techSymbol)¶ Get tech type from tech symbol
- Parameters
techSymbol – string with tech symbol
- Returns
string with tech type
-
getTechAndCoolFromTechSymbol
(techSymbol)¶ Get tech and cooling types from tech symbol
- Parameters
techSymbol – string with tech symbol
- Returns
tuple with string of tech name and cooling type
-
createZoneSymbol
(zoneNum)¶ create zone symbol for GAMS (z1, z2,, …)
- Parameters
zoneNum – number of zone
- Returns
string with zone symbol
-
getZoneNumFromSymbol
(symbol)¶ Get zone number from zone symbol
note that this function only works for up to 9 zones (it assumes zone number is one digit)
- Parameters
symbol – string with zone symbol (z1, z2, …)
- Returns
integer with number of zone
-
createHourSymbol
(hour)¶ create hour of the year symbol for GAMS (h1, h2, h744, h8760, …)
- Parameters
hour – integer with hour of the year
- Returns
string with hour symbol
-
createTechAndLocLabel
(tech, loc)¶ create tech and location symbol for GAMS
if modify this function, modify next function!
- Parameters
tech –
loc –
- Returns
-
splitTechAndLocLabel
(label)¶ split string with label of tech and location into tuple
if modify this function, modify prior function!
- Parameters
label – label if tech and location candidate
- Returns
tuple with strings of tech and location
-
extract0dVarResultsFromGAMSModel
(gamsModel, varName)¶ Extract results from GAMS of variable of dimension 0 (scalar)
Reads resulting GAMS model and extracts values of variable varName
- Parameters
gamsModel – GAMS model object
varName – string with variable name
- Returns
value of variable
-
extract1dVarResultsFromGAMSModel
(modelResults, varName)¶ Extract results from GAMS of variable of dimension 1 (vector)
Reads resulting GAMS model and extracts values of variable varName
- Parameters
modelResults – GAMS model object
varName – string with variable name
- Returns
list with value of variable
-
extract2dVarResultsIntoDict
(modelResults, varName)¶ Extract results from GAMS of variable of dimension 2 (2d array)
Reads resulting GAMS model and extracts values of variable varName and saves to dictionary
- Parameters
modelResults – GAMS model object
varName – string with variable name
- Returns
dict with value of variable
-
extract2dVarResultsIntoList
(modelResults, varName)¶ Extract results from GAMS of variable of dimension 2 (2d array)
Reads resulting GAMS model and extracts values of variable varName and saves to 2d list
- Parameters
modelResults – GAMS model object
varName – string with variable name
- Returns
2d list with value of variable
-
extractTechBuildResults
(modelResults, varName)¶ Extracts Tech build results
- Parameters
modelResults – GAMS model object
varName – string with variable name
- Returns
2d list with value of variable
-
extract2dVarResultsIntoDictNoLA
(modelResults, varName, hoursOpt)¶ Extract results of 2d variable
- Parameters
modelResults – GAMS model object
varName – string with variable name
hoursOpt – list with hours of optimization simulation
- Returns
dictionary with results {(gen,hour): value}