From 3d0453b9b0d5b2cbba20b6821b3d4586606beb5c Mon Sep 17 00:00:00 2001 From: "xuqingyu0610@gmail.com" Date: Mon, 23 Oct 2023 10:49:07 +0800 Subject: [PATCH] modify genx so that it can be run on Tsinghua Desktop --- Project.toml | 14 +++----------- src/GenX.jl | 6 +++--- src/load_inputs/load_generators_variability.jl | 14 +++++++++++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Project.toml b/Project.toml index 32500715aa..8f2d4598a8 100644 --- a/Project.toml +++ b/Project.toml @@ -4,18 +4,16 @@ authors = ["Jesse Jenkins", "Nestor Sepulveda", "Dharik Mallapragada", "Aaron Sc version = "0.3.1" [deps] -BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" +CPLEX = "a076750e-1247-5638-91d2-ce28b192dca0" CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" Cbc = "9961bab8-2fa3-5c5a-9d89-47fab24efd76" Clp = "e2554f3b-3117-50c0-817c-e040a3ddf72d" Clustering = "aaaa29a8-35af-508c-8bc3-b662a17a0fe5" Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" -#CPLEX = "a076750e-1247-5638-91d2-ce28b192dca0" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7" -#Gurobi = "2e9cd046-0924-5485-92f1-d5272153d98b" HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b" JuMP = "4076af6c-e467-56ae-b986-b466b2749572" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" @@ -23,31 +21,25 @@ MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" -SCIP = "82193955-e24f-5292-bf16-6f2c5261a85f" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6" [compat] -BenchmarkTools = "1.3.1" CSV = "0.10.4" Cbc = "1.0.1" Clp = "1.0.1" -Clustering = "0.14.2" +Clustering = "0.14.2, 0.15" Combinatorics = "1.0.2" -#CPLEX ="0.6.1" DataFrames = "1.3.4" DataStructures = "0.18.13" Distances = "0.10.7" -#Gurobi ="0.9.14" HiGHS = "1.1.4" JuMP = "1.1.1" MathOptInterface = "1.6.1" -OrdinaryDiffEq = "6.20.0" RecursiveArrayTools = "2.31.2" -SCIP = "0.11.3" Statistics = "1.4.0" -StatsBase = "0.33.21" +StatsBase = "0.33.21, 0.34" YAML = "0.4.7" julia = "1" diff --git a/src/GenX.jl b/src/GenX.jl index c80d11e3d9..1c41192f8f 100644 --- a/src/GenX.jl +++ b/src/GenX.jl @@ -47,19 +47,19 @@ using Clustering using Distances using Combinatorics -using OrdinaryDiffEq +# using OrdinaryDiffEq using Random using RecursiveArrayTools using Statistics # Uncomment if Gurobi or CPLEX active license and installations are there and the user intends to use either of them -#using CPLEX +using CPLEX #using Gurobi #using CPLEX #using MOI #using SCIP -using BenchmarkTools +# using BenchmarkTools using HiGHS using Clp using Cbc diff --git a/src/load_inputs/load_generators_variability.jl b/src/load_inputs/load_generators_variability.jl index 2e15eb8bae..fcb8456cbb 100755 --- a/src/load_inputs/load_generators_variability.jl +++ b/src/load_inputs/load_generators_variability.jl @@ -31,12 +31,20 @@ function load_generators_variability(setup::Dict, path::AbstractString, inputs_g end # Reorder DataFrame to R_ID order (order provided in Generators_data.csv) - select!(gen_var, [:Time_Index; Symbol.(inputs_genvar["VARIABILITY"])]) + variability_names = inputs_genvar["VARIABILITY"] + existing_variability = names(gen_var) + temp = zeros(inputs_genvar["T"], inputs_genvar["G"]) + for g = 1: inputs_genvar["G"] + r = variability_names[g] + location = findfirst(x -> x == r, existing_variability) + temp[:, g] = Vector{Float64}(gen_var[:, location]) + end + # temp = select(gen_var, [:Time_Index; Symbol.(inputs_genvar["VARIABILITY"])]) # Maximum power output and variability of each energy resource - inputs_genvar["pP_Max"] = transpose(Matrix{Float64}(gen_var[1:inputs_genvar["T"],2:(inputs_genvar["G"]+1)])) + inputs_genvar["pP_Max"] = transpose(temp) + return inputs_genvar println("Generators_variability.csv Successfully Read!") - return inputs_genvar end