-
Notifications
You must be signed in to change notification settings - Fork 28
Jf/set initial param levels #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
juflorez
wants to merge
17
commits into
main
Choose a base branch
from
jf/set_initial_param_levels
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
90b4039
add initial level setting func
f42e42a
update tests
2b4ce69
add file reading/writing v1-need to fix versioning
2ec905b
add versioning structure for soc reading
75728a5
update tests for prior versioning compat
fe3967b
update gitignore for versioned toy test
fa98b67
add docs for new optional soc
0f090db
fix indexing bug
de95c67
fix file test fpath
d690c53
fix syntax
6b1aed4
remove confusing comments
398f73a
update details in systemmodel hdf5
75a58b9
clarify writing method for 0_8_1
413119c
fix writing demandresponses bug
b5c4c9f
fix writing demandresponses bug follow on
2458a02
fix docstring format
3550896
round initial values to Ints
juflorez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -178,6 +178,8 @@ A struct representing storage devices in the system. | |
| - `μ` (repair probability): Probability the unit transitions from forced outage to | ||
| operational during a given simulation timestep, for each storage unit in each | ||
| timeperiod. Unitless. | ||
| - `initial_soc`: Optional keyword for initial state of charge as a fraction [0,1.0] of `energy_capacity` at first timestep for | ||
| each storage unit at the beginning of the simulation. Default is zero. | ||
| """ | ||
| struct Storages{N,L,T<:Period,P<:PowerUnit,E<:EnergyUnit} <: AbstractAssets{N,L,T,P} | ||
|
|
||
|
|
@@ -195,12 +197,15 @@ struct Storages{N,L,T<:Period,P<:PowerUnit,E<:EnergyUnit} <: AbstractAssets{N,L, | |
| λ::Matrix{Float64} | ||
| μ::Matrix{Float64} | ||
|
|
||
| initial_soc::Vector{Float64} # energy | ||
|
|
||
| function Storages{N,L,T,P,E}( | ||
| names::Vector{<:AbstractString}, categories::Vector{<:AbstractString}, | ||
| chargecapacity::Matrix{Int}, dischargecapacity::Matrix{Int}, | ||
| energycapacity::Matrix{Int}, chargeefficiency::Matrix{Float64}, | ||
| dischargeefficiency::Matrix{Float64}, carryoverefficiency::Matrix{Float64}, | ||
| λ::Matrix{Float64}, μ::Matrix{Float64} | ||
| λ::Matrix{Float64}, μ::Matrix{Float64}; | ||
| initial_soc::Vector{Float64} = zeros(Float64, length(names)) | ||
| ) where {N,L,T,P,E} | ||
|
|
||
| n_stors = length(names) | ||
|
|
@@ -226,10 +231,14 @@ struct Storages{N,L,T<:Period,P<:PowerUnit,E<:EnergyUnit} <: AbstractAssets{N,L, | |
| @assert all(isfractional, λ) | ||
| @assert all(isfractional, μ) | ||
|
|
||
| @assert length(initial_soc) == n_stors | ||
| @assert all(isfractional, initial_soc) | ||
|
|
||
| #order of this is tied to how struct order is defined | ||
| new{N,L,T,P,E}(string.(names), string.(categories), | ||
| chargecapacity, dischargecapacity, energycapacity, | ||
| chargeefficiency, dischargeefficiency, carryoverefficiency, | ||
| λ, μ) | ||
| λ, μ, initial_soc) | ||
|
|
||
| end | ||
|
|
||
|
|
@@ -242,7 +251,8 @@ function Storages{N,L,T,P,E}() where {N,L,T,P,E} | |
| String[], String[], | ||
| zeros(Int, 0, N), zeros(Int, 0, N), zeros(Int, 0, N), | ||
| zeros(Float64, 0, N), zeros(Float64, 0, N), zeros(Float64, 0, N), | ||
| zeros(Float64, 0, N), zeros(Float64, 0, N)) | ||
| zeros(Float64, 0, N), zeros(Float64, 0, N); | ||
| initial_soc = zeros(Float64, 0)) | ||
| end | ||
|
|
||
| Base.:(==)(x::T, y::T) where {T <: Storages} = | ||
|
|
@@ -255,13 +265,15 @@ Base.:(==)(x::T, y::T) where {T <: Storages} = | |
| x.discharge_efficiency == y.discharge_efficiency && | ||
| x.carryover_efficiency == y.carryover_efficiency && | ||
| x.λ == y.λ && | ||
| x.μ == y.μ | ||
| x.μ == y.μ && | ||
| x.initial_soc == y.initial_soc | ||
|
|
||
| Base.getindex(s::S, idxs::AbstractVector{Int}) where {S <: Storages} = | ||
| S(s.names[idxs], s.categories[idxs],s.charge_capacity[idxs,:], | ||
| s.discharge_capacity[idxs, :],s.energy_capacity[idxs, :], | ||
| s.charge_efficiency[idxs, :], s.discharge_efficiency[idxs, :], | ||
| s.carryover_efficiency[idxs, :],s.λ[idxs, :], s.μ[idxs, :]) | ||
| s.carryover_efficiency[idxs, :],s.λ[idxs, :], s.μ[idxs, :]; | ||
| initial_soc = s.initial_soc[idxs]) | ||
|
|
||
| function Base.vcat(stors::Storages{N,L,T,P,E}...) where {N, L, T, P, E} | ||
|
|
||
|
|
@@ -281,6 +293,8 @@ function Base.vcat(stors::Storages{N,L,T,P,E}...) where {N, L, T, P, E} | |
| λ = Matrix{Float64}(undef, n_stors, N) | ||
| μ = Matrix{Float64}(undef, n_stors, N) | ||
|
|
||
| initial_soc = Vector{Float64}(undef, n_stors) | ||
|
|
||
| last_idx = 0 | ||
|
|
||
| for s in stors | ||
|
|
@@ -302,12 +316,15 @@ function Base.vcat(stors::Storages{N,L,T,P,E}...) where {N, L, T, P, E} | |
| λ[rows, :] = s.λ | ||
| μ[rows, :] = s.μ | ||
|
|
||
| initial_soc[rows] = s.initial_soc | ||
|
|
||
| last_idx += n | ||
|
|
||
| end | ||
|
|
||
| return Storages{N,L,T,P,E}(names, categories, charge_capacity, discharge_capacity, energy_capacity, charge_efficiency, discharge_efficiency, | ||
| carryover_efficiency, λ, μ) | ||
| carryover_efficiency, λ, μ; | ||
| initial_soc = initial_soc) | ||
|
|
||
| end | ||
|
|
||
|
|
@@ -351,6 +368,8 @@ A struct representing generator-storage hybrid devices within a power system. | |
| - `μ` (repair probability): Probability the unit transitions from forced outage to | ||
| operational during a given simulation timestep, for each generator-storage unit in each | ||
| timeperiod. Unitless. | ||
| - `initial_soc`: Optional keyword for initial state of charge as a fraction [0.0, 1.0] of | ||
| `energy_capacity` at the first timestep for each storage unit. Default is zero. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. genstor unit* |
||
| """ | ||
| struct GeneratorStorages{N,L,T<:Period,P<:PowerUnit,E<:EnergyUnit} <: AbstractAssets{N,L,T,P} | ||
|
|
||
|
|
@@ -372,6 +391,8 @@ struct GeneratorStorages{N,L,T<:Period,P<:PowerUnit,E<:EnergyUnit} <: AbstractAs | |
| λ::Matrix{Float64} | ||
| μ::Matrix{Float64} | ||
|
|
||
| initial_soc::Vector{Float64} # energy | ||
|
|
||
| function GeneratorStorages{N,L,T,P,E}( | ||
| names::Vector{<:AbstractString}, categories::Vector{<:AbstractString}, | ||
| charge_capacity::Matrix{Int}, discharge_capacity::Matrix{Int}, | ||
|
|
@@ -380,7 +401,8 @@ struct GeneratorStorages{N,L,T<:Period,P<:PowerUnit,E<:EnergyUnit} <: AbstractAs | |
| carryover_efficiency::Matrix{Float64}, | ||
| inflow::Matrix{Int}, | ||
| gridwithdrawal_capacity::Matrix{Int}, gridinjection_capacity::Matrix{Int}, | ||
| λ::Matrix{Float64}, μ::Matrix{Float64} | ||
| λ::Matrix{Float64}, μ::Matrix{Float64}; | ||
| initial_soc::Vector{Float64} = zeros(Float64, length(names)), | ||
| ) where {N,L,T,P,E} | ||
|
|
||
| n_stors = length(names) | ||
|
|
@@ -416,12 +438,15 @@ struct GeneratorStorages{N,L,T<:Period,P<:PowerUnit,E<:EnergyUnit} <: AbstractAs | |
| @assert all(isfractional, λ) | ||
| @assert all(isfractional, μ) | ||
|
|
||
| @assert length(initial_soc) == n_stors | ||
| @assert all(isfractional, initial_soc) | ||
|
|
||
| new{N,L,T,P,E}( | ||
| string.(names), string.(categories), | ||
| charge_capacity, discharge_capacity, energy_capacity, | ||
| charge_efficiency, discharge_efficiency, carryover_efficiency, | ||
| inflow, gridwithdrawal_capacity, gridinjection_capacity, | ||
| λ, μ) | ||
| λ, μ,initial_soc) | ||
|
|
||
| end | ||
|
|
||
|
|
@@ -435,7 +460,7 @@ function GeneratorStorages{N,L,T,P,E}() where {N,L,T,P,E} | |
| zeros(Int, 0, N), zeros(Int, 0, N), zeros(Int, 0, N), | ||
| zeros(Float64, 0, N), zeros(Float64, 0, N), zeros(Float64, 0, N), | ||
| zeros(Int, 0, N), zeros(Int, 0, N), zeros(Int, 0, N), | ||
| zeros(Float64, 0, N), zeros(Float64, 0, N)) | ||
| zeros(Float64, 0, N), zeros(Float64, 0, N); initial_soc = zeros(Float64, 0)) | ||
|
|
||
| end | ||
|
|
||
|
|
@@ -452,15 +477,16 @@ Base.:(==)(x::T, y::T) where {T <: GeneratorStorages} = | |
| x.gridwithdrawal_capacity == y.gridwithdrawal_capacity && | ||
| x.gridinjection_capacity == y.gridinjection_capacity && | ||
| x.λ == y.λ && | ||
| x.μ == y.μ | ||
| x.μ == y.μ && | ||
| x.initial_soc == y.initial_soc | ||
|
|
||
| Base.getindex(g_s::G, idxs::AbstractVector{Int}) where {G <: GeneratorStorages} = | ||
| G(g_s.names[idxs], g_s.categories[idxs], g_s.charge_capacity[idxs,:], | ||
| g_s.discharge_capacity[idxs, :], g_s.energy_capacity[idxs, :], | ||
| g_s.charge_efficiency[idxs, :], g_s.discharge_efficiency[idxs, :], | ||
| g_s.carryover_efficiency[idxs, :],g_s.inflow[idxs, :], | ||
| g_s.gridwithdrawal_capacity[idxs, :],g_s.gridinjection_capacity[idxs, :], | ||
| g_s.λ[idxs, :], g_s.μ[idxs, :]) | ||
| g_s.λ[idxs, :], g_s.μ[idxs, :]; initial_soc = g_s.initial_soc[idxs]) | ||
|
|
||
| function Base.vcat(gen_stors::GeneratorStorages{N,L,T,P,E}...) where {N, L, T, P, E} | ||
|
|
||
|
|
@@ -484,6 +510,8 @@ function Base.vcat(gen_stors::GeneratorStorages{N,L,T,P,E}...) where {N, L, T, P | |
| λ = Matrix{Float64}(undef, n_gen_stors, N) | ||
| μ = Matrix{Float64}(undef, n_gen_stors, N) | ||
|
|
||
| initial_soc = Vector{Float64}(undef, n_gen_stors) | ||
|
|
||
| last_idx = 0 | ||
|
|
||
| for g_s in gen_stors | ||
|
|
@@ -509,12 +537,14 @@ function Base.vcat(gen_stors::GeneratorStorages{N,L,T,P,E}...) where {N, L, T, P | |
| λ[rows, :] = g_s.λ | ||
| μ[rows, :] = g_s.μ | ||
|
|
||
| initial_soc[rows] = g_s.initial_soc | ||
|
|
||
| last_idx += n | ||
|
|
||
| end | ||
|
|
||
| return GeneratorStorages{N,L,T,P,E}(names, categories, charge_capacity, discharge_capacity, energy_capacity, charge_efficiency, discharge_efficiency, | ||
| carryover_efficiency,inflow, gridwithdrawal_capacity, gridinjection_capacity, λ, μ) | ||
| carryover_efficiency,inflow, gridwithdrawal_capacity, gridinjection_capacity, λ, μ; initial_soc = initial_soc) | ||
|
|
||
| end | ||
|
|
||
|
|
@@ -551,6 +581,8 @@ A struct representing demand response devices in the system. | |
| - `μ` (repair probability): Probability the unit transitions from forced outage to | ||
| operational during a given simulation timestep, for each storage unit in each | ||
| timeperiod. Unitless. | ||
| - `initial_borrowed_load`: Optional initial state of borrowed load as a fraction [0,1.0] of `energy_capacity` at first timestep for | ||
| each demand response unit at the beginning of the simulation. Default is zero. | ||
| """ | ||
| struct DemandResponses{N,L,T<:Period,P<:PowerUnit,E<:EnergyUnit} <: AbstractAssets{N,L,T,P} | ||
|
|
||
|
|
@@ -568,6 +600,8 @@ struct DemandResponses{N,L,T<:Period,P<:PowerUnit,E<:EnergyUnit} <: AbstractAsse | |
| λ::Matrix{Float64} | ||
| μ::Matrix{Float64} | ||
|
|
||
| initial_borrowed_load::Vector{Float64} # energy | ||
|
|
||
| borrow_efficiency::Matrix{Float64} | ||
| payback_efficiency::Matrix{Float64} | ||
|
|
||
|
|
@@ -576,8 +610,10 @@ struct DemandResponses{N,L,T<:Period,P<:PowerUnit,E<:EnergyUnit} <: AbstractAsse | |
| borrowcapacity::Matrix{Int}, paybackcapacity::Matrix{Int}, | ||
| energycapacity::Matrix{Int}, borrowedenergyinterest::Matrix{Float64}, | ||
| allowablepaybackperiod::Matrix{Int}, | ||
| λ::Matrix{Float64}, μ::Matrix{Float64}, | ||
| borrowefficiency::Matrix{Float64},paybackefficiency::Matrix{Float64} | ||
| λ::Matrix{Float64}, μ::Matrix{Float64}; | ||
| initial_borrowed_load::Vector{Float64} = zeros(Float64, length(names)), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why don't we keep this as the last argument, much like the others? |
||
| borrow_efficiency::Matrix{Float64} = ones(Float64, size(borrowcapacity)), | ||
| payback_efficiency::Matrix{Float64} = ones(Float64, size(paybackcapacity)) | ||
|
juflorez marked this conversation as resolved.
|
||
| ) where {N,L,T,P,E} | ||
|
|
||
| n_drs = length(names) | ||
|
|
@@ -592,11 +628,11 @@ struct DemandResponses{N,L,T<:Period,P<:PowerUnit,E<:EnergyUnit} <: AbstractAsse | |
| @assert all(isnonnegative, paybackcapacity) | ||
| @assert all(isnonnegative, energycapacity) | ||
|
|
||
| @assert size(borrowefficiency) == (n_drs, N) | ||
| @assert size(paybackefficiency) == (n_drs, N) | ||
| @assert size(borrow_efficiency) == (n_drs, N) | ||
| @assert size(payback_efficiency) == (n_drs, N) | ||
| @assert size(borrowedenergyinterest) == (n_drs, N) | ||
| @assert all(isfractional, borrowefficiency) | ||
| @assert all(isfractional, paybackefficiency) | ||
| @assert all(isfractional, borrow_efficiency) | ||
| @assert all(isfractional, payback_efficiency) | ||
| @assert all(borrowedenergyinterest .<= 1.0) | ||
| @assert all(borrowedenergyinterest .>= -1.0) | ||
|
|
||
|
|
@@ -609,41 +645,31 @@ struct DemandResponses{N,L,T<:Period,P<:PowerUnit,E<:EnergyUnit} <: AbstractAsse | |
| @assert all(isfractional, λ) | ||
| @assert all(isfractional, μ) | ||
|
|
||
| @assert length(initial_borrowed_load) == n_drs | ||
| @assert all(isfractional, initial_borrowed_load) | ||
|
|
||
| new{N,L,T,P,E}(string.(names), string.(categories), | ||
| borrowcapacity, paybackcapacity, energycapacity, | ||
| borrowedenergyinterest, | ||
| allowablepaybackperiod, | ||
| λ, μ,borrowefficiency, paybackefficiency,) | ||
| λ, μ, | ||
| initial_borrowed_load, | ||
| borrow_efficiency, | ||
| payback_efficiency) | ||
| end | ||
| end | ||
|
|
||
| # second constructor if borrow and payback efficiencies are not provided | ||
| function DemandResponses{N,L,T,P,E}( | ||
| names::Vector{<:AbstractString}, categories::Vector{<:AbstractString}, | ||
| borrowcapacity::Matrix{Int}, paybackcapacity::Matrix{Int}, | ||
| energycapacity::Matrix{Int}, borrowedenergyinterest::Matrix{Float64}, | ||
| allowablepaybackperiod::Matrix{Int}, | ||
| λ::Matrix{Float64}, μ::Matrix{Float64} | ||
| ) where {N,L,T,P,E} | ||
| return DemandResponses{N,L,T,P,E}( | ||
| names, categories, | ||
| borrowcapacity, paybackcapacity, energycapacity, | ||
| borrowedenergyinterest, allowablepaybackperiod, | ||
| λ, μ, | ||
| ones(Float64, size(borrowcapacity)), ones(Float64, size(paybackcapacity)) | ||
| ) | ||
| end | ||
|
|
||
|
|
||
| # Empty DemandResponses constructor | ||
| function DemandResponses{N,L,T,P,E}() where {N,L,T,P,E} | ||
|
|
||
| return DemandResponses{N,L,T,P,E}( | ||
| String[], String[], | ||
| Matrix{Int}(undef, 0, N),Matrix{Int}(undef, 0, N),Matrix{Int}(undef, 0, N), | ||
| Matrix{Float64}(undef, 0, N), | ||
| Matrix{Int}(undef, 0, N),Matrix{Float64}(undef, 0, N),Matrix{Float64}(undef, 0, N), | ||
| Matrix{Float64}(undef, 0, N),Matrix{Float64}(undef, 0, N)) | ||
| return DemandResponses{N,L,T,P,E}( | ||
| String[], String[], | ||
| Matrix{Int}(undef, 0, N),Matrix{Int}(undef, 0, N),Matrix{Int}(undef, 0, N), | ||
| Matrix{Float64}(undef, 0, N), | ||
| Matrix{Int}(undef, 0, N),Matrix{Float64}(undef, 0, N),Matrix{Float64}(undef, 0, N); | ||
| initial_borrowed_load = zeros(Float64, 0), | ||
| borrow_efficiency = Matrix{Float64}(undef, 0, N), | ||
| payback_efficiency = Matrix{Float64}(undef, 0, N)) | ||
| end | ||
|
|
||
| Base.:(==)(x::T, y::T) where {T <: DemandResponses} = | ||
|
|
@@ -657,13 +683,16 @@ Base.:(==)(x::T, y::T) where {T <: DemandResponses} = | |
| x.borrowed_energy_interest == y.borrowed_energy_interest && | ||
| x.allowable_payback_period == y.allowable_payback_period && | ||
| x.λ == y.λ && | ||
| x.μ == y.μ | ||
| x.μ == y.μ && | ||
| x.initial_borrowed_load == y.initial_borrowed_load | ||
|
|
||
| Base.getindex(dr::DR, idxs::AbstractVector{Int}) where {DR <: DemandResponses} = | ||
| DR(dr.names[idxs], dr.categories[idxs],dr.borrow_capacity[idxs,:], | ||
| dr.payback_capacity[idxs, :],dr.energy_capacity[idxs, :], | ||
| dr.borrowed_energy_interest[idxs, :],dr.allowable_payback_period[idxs, :],dr.λ[idxs, :], dr.μ[idxs, :], | ||
| dr.borrow_efficiency[idxs, :], dr.payback_efficiency[idxs, :]) | ||
| dr.borrowed_energy_interest[idxs, :],dr.allowable_payback_period[idxs, :],dr.λ[idxs, :], dr.μ[idxs, :]; | ||
| initial_borrowed_load = dr.initial_borrowed_load[idxs], | ||
| borrow_efficiency = dr.borrow_efficiency[idxs, :], | ||
| payback_efficiency = dr.payback_efficiency[idxs, :]) | ||
|
|
||
| function Base.vcat(drs::DemandResponses{N,L,T,P,E}...) where {N, L, T, P, E} | ||
|
|
||
|
|
@@ -686,6 +715,8 @@ function Base.vcat(drs::DemandResponses{N,L,T,P,E}...) where {N, L, T, P, E} | |
| λ = Matrix{Float64}(undef, n_drs, N) | ||
| μ = Matrix{Float64}(undef, n_drs, N) | ||
|
|
||
| initial_borrowed_load = Vector{Float64}(undef, n_drs) | ||
|
|
||
| last_idx = 0 | ||
|
|
||
| for dr in drs | ||
|
|
@@ -709,12 +740,17 @@ function Base.vcat(drs::DemandResponses{N,L,T,P,E}...) where {N, L, T, P, E} | |
| λ[rows, :] = dr.λ | ||
| μ[rows, :] = dr.μ | ||
|
|
||
| initial_borrowed_load[rows] = dr.initial_borrowed_load | ||
|
|
||
| last_idx += n | ||
|
|
||
| end | ||
|
|
||
| return DemandResponses{N,L,T,P,E}(names, categories, borrow_capacity, payback_capacity, energy_capacity, | ||
| borrowed_energy_interest,allowable_payback_period, λ, μ, borrow_efficiency, payback_efficiency) | ||
| borrowed_energy_interest,allowable_payback_period, λ, μ; | ||
| initial_borrowed_load = initial_borrowed_load, | ||
| borrow_efficiency = borrow_efficiency, | ||
| payback_efficiency = payback_efficiency) | ||
|
|
||
| end | ||
|
|
||
|
|
||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to have one function for these 3 blocks?