API Reference
Preliminary
Delimited-separated values (DSV file) — a text file representing tabular data by using a column delimiter char (e.g. .tsv, .csv).
As the package is built upon DelimitedFiles, a source file is loaded to RAM. Keep in mind size of your DSV files.
We suppose that a row of source datafile uniquely determined by values at first K columns (e.g. names of components). We called these columns primary keys or just keys.
Main module
CubicEoSDatabase — ModuleProvides interface for loading parameteres of components and mixtures from separated values files.
See ComponentDatabase, BinaryMixtureDatabase, getentry, getmatrix.
Out-of-box database stored in CubicEoSDatabase.Data module.
- CubicEoSDatabase.Data
- CubicEoSDatabase.AbstractTabularDatabase
- CubicEoSDatabase.ComponentDatabase
- CubicEoSDatabase.MixtureDatabase
- CubicEoSDatabase.NotFoundError
- CubicEoSDatabase.data
- CubicEoSDatabase.getentry
- CubicEoSDatabase.getmatrix
- CubicEoSDatabase.header
- CubicEoSDatabase.reference
- CubicEoSDatabase.source
Types and accessors
Private types
CubicEoSDatabase.AbstractTabularDatabase — TypeCubicEoSDatabase.AbstractTabularDatabase{K}Supertype for wrappers of databases. K is number of primary keys.
Accessors
CubicEoSDatabase.data — Functiondata(x::AbstractTabularDatabase)Returns matrix with parsed data stored in x.
CubicEoSDatabase.header — Functionheader(x::AbstractTabularDatabase)Returns collection of source file headers of x.
CubicEoSDatabase.reference — Functionreference(x::AbstractTabularDatabase)Returns biblio reference of x.
CubicEoSDatabase.source — Functionsource(x::AbstractTabularDatabase)Returns path to source file which x maps to.
Base.keys — Methodkeys(atd::AbstractTabularDatabase{K})Return an iterator over all keys in atd.
For AbstractTabularDatabase{1} key is string.
For AbstractTabularDatabase{K≥2} key is Tuple of length K with strings.
Public types
CubicEoSDatabase.ComponentDatabase — TypeComponentDatabase(source[; delim, reference]) <: AbstractTabularDatabase{1}Wraps source DSV-file formatted as separated values.
Aimed at tables with single primary key (e.g. component name).
Arguments
- source::AbstractString: path to source file
- delim::AbstractChar=',': column delimiter used in- source
- reference::AbstractString: optional biblio-reference describing- source
CubicEoSDatabase.MixtureDatabase — TypeMixtureDatabase(source[; delim, reference]) <: AbstractTabularDatabase{2}Wraps source file formatted as separated values.
Aimed at tables with two primary keys (e.g. two names of components).
Arguments
- source::AbstractString: path to source file
- delim::AbstractChar=',': column delimiter used in- source
- reference::AbstractString: optional biblio-reference describing- source
Database requests
Current implementation of requests takes $O(N)$ time, where $N$ is number of rows in source file.
CubicEoSDatabase.getentry — Functiongetentry(from::AbstractTabularDatabase{1}, key::AbstractString)Searches database from for row (entry) with first item equal to key.
Returns Dict which keys are header(from) and values are corresponding data.
Throws CubicEoSDatabase.NotFoundError if key was not found.
getentry(from::AbstractTabularDatabase{2}, key₁, key₂[; keeporder])Searches database from for row (entry) which first two items are equal to key₁ and key₂. If keeporder is true then the keys are assumed to be ordered pair (default is false).
Returns Dict which keys are header(from), and values are corresponding data.
Throws CubicEoSDatabase.NotFoundError if key pair was not found.
CubicEoSDatabase.getmatrix — Functiongetmatrix(from::AbstractTabularDatabase{2}, keys[; diag])Extracts matrices from from by unordered key pairs generated from keys.
Each matrix corresponds to a data column in from. Indices of a matrix are same as in keys. The returned matrices are symmetric with diagonal elements diag=0.0.
Returns Dict which keys are header(from) and values are matrices.
Throws CubicEoSDatabase.NotFoundError if a key pair was not found.
Arguments
- keys: collection, must support- eachindexmethod
Error handling
CubicEoSDatabase.NotFoundError — TypeCubicEoSDatabase.NotFoundError(what, where) <: ExceptionDescribes where what was not found. The where should be database object.
Data submodule
CubicEoSDatabase.jl comes with out-of-box database. It lives in public Data submodule. See Out-of-box database for details.
Each database presented in Data is cached. So only first call will allocate memory.
- CubicEoSDatabase.Data.root
- CubicEoSDatabase.Data.CachedDatabase
- CubicEoSDatabase.Data.brusilovsky_comp
- CubicEoSDatabase.Data.brusilovsky_mix
- CubicEoSDatabase.Data.martinez
CubicEoSDatabase.Data — ModuleRepository database of thermodynamical properties.
Exported methods are
- martinez()::ComponentDatabase: gas properties of substances;
- brusilovsky_comp()::ComponentDatabase: parameters of A I Brusilovskii equation of state for pure components;
- brusilovsky_mix()::MixtureDatabase: binary parameters of A I Brusilovskii equation of state for mixtures.
CubicEoSDatabase.Data.martinez — MethodData.martinez() -> ComponentDatabaseI Martinez gas properties.
CubicEoSDatabase.Data.brusilovsky_comp — MethodData.brusilovsky_comp() -> ComponentDatabaseA I Brusilovsky equation of state. Parameters for pure components.
CubicEoSDatabase.Data.brusilovsky_mix — MethodData.brusilovsky_mix() -> MixtureDatabaseA I Brusilovsky equation of state. Binary parameters for mixtures.
Internals
CubicEoSDatabase.Data.root — ConstantRoot path of database source files.
CubicEoSDatabase.Data.CachedDatabase — TypeCache of a database ::T. Stores arguments needed to initialize T.