Methods

The primary method for using REopt is the run_reopt method. In the simplest there are two required inputs to run_reopt: a JuMP.Model with an optimizer and the path to a JSON file to define the Scenario. Other methods for run_reopt are enumerated below. Other methods such as build_reopt! are also described to allow users to build custom REopt models. For example, after using build_reopt! a user could add constraints or change the objective function using JuMP commands.

run_reopt

REoptLite.run_reoptFunction
run_reopt(m::JuMP.AbstractModel, fp::String)

Solve the model using the Scenario defined in JSON file stored at the file path fp.

source
run_reopt(m::JuMP.AbstractModel, d::Dict)

Solve the model using the Scenario defined in dict d.

source
run_reopt(m::JuMP.AbstractModel, s::AbstractScenario)

Solve the model using a Scenario or BAUScenario.

source
run_reopt(t::Tuple{JuMP.AbstractModel, AbstractScenario})

Method for use with Threads when running BAU in parallel with optimal scenario.

source
run_reopt(ms::AbstractArray{T, 1}, fp::String) where T <: JuMP.AbstractModel

Solve the Scenario and BAUScenario in parallel using the first two (empty) models in ms and inputs defined in the JSON file at the filepath fp.

source
run_reopt(ms::AbstractArray{T, 1}, d::Dict) where T <: JuMP.AbstractModel

Solve the Scenario and BAUScenario in parallel using the first two (empty) models in ms and inputs from d.

source
run_reopt(ms::AbstractArray{T, 1}, p::REoptInputs) where T <: JuMP.AbstractModel

Solve the Scenario and BAUScenario in parallel using the first two (empty) models in ms and inputs from p.

source

build_reopt!

REoptLite.build_reopt!Function
build_reopt!(m::JuMP.AbstractModel, fp::String)

Add variables and constraints for REopt model. fp is used to load in JSON file to construct REoptInputs.

source
build_reopt!(m::JuMP.AbstractModel, p::REoptInputs)

Add variables and constraints for REopt model.

source

simulate_outages

REoptLite.simulate_outagesFunction
simulate_outages(;batt_kwh=0, batt_kw=0, pv_kw_ac_hourly=[], init_soc=[], critical_loads_kw=[], 
    wind_kw_ac_hourly=[], batt_roundtrip_efficiency=0.829, diesel_kw=0, fuel_available=0, b=0, m=0, 
    diesel_min_turndown=0.3
)

Time series simulation of outages starting at every time step of the year. Used to calculate how many time steps the critical load can be met in every outage, which in turn is used to determine probabilities of meeting the critical load.

Arguments

  • batt_kwh: float, battery storage capacity
  • batt_kw: float, battery inverter capacity
  • pv_kw_ac_hourly: list of floats, AC production of PV system
  • init_soc: list of floats between 0 and 1 inclusive, initial state-of-charge
  • critical_loads_kw: list of floats
  • wind_kw_ac_hourly: list of floats, AC production of wind turbine
  • batt_roundtrip_efficiency: roundtrip battery efficiency
  • diesel_kw: float, diesel generator capacity
  • fuel_available: float, gallons of diesel fuel available
  • b: float, diesel fuel burn rate intercept coefficient (y = mx + brated_capacity) [gal/kwh/kw]
  • m: float, diesel fuel burn rate slope (y = mx + brated_capacity) [gal/kWh]
  • diesel_min_turndown: minimum generator turndown in fraction of generator capacity (0 to 1)

Returns a dict

    "resilience_by_timestep": vector of time steps that critical load is met for outage starting in every time step,
    "resilience_hours_min": minimum of "resilience_by_timestep",
    "resilience_hours_max": maximum of "resilience_by_timestep",
    "resilience_hours_avg": average of "resilience_by_timestep",
    "outage_durations": vector of integers for outage durations with non zero probability of survival,
    "probs_of_surviving": vector of probabilities corresponding to the "outage_durations",
    "probs_of_surviving_by_month": vector of probabilities calculated on a monthly basis,
    "probs_of_surviving_by_hour_of_the_day":vector of probabilities calculated on a hour-of-the-day basis,
}
source
simulate_outages(d::Dict, p::REoptInputs; microgrid_only::Bool=false)

Time series simulation of outages starting at every time step of the year. Used to calculate how many time steps the critical load can be met in every outage, which in turn is used to determine probabilities of meeting the critical load.

Arguments

  • d::Dict from reopt_results
  • p::REoptInputs the inputs that generated the Dict from reopt_results
  • microgrid_only::Bool whether or not to simulate only the optimal microgrid capacities or the total capacities. This input is only relevant when modeling multiple outages.

Returns a dict

{
    "resilience_by_timestep": vector of time steps that critical load is met for outage starting in every time step,
    "resilience_hours_min": minimum of "resilience_by_timestep",
    "resilience_hours_max": maximum of "resilience_by_timestep",
    "resilience_hours_avg": average of "resilience_by_timestep",
    "outage_durations": vector of integers for outage durations with non zero probability of survival,
    "probs_of_surviving": vector of probabilities corresponding to the "outage_durations",
    "probs_of_surviving_by_month": vector of probabilities calculated on a monthly basis,
    "probs_of_surviving_by_hour_of_the_day":vector of probabilities calculated on a hour-of-the-day basis,
}
source