diff --git a/Project.toml b/Project.toml
index 2bc710952..a6d2b1048 100644
--- a/Project.toml
+++ b/Project.toml
@@ -1,7 +1,7 @@
name = "GenX"
uuid = "5d317b1e-30ec-4ed6-a8ce-8d2d88d7cfac"
authors = ["Bonaldo, Luca", "Chakrabarti, Sambuddha", "Cheng, Fangwei", "Ding, Yifu", "Jenkins, Jesse D.", "Luo, Qian", "Macdonald, Ruaridh", "Mallapragada, Dharik", "Manocha, Aneesha", "Mantegna, Gabe ", "Morris, Jack", "Patankar, Neha", "Pecci, Filippo", "Schwartz, Aaron", "Schwartz, Jacob", "Schivley, Greg", "Sepulveda, Nestor", "Xu, Qingyu", "Zhou, Justin"]
-version = "0.4.1-dev.15"
+version = "0.4.1-dev.16"
[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
diff --git a/docs/src/Tutorials/Tutorial_8_outputs.md b/docs/src/Tutorials/Tutorial_8_outputs.md
index b344c3aab..e6b9f130f 100644
--- a/docs/src/Tutorials/Tutorial_8_outputs.md
+++ b/docs/src/Tutorials/Tutorial_8_outputs.md
@@ -28,7 +28,6 @@ using StatsPlots
case = joinpath("example_systems/1_three_zones");
```
-
```julia
include("example_systems/1_three_zones/Run.jl")
```
@@ -40,15 +39,12 @@ include("example_systems/1_three_zones/Run.jl")
Demand (load) data Successfully Read!
Fuels_data.csv Successfully Read!
-
Thermal.csv Successfully Read.
Vre.csv Successfully Read.
Storage.csv Successfully Read.
Resource_energy_share_requirement.csv Successfully Read.
Resource_capacity_reserve_margin.csv Successfully Read.
Resource_minimum_capacity_requirement.csv Successfully Read.
-
-
Summary of resources loaded into the model:
-------------------------------------------------------
@@ -89,8 +85,7 @@ include("example_systems/1_three_zones/Run.jl")
CSV Files Successfully Read In From /Users/mayamutic/Desktop/GenX-Tutorials/Tutorials/example_systems/1_three_zones
Generating the Optimization Model
-
- Thermal.csv Successfully Read.
+ Thermal.csv Successfully Read.
Vre.csv Successfully Read.
Storage.csv Successfully Read.
Resource_energy_share_requirement.csv Successfully Read.
@@ -115,6 +110,7 @@ include("example_systems/1_three_zones/Run.jl")
Minimum Capacity Requirement Module
Time elapsed for model building is
5.887781667
+
Solving Model
Running HiGHS 1.6.0: Copyright (c) 2023 HiGHS under MIT licence terms
Presolving model
@@ -251,6 +247,7 @@ include("example_systems/1_three_zones/Run.jl")
Objective value : 9.4121364078e+03
HiGHS run time : 107.89
LP solved for primal
+
Writing Output
Time elapsed for writing costs is
0.8427745
@@ -312,17 +309,12 @@ include("example_systems/1_three_zones/Run.jl")
Time elapsed for writing is
6.909353542
-
Below are all 33 files output by running GenX:
-
```julia
results = cd(readdir,joinpath(case,"results"))
```
-
-
-
33-element Vector{String}:
"CO2_prices_and_penalties.csv"
"ChargingCost.csv"
@@ -351,17 +343,15 @@ results = cd(readdir,joinpath(case,"results"))
"time_weights.csv"
"tlosses.csv"
-
-
### Power
-The file `power.csv`, shown below, outputs the power in MW discharged by each node at each time step. Note that if TimeDomainReduction is in use the file will be shorter. The first row states which zone each node is part of, and the total power per year is located in the second row. After that, each row represents one time step of the series.
-
+The file `power.csv`, shown below, contains the power output in MW discharged by each node at each time step. Note that if `TimeDomainReduction` is enabled, the file will have fewer rows compared to the number of time steps in the `system/Demand_data.csv` file. In this case, the corresponding `Demand_data.csv` file that matches the time series in `power.csv` can be found in the `TDR_results` folder. The first row of `power.csv` indicates the zone each node belongs to, while the second row contains the total power per year. Each subsequent row represents one time step in the series.
```julia
power = CSV.read(joinpath(case,"results/power.csv"),DataFrame,missingstring="NA")
```
-``` @raw html
+
+```@raw html
1850×12 DataFrame
1825 rows omitted
Row
Resource
MA_natural_gas_combined_cycle
CT_natural_gas_combined_cycle
ME_natural_gas_combined_cycle
MA_solar_pv
CT_onshore_wind
CT_solar_pv
ME_onshore_wind
MA_battery
CT_battery
ME_battery
Total
String15
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
1
Zone
1.0
2.0
3.0
1.0
2.0
2.0
3.0
1.0
2.0
3.0
0.0
2
AnnualSum
1.04015e7
3.42459e6
8.94975e5
2.47213e7
2.90683e7
2.69884e7
2.625e7
5.06354e6
1.45833e7
4.90368e6
1.463e8
3
t1
-0.0
-0.0
-0.0
-0.0
8510.78
-0.0
5300.61
0.0
2537.45
673.34
17022.2
4
t2
-0.0
-0.0
-0.0
-0.0
8420.78
-0.0
6282.04
0.0
2537.45
0.0
17240.3
5
t3
-0.0
-0.0
-0.0
-0.0
8367.78
-0.0
2409.84
0.0
2537.45
1828.24
15143.3
6
t4
-0.0
-0.0
-0.0
-0.0
8353.78
-0.0
2762.24
1591.46
2537.45
0.0
15244.9
7
t5
-0.0
-0.0
-0.0
-0.0
7482.39
-0.0
0.0
1617.46
2980.64
1384.62
13465.1
8
t6
-0.0
-0.0
-0.0
-0.0
2429.93
-0.0
2797.24
1717.96
5535.37
0.0
12480.5
9
t7
-0.0
-0.0
-0.0
-0.0
11868.8
-0.0
1374.73
1320.78
871.443
1340.67
16776.4
10
t8
-0.0
-0.0
-0.0
-0.0
2656.93
-0.0
0.0
2115.96
5535.37
1452.62
11760.9
11
t9
-0.0
-0.0
-0.0
3061.28
0.0
3110.8
2982.24
868.817
5389.44
0.0
15412.6
12
t10
-0.0
-0.0
-0.0
6100.22
7597.99
5543.69
0.0
0.0
0.0
1521.12
20763.0
13
t11
-0.0
-0.0
-0.0
8314.29
0.0
6341.98
3080.24
0.0
2458.82
0.0
20195.3
⋮
⋮
⋮
⋮
⋮
⋮
⋮
⋮
⋮
⋮
⋮
⋮
⋮
1839
t1837
-0.0
-0.0
-0.0
6712.18
2541.6
6736.37
305.608
1410.33
763.726
1427.82
19897.6
1840
t1838
-0.0
-0.0
-0.0
6514.15
0.0
6847.24
3153.24
0.0
3464.22
0.0
19978.9
1841
t1839
-0.0
-0.0
-0.0
5582.07
3848.88
6280.2
0.0
195.422
2048.3
1571.12
19526.0
1842
t1840
-0.0
-0.0
-0.0
3688.13
9349.98
4892.7
3490.61
1006.02
0.0
0.0
22427.4
1843
t1841
-0.0
-0.0
-0.0
509.22
8124.99
1351.08
3653.06
1218.5
2507.8
1828.24
19192.9
1844
t1842
-0.0
-0.0
-0.0
-0.0
2918.2
-0.0
6896.82
2194.61
5535.37
256.863
17801.9
1845
t1843
-0.0
-0.0
-0.0
-0.0
6800.37
-0.0
7324.66
1838.11
3950.15
41.9472
19955.2
1846
t1844
-0.0
-0.0
-0.0
-0.0
9505.82
-0.0
5683.66
1744.78
2567.93
838.077
20340.3
1847
t1845
-0.0
-0.0
-0.0
-0.0
3491.93
-0.0
5128.56
1597.61
5535.37
1107.49
16861.0
1848
t1846
-0.0
-0.0
-0.0
-0.0
12135.6
-0.0
5021.75
1341.11
1140.56
1125.9
20764.9
1849
t1847
-0.0
-0.0
-0.0
-0.0
8875.71
-0.0
3605.98
974.61
2665.48
1783.79
17905.6
1850
t1848
-0.0
-0.0
-0.0
-0.0
13549.1
-0.0
4098.0
541.61
205.31
1478.27
19872.3
```
@@ -386,11 +376,16 @@ for i in range(2,4)
power_plot = [power_plot; power_plot_temp]
end
-demands = CSV.read(joinpath(case,"system/Demand_data.csv"),DataFrame,missingstring="NA")
+demands = CSV.read(joinpath(case,"TDR_results/Demand_data.csv"),DataFrame,missingstring="NA")
demands_tot = demands[!,"Demand_MW_z1"]+demands[!,"Demand_MW_z2"]+demands[!,"Demand_MW_z3"]
power_plot[!,"Demand_Total"] = repeat(demands_tot[tstart:tend],4);
```
+Note that since the `power.csv` file is generated by running GenX with `TimeDomainReduction: 1`, the demands time series must be taken from the `Demand_data.csv` file located in the `TDR_results` folder.
+
+GenX also has the ability to output the reconstructed version of power generation by setting `OutputFullTimeSeries: 1` in `genx_settings.yml`. In this case, a second version of the `power.csv` file will be created inside the `results/Full_TimeSeries` folder. To plot the reconstructed version against the demand, ensure you use the `Demand_data.csv` from the `settings` folder, not the one in the `TDR_results` folder.
+
+Finally, if `TimeDomainReduction: 0` is set, the `power.csv` file will contain the full time series of power generation, and the `Demand_data.csv` should be taken from the `settings` folder.
```julia
power_plot |>
@@ -402,11 +397,9 @@ power_plot |>
```
![svg](./files/t8_cap.svg)
-
We can separate it by zone in the following plot:
-
```julia
Zone1 = [power[2,2] power[2,5] 0 power[2,9]]
Zone2 = [power[2,3] power[2,7] power[2,6] power[2,10]]
@@ -448,7 +441,6 @@ end
```
-
```julia
Plots.heatmap(heat,yticks=0:4:24,xticks=([15:30:364;],
["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"]),
@@ -458,7 +450,6 @@ Plots.heatmap(heat,yticks=0:4:24,xticks=([15:30:364;],
![svg](./files/t8_heatmap.svg)
-
### Cost and Revenue
The basic cost of each power plant and the revenue it generates can be found in files `costs.csv`, `NetRevenue.csv`,and `EnergyRevenue.csv`. `NetRevenue.csv` breaks down each specific cost per node in each zone, which is useful to visualize what the cost is coming from.
@@ -468,14 +459,10 @@ The basic cost of each power plant and the revenue it generates can be found in
netrevenue = CSV.read(joinpath(case,"results/NetRevenue.csv"),DataFrame,missingstring="NA")
```
-
-
``` @raw html
10×28 DataFrame
Row
region
Resource
zone
Cluster
R_ID
Inv_cost_MW
Inv_cost_MWh
Inv_cost_charge_MW
Fixed_OM_cost_MW
Fixed_OM_cost_MWh
Fixed_OM_cost_charge_MW
Var_OM_cost_out
Fuel_cost
Var_OM_cost_in
StartCost
Charge_cost
CO2SequestrationCost
EnergyRevenue
SubsidyRevenue
OperatingReserveRevenue
OperatingRegulationRevenue
ReserveMarginRevenue
ESRRevenue
EmissionsCost
RegSubsidyRevenue
Revenue
Cost
Profit
String3
String31
Int64
Int64
Int64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
Float64
1
MA
MA_natural_gas_combined_cycle
1
1
1
5.54734e8
0.0
0.0
8.72561e7
0.0
0.0
3.69253e7
2.10416e8
0.0
3.84832e7
0.0
0.0
2.77103e9
0.0
0.0
0.0
0.0
0.0
1.84321e9
0.0
2.77103e9
2.77103e9
1.43051e-6
2
CT
CT_natural_gas_combined_cycle
2
1
2
1.42906e8
0.0
0.0
2.11911e7
0.0
0.0
1.22258e7
4.97792e7
0.0
7.75292e6
0.0
0.0
8.4423e8
0.0
0.0
0.0
0.0
0.0
6.10375e8
0.0
8.4423e8
8.4423e8
1.19209e-7
3
ME
ME_natural_gas_combined_cycle
3
1
3
3.52336e7
0.0
0.0
8.77661e6
0.0
0.0
4.02739e6
2.26505e7
0.0
3.33663e6
0.0
0.0
2.19267e8
0.0
0.0
0.0
0.0
0.0
1.45243e8
0.0
2.19267e8
2.19267e8
0.0
4
MA
MA_solar_pv
1
1
4
1.27007e9
0.0
0.0
2.79327e8
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
1.5494e9
0.0
0.0
0.0
0.0
0.0
0.0
0.0
1.5494e9
1.5494e9
-2.86102e-6
5
CT
CT_onshore_wind
2
1
5
1.40748e9
0.0
0.0
6.25617e8
0.0
0.0
2.90683e6
0.0
0.0
0.0
0.0
0.0
2.036e9
0.0
0.0
0.0
0.0
0.0
0.0
0.0
2.036e9
2.036e9
-5.00679e-6
6
CT
CT_solar_pv
2
1
6
1.35108e9
0.0
0.0
2.97142e8
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
1.64822e9
0.0
0.0
0.0
0.0
0.0
0.0
0.0
1.64822e9
1.64822e9
9.53674e-7
7
ME
ME_onshore_wind
3
1
7
1.03673e9
0.0
0.0
4.60821e8
0.0
0.0
2.625e6
0.0
0.0
0.0
0.0
0.0
1.50017e9
0.0
0.0
0.0
0.0
0.0
0.0
0.0
1.50017e9
1.50017e9
2.38419e-6
8
MA
MA_battery
1
0
8
4.29792e7
2.23673e8
0.0
1.07426e7
5.59033e7
0.0
7.59532e5
0.0
8.97367e5
0.0
1.3432e8
0.0
4.48833e8
0.0
0.0
0.0
0.0
0.0
0.0
0.0
4.48833e8
4.69275e8
-2.0442e7
9
CT
CT_battery
2
0
9
1.08405e8
5.73615e8
0.0
2.70957e7
1.43365e8
0.0
2.1875e6
0.0
2.58447e6
0.0
5.24177e8
0.0
1.31941e9
0.0
0.0
0.0
0.0
0.0
0.0
0.0
1.31941e9
1.38143e9
-6.20165e7
10
ME
ME_battery
3
0
10
3.58043e7
1.03994e8
0.0
8.94925e6
2.59915e7
0.0
7.35552e5
0.0
8.69036e5
0.0
3.81057e7
0.0
2.03732e8
0.0
0.0
0.0
0.0
0.0
0.0
0.0
2.03732e8
2.14449e8
-1.0717e7
```
-
-
```julia
xnames = netrevenue[!,2]
names1 = ["Investment cost" "Fixed OM cost" "Variable OM cost" "Fuel cost" "Start Cost" "Battery charge cost" "CO2 Sequestration Cost" "Revenue"]
@@ -491,8 +478,6 @@ StatsPlots.scatter!(xnames,netrevenue[!,"Revenue"],label="Revenue",color="black"
![svg](./files/t8_cost.svg)
-
-
### Emissions
The file `emmissions.csv` gives the total CO2 emmissions per zone for each hour GenX runs. The first three rows give the marginal CO2 abatement cost in $/ton CO2.
@@ -502,14 +487,10 @@ The file `emmissions.csv` gives the total CO2 emmissions per zone for each hour
emm1 = CSV.read(joinpath(case,"results/emissions.csv"),DataFrame)
```
-
-
``` @raw html
1852×5 DataFrame
1827 rows omitted
Row
Zone
1
2
3
Total
String15
Float64
Float64
Float64
Float64
1
CO2_Price_1
444.921
0.0
0.0
0.0
2
CO2_Price_2
0.0
468.668
0.0
0.0
3
CO2_Price_3
0.0
0.0
240.86
0.0
4
AnnualSum
4.14279e6
1.30236e6
6.03017e5
6.04816e6
5
t1
0.0
0.0
0.0
0.0
6
t2
0.0
0.0
0.0
0.0
7
t3
0.0
0.0
0.0
0.0
8
t4
0.0
0.0
0.0
0.0
9
t5
0.0
0.0
0.0
0.0
10
t6
0.0
0.0
0.0
0.0
11
t7
0.0
0.0
0.0
0.0
12
t8
0.0
0.0
0.0
0.0
13
t9
0.0
0.0
0.0
0.0
⋮
⋮
⋮
⋮
⋮
⋮
1841
t1837
0.0
0.0
0.0
0.0
1842
t1838
0.0
0.0
0.0
0.0
1843
t1839
0.0
0.0
0.0
0.0
1844
t1840
0.0
0.0
0.0
0.0
1845
t1841
0.0
0.0
0.0
0.0
1846
t1842
0.0
0.0
0.0
0.0
1847
t1843
0.0
0.0
0.0
0.0
1848
t1844
0.0
0.0
0.0
0.0
1849
t1845
0.0
0.0
0.0
0.0
1850
t1846
0.0
0.0
0.0
0.0
1851
t1847
0.0
0.0
0.0
0.0
1852
t1848
0.0
0.0
0.0
0.0
```
-
-
```julia
# Pre-processing
tstart = 470
@@ -519,7 +500,6 @@ names_emm = ["Zone 1","Zone 2","Zone 3"]
emm_tot = DataFrame([emm1[3:end,2] emm1[3:end,3] emm1[3:end,4]],
["Zone 1","Zone 2","Zone 3"])
-
emm_plot = DataFrame([collect((tstart-3):(tend-3)) emm_tot[tstart:tend,1] repeat([names_emm[1]],(tend-tstart+1))],
["Hour","MW","Zone"]);
@@ -530,7 +510,6 @@ end
```
-
```julia
emm_plot |>
@vlplot(mark={:line},
@@ -541,11 +520,8 @@ emm_plot |>
![svg](./files/t8_emm1.svg)
-
-
Let's try changing the CO2 cap, as in Tutorial 7, and plotting the resulting emmissions.
-
```julia
genx_settings_TZ = YAML.load(open((joinpath(case,"settings/genx_settings.yml"))))
genx_settings_TZ["CO2Cap"] = 0
@@ -555,7 +531,6 @@ include("example_systems/1_three_zones/Run.jl")
# run outside of notebook
```
-
Configuring Settings
Time Series Data Already Clustered.
Configuring Solver
@@ -576,15 +551,12 @@ include("example_systems/1_three_zones/Run.jl")
Total number of resources: 10
-------------------------------------------------------
-
Thermal.csv Successfully Read.
Vre.csv Successfully Read.
Storage.csv Successfully Read.
Resource_energy_share_requirement.csv Successfully Read.
Resource_capacity_reserve_margin.csv Successfully Read.
Resource_minimum_capacity_requirement.csv Successfully Read.
-
-
Generators_variability.csv Successfully Read!
Validating time basis
Minimum_capacity_requirement.csv Successfully Read!
@@ -607,6 +579,7 @@ include("example_systems/1_three_zones/Run.jl")
Minimum Capacity Requirement Module
Time elapsed for model building is
0.531860834
+
Solving Model
Running HiGHS 1.6.0: Copyright (c) 2023 HiGHS under MIT licence terms
Presolving model
@@ -740,6 +713,7 @@ include("example_systems/1_three_zones/Run.jl")
Objective value : 5.5855435982e+03
HiGHS run time : 66.51
LP solved for primal
+
Writing Output
Time elapsed for writing costs is
0.099885792
@@ -799,20 +773,13 @@ include("example_systems/1_three_zones/Run.jl")
Time elapsed for writing is
0.530491792
-
-
```julia
emm2 = CSV.read(joinpath(case,"results_1/emissions.csv"),DataFrame)
```
-
-
``` @raw html
1849×5 DataFrame
1824 rows omitted
Row
Zone
1
2
3
Total
String15
Float64
Float64
Float64
Float64
1
AnnualSum
1.68155e7
1.41088e7
4310.21
3.09286e7
2
t1
997.169
0.0
0.0
997.169
3
t2
997.169
0.0
0.0
997.169
4
t3
997.169
0.0
0.0
997.169
5
t4
997.169
0.0
0.0
997.169
6
t5
997.169
0.0
0.0
997.169
7
t6
997.169
0.0
0.0
997.169
8
t7
997.169
0.0
0.0
997.169
9
t8
997.169
0.0
0.0
997.169
10
t9
997.169
0.0
0.0
997.169
11
t10
1471.46
0.0
0.0
1471.46
12
t11
997.169
0.0
0.0
997.169
13
t12
1115.81
0.0
0.0
1115.81
⋮
⋮
⋮
⋮
⋮
⋮
1838
t1837
2789.35
1012.99
0.0
3802.34
1839
t1838
2835.21
1012.99
0.0
3848.2
1840
t1839
2520.57
1012.99
0.0
3533.56
1841
t1840
1496.47
445.85
0.0
1942.32
1842
t1841
2571.26
1012.99
0.0
3584.25
1843
t1842
2835.21
1012.99
0.0
3848.2
1844
t1843
2835.21
1012.99
0.0
3848.2
1845
t1844
2625.42
960.184
0.0
3585.6
1846
t1845
2506.32
342.391
0.0
2848.71
1847
t1846
2277.59
342.391
0.0
2619.98
1848
t1847
1960.08
524.526
0.0
2484.6
1849
t1848
1566.77
342.391
0.0
1909.16
```
-
-
-
```julia
# Pre-processing
tstart = 470
@@ -822,7 +789,6 @@ names_emm = ["Zone 1","Zone 2","Zone 3"]
emm_tot2 = DataFrame([emm2[3:end,2] emm2[3:end,3] emm2[3:end,4]],
["Zone 1","Zone 2","Zone 3"])
-
emm_plot2 = DataFrame([collect((tstart-3):(tend-3)) emm_tot2[tstart:tend,1] repeat([names_emm[1]],(tend-tstart+1))],
["Hour","MW","Zone"]);
@@ -858,12 +824,9 @@ Plots.plot(collect((tstart-3):(tend-3)),emm1sum[tstart:tend],size=(800,400),labe
Plots.plot!(collect((tstart-3):(tend-3)),emm2sum[tstart:tend],label="No CO2 Cap",linewidth = 1.5)
```
![svg](./files/t8_emm_comp.svg)
-
-
Finally, set the CO2 Cap back to 2:
-
```julia
genx_settings_TZ["CO2Cap"] = 2
YAML.write_file((joinpath(case,"settings/genx_settings.yml")), genx_settings_TZ)
diff --git a/docs/src/Tutorials/files/t8_cap.svg b/docs/src/Tutorials/files/t8_cap.svg
index c40ef607c..a8747901c 100644
--- a/docs/src/Tutorials/files/t8_cap.svg
+++ b/docs/src/Tutorials/files/t8_cap.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file