• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

GenXProject / GenX / #371

14 Sep 2023 02:22AM UTC coverage: 0.271%. First build
#371

Pull #546

travis-ci

Pull Request #546: Thermal+storage (fusion, maintenance)

630 of 630 new or added lines in 9 files covered. (100.0%)

12 of 4424 relevant lines covered (0.27%)

0.27 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/load_inputs/load_fuels_data.jl
1
@doc raw"""
2
    load_fuels_data!(setup::Dict, path::AbstractString, inputs::Dict)
3

4
Read input parameters related to fuel costs and CO$_2$ content of fuels
5
"""
6
function load_fuels_data!(setup::Dict, path::AbstractString, inputs::Dict)
×
7

8
    # Fuel related inputs - read in different files depending on if time domain reduction is activated or not
9
    TDR_directory = joinpath(path, setup["TimeDomainReductionFolder"])
×
10
    # if TDR is used, my_dir = TDR_directory, else my_dir = "system"
×
11
    my_dir = get_systemfiles_path(setup, TDR_directory, path)
×
12

13
    filename = "Fuels_data.csv"
×
14
    fuels_in = load_dataframe(joinpath(my_dir, filename))
15

×
16
    for nonfuel in ("None",)
×
17
        ensure_column!(fuels_in, nonfuel, 0.0)
18
    end
×
19

×
20
    # Fuel costs & CO2 emissions rate for each fuel type
×
21
    fuels = names(fuels_in)[2:end]
×
22
    costs = Matrix(fuels_in[2:end, 2:end])
23
    CO2_content = fuels_in[1, 2:end] # tons CO2/MMBtu
24
    fuel_costs = Dict{AbstractString, Array{Float64}}()
25
    fuel_CO2 = Dict{AbstractString, Float64}()
26

×
27
    scale_factor = setup["ParameterScale"] == 1 ? ModelScalingFactor : 1
×
28

×
29
    for i in 1:length(fuels)
×
30
        # fuel cost is in $/MMBTU w/o scaling, $/Billon BTU w/ scaling
×
31
        fuel_costs[fuels[i]] = costs[:, i] / scale_factor
32
        # No need to scale fuel_CO2, fuel_CO2 is ton/MMBTU or kton/Billion BTU 
×
33
        fuel_CO2[fuels[i]] = CO2_content[i]
34
    end
×
35

×
36
    inputs["fuels"] = fuels
37
    inputs["fuel_costs"] = fuel_costs
×
38
    inputs["fuel_CO2"] = fuel_CO2
39

40
    println(filename * " Successfully Read!")
×
41

×
42
    return fuel_costs, fuel_CO2
×
43
end
44

×
45
function ensure_column!(df::DataFrame, col::AbstractString, fill_element)
46
    if col ∉ names(df)
×
47
        df[!, col] = fill(fill_element, nrow(df))
48
    end
49
end
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc