Skip to content

Commit

Permalink
Sorting out paths for files (and case)
Browse files Browse the repository at this point in the history
  • Loading branch information
braamvandyk committed Jul 13, 2024
1 parent 350e1f9 commit faf7eb9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/streams.jl
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ name of the component.
"""
function readstreamhistory!(fs, streamname, filename; ismoleflow=false)

data, header = readdlm(filename, ',', '\n', header=true)
data, header = readdlm(lowercase(filename), ',', '\n', header=true)
comps = string.(header[2:end]) # readdlm returns an array of AbstractStrings for some reason
flows = data[:, 2:end]
timestamps = DateTime.(data[:, 1], "yyyy/mm/dd HH:MM")
Expand All @@ -590,9 +590,9 @@ Writes in a stream history file (CSV file).
"""
function writestreamhistory(stream, filename, moleflow=false)
if moleflow
writetimearray(stream.moleflows, filename, format="yyyy/mm/dd HH:MM", delim=',')
writetimearray(stream.moleflows, lowercase(filename), format="yyyy/mm/dd HH:MM", delim=',')
else
writetimearray(stream.massflows, filename, format="yyyy/mm/dd HH:MM", delim=',')
writetimearray(stream.massflows, lowercase(filename), format="yyyy/mm/dd HH:MM", delim=',')
end

return nothing
Expand Down
5 changes: 0 additions & 5 deletions test/components/Argon.comp

This file was deleted.

5 changes: 0 additions & 5 deletions test/components/Nitrogen.comp

This file was deleted.

21 changes: 21 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@ using Test

@testset "Streams" begin
fs = Flowsheet()

@comp begin
"C" --> 2
"H" --> 4
end "Ethylene" fs
dummy = writecomponent(joinpath(@__DIR__, "components", "Ethylene.comp"), fs.comps["Ethylene"])
@test dummy == 25

@comp begin
"C" --> 2
"H" --> 6
end "Ethane" fs
dummy = writecomponent(joinpath(@__DIR__, "components", "Ethane.comp"), fs.comps["Ethane"])
@test dummy == 24

@comp begin
"H" --> 2
end "Hydrogen" fs
dummy = writecomponent(joinpath(@__DIR__, "components", "Hydrogen.comp"), fs.comps["Hydrogen"])
@test dummy == 21

count = readcomponentlist!(fs, joinpath(@__DIR__, "components"), ["Ethylene", "Ethane", "Hydrogen"])
@test count == 3
@test fs.comps["Ethylene"].Mr 28.053
Expand Down

0 comments on commit faf7eb9

Please sign in to comment.