Skip to content
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

CO2 pipelines and storage #228

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
1 change: 1 addition & 0 deletions DOLPHYN/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[deps]
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
Glob = "c27321d9-0574-5035-807b-f59d2c89b15c"
Gurobi = "2e9cd046-0924-5485-92f1-d5272153d98b"
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down Expand Up @@ -47,4 +48,4 @@ Revise = "3.4.0"
Statistics = "1"
StatsBase = "0.33.0, 0.34"
YAML = "0.4.0"
julia = "1.6"
julia = "1.8.5"
38 changes: 37 additions & 1 deletion docs/src/write_co2_outputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,40 @@ Pages = ["CSC/write_outputs/write_co2_emission_balance_system.jl"]
```@autodocs
Modules = [Dolphyn]
Pages = ["CSC/write_outputs/write_co2_emission_balance_zone.jl"]
```
```

## Write Balancing of CO2 Outflow from a zone
```@autodocs
Modules = [Dolphyn]
Pages = ["CSC/write_outputs/write_co2_capture_outflow_balance.jl"]
```

## Write Balancing of CO2 Inflow from Spur pipeline to a CO2 Storage site
```@autodocs
Modules = [Dolphyn]
Pages = ["CSC/write_outputs/write_co2_spur_inflow_storage_balance.jl"]
```

## Write amount of CO2 flowing across trunk pipelines at a given time t
```@autodocs
Modules = [Dolphyn]
Pages = ["CSC/write_outputs/write_co2_trunk_pipeline_flow.jl"]
```

## Write amount of CO2 flowing across spur pipelines at a given time t
```@autodocs
Modules = [Dolphyn]
Pages = ["CSC/write_outputs/write_co2_spur_pipeline_flow.jl"]
```

## Write expansion of trunk pipelines
```@autodocs
Modules = [Dolphyn]
Pages = ["CSC/write_outputs/write_co2_trunk_pipeline_expansion.jl"]
```

## Write expansion of spur pipelines
```@autodocs
Modules = [Dolphyn]
Pages = ["CSC/write_outputs/write_co2_spur_pipeline_expansion.jl"]
```
2 changes: 1 addition & 1 deletion src/CSC/load_inputs/load_co2_capture_DAC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ received this license file. If not, see <http://www.gnu.org/licenses/>.
"""

@doc raw"""
load_co2_capture_DAC(setup::Dict, path::AbstractString, sep::AbstractString, inputs_capture::Dict)
load_co2_capture_DAC(setup::Dict, path::AbstractString, sep::AbstractString, inputs_capture::Dict)

Function for reading input parameters related to DAC resources in the carbon supply chain.
"""
Expand Down
1 change: 1 addition & 0 deletions src/CSC/load_inputs/load_co2_capture_compression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ received this license file. If not, see <http://www.gnu.org/licenses/>.

Function for reading input parameters related to CO2 compression resources in the carbon supply chain.
"""

function load_co2_capture_compression(setup::Dict, path::AbstractString, sep::AbstractString, inputs_co2_capture_comp::Dict)

#Read in CO2 capture related inputs
Expand Down
60 changes: 60 additions & 0 deletions src/CSC/load_inputs/load_co2_demand.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
"""
DOLPHYN: Decision Optimization for Low-carbon Power and Hydrogen Networks
Copyright (C) 2022, Massachusetts Institute of Technology
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
A complete copy of the GNU General Public License v2 (GPLv2) is available
in LICENSE.txt. Users uncompressing this from an archive may not have
received this license file. If not, see <http://www.gnu.org/licenses/>.
"""

@doc raw"""
load_co2_demand(setup::Dict, path::AbstractString, sep::AbstractString, inputs_load::Dict)

Function for reading input parameters related to exogenous CO2 load (demand) of each zone.
"""
function load_co2_demand(setup::Dict, path::AbstractString, sep::AbstractString, inputs_load::Dict)

data_directory = joinpath(path, setup["TimeDomainReductionFolder"])
if setup["TimeDomainReduction"] == 1 && isfile(joinpath(data_directory,"Load_data.csv")) && isfile(joinpath(data_directory,"Generators_variability.csv")) && isfile(joinpath(data_directory,"Fuels_data.csv")) && isfile(joinpath(data_directory,"CSC_load_data.csv")) # Use Time Domain Reduced data for GenX
CSC_load_in = DataFrame(CSV.File(string(joinpath(data_directory,"CSC_load_data.csv")), header=true), copycols=true)
else # Run without Time Domain Reduction OR Getting original input data for Time Domain Reduction
CSC_load_in = DataFrame(CSV.File(string(path,sep,"CSC_load_data.csv"), header=true), copycols=true)
end

# Number of demand curtailment/lost load segments
inputs_load["CO2_SEG"]=size(collect(skipmissing(CSC_load_in[!,:Demand_Segment])),1)

# Demand in tonnes per hour for each zone
#print_and_log(names(load_in))
start = findall(s -> s == "Load_CO2_tonne_per_hr_z1", names(CSC_load_in))[1] #gets the starting column number of all the columns, with header "Load_CO2_z1"

# Max value of non-served energy in $/(tonne)
inputs_load["CO2_Voll"] = collect(skipmissing(CSC_load_in[!,:Voll]))
# Demand in Tonnes per hour
inputs_load["CO2_D"] =Matrix(CSC_load_in[1:inputs_load["T"],start:start-1+inputs_load["Z"]]) #form a matrix with columns as the different zonal load CO2 demand values and rows as the hours


# Cost of non-served energy/demand curtailment (for each segment)
CO2_SEG = inputs_load["CO2_SEG"] # Number of demand segments
inputs_load["pC_CO2_D_Curtail"] = zeros(CO2_SEG)
inputs_load["pMax_CO2_D_Curtail"] = zeros(CO2_SEG)
for s in 1:CO2_SEG
# Cost of each segment reported as a fraction of value of non-served energy - scaled implicitly
inputs_load["pC_CO2_D_Curtail"][s] = collect(skipmissing(CSC_load_in[!,:Cost_of_Demand_Curtailment_per_Tonne]))[s]*inputs_load["Voll"][1]
# Maximum hourly demand curtailable as % of the max demand (for each segment)
inputs_load["pMax_CO2_D_Curtail"][s] = collect(skipmissing(CSC_load_in[!,:Max_Demand_Curtailment]))[s]
end

print_and_log("CSC_load_data.csv Successfully Read!")

return inputs_load

end

8 changes: 7 additions & 1 deletion src/CSC/load_inputs/load_co2_inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ received this license file. If not, see <http://www.gnu.org/licenses/>.


@doc raw"""
load_co2_inputs(inputs::Dict,setup::Dict,path::AbstractString)
load_co2_inputs(inputs::Dict,setup::Dict,path::AbstractString)

Loads various data inputs from multiple input .csv files in path directory and stores variables in a Dict (dictionary) object for use in model() function

Expand All @@ -27,6 +27,7 @@ path - string path to working directory

returns: Dict (dictionary) object containing all data inputs of carbon supply chain.
"""

function load_co2_inputs(inputs::Dict,setup::Dict,path::AbstractString)

## Use appropriate directory separator depending on Mac or Windows config
Expand All @@ -48,6 +49,11 @@ function load_co2_inputs(inputs::Dict,setup::Dict,path::AbstractString)
inputs = load_co2_storage(setup, path, sep, inputs)
inputs = load_co2_capture_compression(setup, path, sep, inputs)
inputs = load_co2_pipeline_data(setup, path, sep, inputs)

# Adding a new line over here to specify loading of exogeneous CO2 demand
if setup["Exogeneous_CO2_Demand"] == 1
inputs = load_co2_demand(setup, path, sep, inputs)
end

println("CSC Input CSV Files Successfully Read In From $path$sep")

Expand Down
Loading
Loading