Skip to content

Commit fb2fbca

Browse files
committed
adjusts io.jl to the merge
1 parent c4b1b0c commit fb2fbca

File tree

1 file changed

+0
-120
lines changed

1 file changed

+0
-120
lines changed

src/io.jl

Lines changed: 0 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,7 @@ function Params(DataInput_path::AbstractString, Instances_path::AbstractString)
6666

6767
for n in N
6868
# Load node values from CSV files.
69-
<<<<<<<
70-
df = CSV.File(joinpath(Data_path, "nodes", "$n.csv")) |> DataFrame
71-
capacitydf = CSV.File(joinpath(Data_path, "capacity.csv")) |> DataFrame
72-
=======
7369
nodes = CSV.File(joinpath(Instances_path, "nodes", "$n.csv")) |> DataFrame
74-
>>>>>>>
7570
for g in G
7671
line_search = findfirst((gen_capacity.gen_tech .== g) .& (gen_capacity.node .== n))
7772
Gmin_gn[g,n] = gen_capacity.gcap_min[line_search]
@@ -102,11 +97,7 @@ function Params(DataInput_path::AbstractString, Instances_path::AbstractString)
10297
τ_t = clust_weights.Weights[T]
10398

10499
# Load technology parameters
105-
<<<<<<<
106-
technology = joinpath(Data_path, "technology.csv") |>
107-
=======
108100
gen_technology = joinpath(Instances_path, "gen_technology.csv") |>
109-
>>>>>>>
110101
CSV.File |> DataFrame
111102
I_g = equivalent_annual_cost.(gen_technology.investment_cost .* 1000, gen_technology.lifetime,
112103
interest_rate) |> Array{AbstractFloat, 1}
@@ -119,9 +110,6 @@ function Params(DataInput_path::AbstractString, Instances_path::AbstractString)
119110
technology_g = gen_technology.name
120111

121112
# Load transmission parameters
122-
<<<<<<<
123-
transmission = joinpath(Data_path, "transmission.csv") |>
124-
=======
125113
I_l = zeros(length(L_ind))
126114
M_l = zeros(length(L_ind))
127115
C_l = zeros(length(L_ind))
@@ -130,7 +118,6 @@ function Params(DataInput_path::AbstractString, Instances_path::AbstractString)
130118
Tmin_l = zeros(length(L_ind))
131119
Tmax_l = zeros(length(L_ind))
132120
transmission = joinpath(Instances_path, "transmission.csv") |>
133-
>>>>>>>
134121
CSV.File |> DataFrame
135122
I_l = equivalent_annual_cost.(transmission.cost[1] .* transmission.dist .+ transmission.converter_cost[1],
136123
transmission.lifetime[1], interest_rate) |> Array{AbstractFloat, 1}
@@ -142,80 +129,13 @@ function Params(DataInput_path::AbstractString, Instances_path::AbstractString)
142129
Tmax_l = transmission.tcap_max |> Array{AbstractFloat, 1}
143130

144131
# Load storage parameters
145-
<<<<<<<
146-
storage = joinpath(Data_path, "storage.csv") |>
147-
=======
148132
ξ_s = zeros(length(S))
149133
I_s = zeros(length(S))
150134
C_s = zeros(length(S))
151135
Smin_sn = zeros(length(S),length(N))
152136
Smax_sn = zeros(length(S),length(N))
153137
storage = joinpath(Instances_path, "storage.csv") |>
154-
>>>>>>>
155138
CSV.File |> DataFrame
156-
<<<<<<<
157-
ξ_s = storage.xi
158-
I_s = equivalent_annual_cost.(storage.cost .* 1000, storage.lifetime, interest_rate)
159-
C_s = storage.C
160-
b0_sn = storage[:, [Symbol("b0_$n") for n in N]] |> Matrix
161-
162-
# Return Params struct
163-
Params(
164-
region_n, technology_g, G, G_r, N, L, T, S, κ, μ, C, C̄, C_E, R_E, τ, τ_t, Q_gn, Q̄_gn, A_gnt, D_nt, I_g, M_g, C_g,
165-
e_g, E_g, r⁻_g, r⁺_g, I_l, M_l, C_l, B_l, e_l, ξ_s, I_s, C_s, b0_sn,
166-
W_nmax, W_nmin, f_int, f′_int, H_n, H′_n, F_onmin)
167-
end
168-
169-
170-
## Params for large Instance
171-
172-
function Params(Data_path::AbstractString)
173-
# Load indexes and constant parameters
174-
indices = JSON.parsefile(joinpath(Data_path, "IndicesComplete.json"))
175-
176-
# TODO: implement time period clustering: τ, T, τ_t
177-
178-
# Load indices. Convert JSON values to right types.
179-
G = indices["G"] |> Array{Int}
180-
G_r = indices["G_r"] |> Array{Int}
181-
N = indices["N"] |> Array{Int}
182-
L = indices["L"] |> Array{Array{Int}}
183-
τ = 1
184-
T = 1:indices["T"]
185-
S = indices["S"] |> Array{Int}
186-
187-
# Load constant parameters
188-
constants = JSON.parsefile(joinpath(Data_path, "constants.json"))
189-
κ = constants["kappa"]
190-
μ = constants["mu"]
191-
C = constants["C"]
192-
= constants["C_bar"]
193-
C_E = constants["C_E"]
194-
interest_rate = constants["r"]
195-
R_E = constants["R_E"]
196-
197-
# Load time clustered parameters
198-
τ_t = ones(length(T))
199-
Q_gn = zeros(length(G), length(N))
200-
Q̄_gn = zeros(length(G), length(N))
201-
D_nt = zeros(length(N), length(T))
202-
A_gnt = ones(length(G), length(N), length(T))
203-
W_nmax = zeros(length(N))
204-
W_nmin = zeros(length(N))
205-
f_int = zeros(length(N), length(T))
206-
f′_int = zeros(length(N), length(T))
207-
H_n = zeros(length(N))
208-
H′_n = zeros(length(N))
209-
F_onmin = zeros(length(N))
210-
region_n = Array{AbstractString, 1}(undef, length(N))
211-
for n in N
212-
# Load node values from CSV files.
213-
df = CSV.File(joinpath(Data_path, "nodes", "$n.csv")) |> DataFrame
214-
capacitydf = CSV.File(joinpath(Data_path, "capacity.csv")) |> DataFrame
215-
for g in G
216-
Q_gn[g, n] = capacitydf[n, g+1]
217-
Q̄_gn[g, n] = capacitydf[n, g+13]
218-
=======
219139
sto_capacity = joinpath(Instances_path, "sto_capacity.csv") |>
220140
CSV.File |> DataFrame
221141
for s in S
@@ -226,46 +146,19 @@ function Params(Data_path::AbstractString)
226146
line_search = findfirst((sto_capacity.s .== s) .& (sto_capacity.node .== n))
227147
Smin_sn[s,n] = sto_capacity.scap_min[line_search]
228148
Smax_sn[s,n] = sto_capacity.scap_max[line_search]
229-
>>>>>>>
230149
end
231150
end
232151
Smin_sn = Smin_sn |> Array{AbstractFloat, 2}
233152
Smax_sn = Smax_sn |> Array{AbstractFloat, 2}
234153

