-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reopt_jl: updates for filepath safety, updates to README
- Loading branch information
1 parent
a0add90
commit 50737bf
Showing
4 changed files
with
77 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,21 +3,21 @@ omf.solvers.reopt_jl | |
Solver for Julia verison of REopt. | ||
|
||
# Dependencies: | ||
- [email protected] (other versions of python3 may work) | ||
- [email protected].7 (other versions may require you to downgrade PyCall) | ||
- packages installed in install_reopt_jl() ( runs automatically within run_reopt_jl ) | ||
- julia (1.9.4) | ||
- PyJulia (0.6.1) | ||
- packages within REoptSolver/Project.toml ( should be installed by Project.toml & Manifest.tomnl ) | ||
- REopt@0.32.7 | ||
- JuMP@1.13.0 | ||
- [email protected].2 | ||
- packages within REoptSolver/Project.toml ( installed by Project.toml & Manifest.tomnl ) | ||
- REopt@0.39.0 | ||
- JuMP@1.17.0 | ||
- [email protected].5 | ||
- JSON (0.21.4) | ||
- PyCall (1.96.1) | ||
- PackageCompiler (2.1.10) | ||
- PyCall (1.96.4) | ||
- PackageCompiler (2.1.15) | ||
|
||
# Building REoptSolver Julia module: | ||
(avoid doing this unless the package change is necessary for REoptSolver to run) | ||
* Project.toml & Mainfest.toml are included in /REoptSolver but can be modified with the following: | ||
* Project.toml & Manifest.toml are included in /REoptSolver but can be modified with the following: | ||
``` | ||
~/omf/omf/solvers/reopt_jl % julia | ||
julia> ] | ||
|
@@ -32,21 +32,24 @@ julia> ] | |
# Usage: | ||
``` | ||
__init__.py: | ||
-> run_reopt_jl(path, inputFile="", default=False, convert=True, outages=False, microgrid_only=False, max_runtime_s=None) | ||
-> run_reopt_jl(path, inputFile="", default=False, outages=False, microgrid_only=False, max_runtime_s=None, run_with_sysimage=True) | ||
``` | ||
|
||
General paramters: | ||
- path: directory containing inputFile ; output files written here as well | ||
- inputFile: json file containing REopt API input information | ||
- if this file is not converted for REopt.jl -> set convert=True | ||
- loadFile: csv load file for the given input file | ||
- if empty: assumes that the csv load path within inputFile is already set | ||
- otherwise: the path is set to path/loadFile | ||
- outages: if True, runs outage simulation, otherwise doesn't | ||
- microgrid_only: if True runs without grid, otherwise runs as normal | ||
*only used within REopt.jl currently (not API) | ||
- max_runtime_s: default is None, otherwise times out after given number of seconds and returns local optimal value (may not be the global optimum) | ||
- run_with_sysimage: if True, runs with reopt_jl.so (builds beforehand if necessary), otherwise runs by loading REoptSolver project | ||
|
||
Testing parameters: | ||
- default: if True, sets inputFile to default values found in julia_default.json, uses given inputFile otherwise | ||
- convert: if True, converts variables names to those used in REopt.jl, no conversion otherwise | ||
|
||
Examples: | ||
``` | ||
|
@@ -64,23 +67,3 @@ uses julia_default.json as input and writes ouput file from REopt.jl to "current | |
``` | ||
writes ouput file from REopt.jl to "currentDir/results.json" and | ||
writes outage output fie to "currentDir/resultsResilience.json" | ||
|
||
# Testing usage: | ||
``` | ||
__init__.py: | ||
-> runAllSolvers(path, testName, fileName="", default=False, convert=True, outages=True, solvers=["SCIP","HiGHS"], max_runtime_s=None, get_cached=True ) | ||
``` | ||
|
||
Usage: simlar to run_reopt_jl but takes in list of solvers and runs each one on the given test case ; prints out runtime comparisons | ||
- The list of available solvers is currently limited to HiGHS to reduce compile time | ||
|
||
Inputs: | ||
- path : run_reopt_jl path | ||
- testName : name used to identify test case | ||
- fileName : run_reopt_jl inputFile | ||
- default : run_reopt_jl default | ||
- convert : run_reopt_jl convert | ||
- outages : run_reopt_jl outages | ||
- solvers : list of solvers to call run_reopt_jl with | ||
|
||
test_outputs.py => DEPRECATED (can be found in REopt_replacements in wiires repository but needs updates to function) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
using JSON | ||
using Base.Filesystem | ||
|
||
include("REoptSolver/src/REoptSolver.jl") #joinpath(@__DIR__, | ||
include(normpath(joinpath("REoptSolver","src","REoptSolver.jl"))) #joinpath(@__DIR__, | ||
|
||
function test() | ||
json_data = JSON.parsefile(joinpath(@__DIR__, "julia_default.json")) | ||
json_data["ElectricLoad"]["path_to_csv"] = joinpath(@__DIR__,"testFiles/loadShape.csv") | ||
json_data = JSON.parsefile(normpath(joinpath(string(@__DIR__), "testFiles","julia_default.json"))) | ||
json_data["ElectricLoad"]["path_to_csv"] = normpath(joinpath(string(@__DIR__),"testFiles","loadShape.csv")) | ||
|
||
open(joinpath(@__DIR__, "testFiles/Scenario_test_POST.json"), "w") do file | ||
open(normpath(joinpath(string(@__DIR__), "testFiles","Scenario_test_POST.json")), "w") do file | ||
JSON.print(file, json_data) | ||
end | ||
REoptSolver.run(joinpath(@__DIR__,"testFiles"), true) | ||
REoptSolver.run(normpath(joinpath(string(@__DIR__),"testFiles")), true) | ||
end | ||
|
||
test() |