Purpose

This section provides guidance for developers to create and maintain policy files that change electric generation inputs in ENERGY 2100. Covers file placement, coding pattern, common datasets to modify, examples, testing, and troubleshooting.

Types of Electric Utility Generation Policies

  • Modify renewable generation goals
  • Specify fixed amounts of energy transfers between areas through contracts
  • Limit or increase flows and/or costs across transmission lines
  • Activate offset requirements for generating units
  • Modify characteristics of generating units (retirement year, outage rate, generating costs, etc.)
  • Modify capacity expansion/build rules
  • Modify characteristics of plant types as a whole (differentiated from individual units)
  • Establish GHG performance goals 

Where to put a policy file

  • Folder: C:\2100ModelName\Policy
  • Naming convention: Electric_<PolicyName>_<Region>.jl
  • Add the file to a policy aggregator file (e.g. Ref25.jl) when ready


High‑level pattern (read → modify → write)

  1. Read sets/variables using ReadDisk (or Select helpers).
  2. Modify values in memory.
  3. Write changes back with WriteDisk.


Minimal policy file template

Key points:

  • Import only required helpers: ReadDisk, WriteDisk, Select, etc.
  • Create function to make changes to desired policy variables
  • Create PolicyControl() function that calls policy changes

div class="html-code-box">

#
# Electric_[PolicyName]_[Region].jl
#
# Brief description of policy objectives and data sources
#

using EnergyModel

module [Policy_Electric_Template]

import ...EnergyModel: ReadDisk,WriteDisk,Select,Zero
import ...EnergyModel: HisTime,ITime,MaxTime,First,Future,Final,Yr
import ...EnergyModel: @finite_math
import ...EnergyModel: DB

const VariableArray{N} = Array{Float32,N} where {N}
const SetArray = Vector{String}

Base.@kwdef struct [Control]
  db::String
  
  #
  # Define dimension sets
  #  
  Area::SetArray = ReadDisk(db,"MainDB/AreaKey")
  Areas::Vector{Int} = collect(Select(Area))
  Unit::SetArray = ReadDisk(db,"MainDB/UnitKey")
  Units::Vector{Int} = collect(Select(Unit))
  Year::SetArray = ReadDisk(db,"MainDB/YearKey")
  Years::Vector{Int} = collect(Select(Year))
  # ... other dimensions
  
  # Load data variables:
  UnCode::Array{String} = ReadDisk(db,"EGInput/UnCode") # [Unit] Unit Code
  UnNode::Array{String} = ReadDisk(db,"EGInput/UnNode") # [Unit] Transmission Node
  UnOnLine::VariableArray{1} = ReadDisk(db,"EGInput/UnOnLine") # [Unit] On-Line Date (Year)
  # ... other data as needed

end

function [PolicyName](db)
  data = [Control](; db)
  (; Unit,Units) = data
  (; UnOnLine) = data
 
  # TODO: apply transformations to policy variables using explicit indexing

end
 
end # module Policy_Electric_Template
unction PolicyControl(db)
  @info("[PolicyName] PolicyControl function called")
  
  [PolicyName](db)  # Call to function that modifies the policy variable(s)
  
  @info("Policy executed successfully")
end

if abspath(PROGRAM_FILE) == @__FILE__
  PolicyControl(DB)
end