235-
<<<<<<<
236-
# Load technology parameters
237-
technology = joinpath(Data_path, "technology.csv") |>
238-
CSV.File |> DataFrame
239-
I_g = equivalent_annual_cost.(technology.investment_cost .* 1000, technology.lifetime,
240-
interest_rate)
241-
M_g = technology.fixedOM .* 1000
242-
C_g = technology.fuel_cost ./ technology.efficiency .+ technology.varOM
243-
e_g = technology.efficiency
244-
E_g = technology.emissions
245-
r⁻_g = technology.r_minus
246-
r⁺_g = technology.r_plus
247-
technology_g = technology.name
248-
=======
249154
# Load hydro capacity and technology parameters
250155
Wmax_hn = zeros(length(H),length(N))
251156
Wmin_hn = zeros(length(H),length(N))
252157
Hmin_hn = zeros(length(H),length(N))
253158
Hmax_hn = zeros(length(H),length(N))
254159
Fmin_n = zeros(length(N))
255160
HRmax_n = zeros(length(N))
256-
>>>>>>>
257161

258-
<<<<<<<
259-
# Load transmission parameters
260-
transmission = joinpath(Data_path, "transmission.csv") |>
261-
CSV.File |> DataFrame
262-
I_l = equivalent_annual_cost.(transmission.cost[1] .* transmission.dist .+ transmission.converter_cost[1],
263-
transmission.lifetime[1], interest_rate)
264-
M_l = transmission.M[1] .* I_l
265-
C_l = transmission.C[1]
266-
B_l = transmission.B[1]
267-
e_l = transmission.efficiency[1]
268-
=======
269162
hydro_capacity = joinpath(Instances_path, "hydro_capacity.csv") |> CSV.File |> DataFrame
270163
for h in H, n in N
271164
line_search = findfirst((hydro_capacity.hydro_tech .== h) .& (hydro_capacity.node .== n))
@@ -274,23 +167,11 @@ function Params(Data_path::AbstractString)
274167
Wmin_hn[h,n] = hydro_capacity.wcap_min[line_search]
275168
Wmax_hn[h,n] = hydro_capacity.wcap_max[line_search]
276169
end
277-
>>>>>>>
278170

279171
hydro = joinpath(Instances_path, "hydro.csv") |> CSV.File |> DataFrame
280172
HRmax_n[1:length(N)] = hydro.HydroRoR[1:length(N)] |> Array{AbstractFloat, 1}
281173
Fmin_n[1:length(N)] = hydro.hyd_flow_min[1:length(N)] |> Array{AbstractFloat, 1}
282174

283-
<<<<<<<
284-
285-
# Load storage parameters
286-
storage = joinpath(Data_path, "storage.csv") |>
287-
CSV.File |> DataFrame
288-
ξ_s = storage.xi
289-
I_s = equivalent_annual_cost.(storage.cost .* 1000, storage.lifetime, interest_rate)
290-
C_s = storage.C
291-
b0_sn = storage[:, [Symbol("b0_$n") for n in N]] |> Matrix
292-
293-
=======
294175
hydro_technology = joinpath(Instances_path, "hydro_technology.csv") |> CSV.File |> DataFrame;
295176
I_h = equivalent_annual_cost.(hydro_technology.investment_cost .* 1000, hydro_technology.lifetime,
296177
interest_rate) |> Vector{Float64}
@@ -301,7 +182,6 @@ function Params(Data_path::AbstractString)
301182
r⁻_h = hydro_technology.r_minus |> Vector{Float64}
302183
r⁺_h = hydro_technology.r_plus |> Vector{Float64}
303184

304-
>>>>>>>
305185
# Return Params struct
306186
Params(
307187
region_n, max_dem_n, technology_g, G, G_r, N, L, L_ind, T, S, H, κ, μ, C, C̄, C_E, R_E, τ_t, Gmin_gn, Gmax_gn, A_gnt, D_nt, I_g, M_g, C_g,

0 commit comments

Comments
 (0)