ThermoData¶
-
class
thermosteam.
ThermoData
(data: dict)[source]¶ Create a ThermoData object for creating thermodynamic property packages and streams.
- Parameters
data (dict) –
Examples
>>> import thermosteam as tmo >>> data = { ... 'Chemicals': { ... 'Water': {}, ... 'Ethanol': {}, ... 'O2': {'phase': 'gas'}, ... 'Cellulose': { ... 'search_db': False, ... 'phase': 'solid', ... 'formula': 'C6H10O5', ... 'Hf': -975708.8, ... 'default': True ... }, ... 'Octane': {} ... }, ... 'Synonyms': { ... 'Water': 'H2O', ... 'Ethanol': [ ... 'CH3CH2OH', ... 'EthylAlcohol', ... ] ... }, ... 'Streams': { ... 'process_water': { ... 'Water': 500, ... 'units': 'kg/hr', ... 'price': 0.00035, ... }, ... 'gasoline': { ... 'Octane': 400, ... 'units': 'kg/hr', ... 'price': 0.756, ... }, ... } ... } >>> thermo_data = tmo.ThermoData(data) >>> chemicals = thermo_data.create_chemicals() >>> chemicals CompiledChemicals([Water, Ethanol, O2, Cellulose, Octane]) >>> tmo.settings.set_thermo(chemicals) >>> thermo_data.create_streams() [<Stream: process_water>, <Stream: gasoline>]
It is also possible to create a ThermoData object from json or yaml files For example, lets say we have a yaml file that looks like this:
# File name: example_chemicals.yaml Chemicals: Water: Ethanol: O2: phase: gas Cellulose: search_db: False phase: solid formula: C6H10O5 Hf: -975708.8 default: True Octane: Synonyms: Water: H2O Ethanol: - CH3CH2OH - EthylAlcohol
Then we could create the chemicals in just a few lines:
>>> # thermo_data = tmo.ThermoData.from_yaml('example_chemicals.yaml') >>> # thermo_data.create_chemicals() >>> # CompiledChemicals([Water, Ethanol, O2, Cellulose, Octane])
-
classmethod
from_yaml
(file)[source]¶ Create a ThermoData object from a yaml file given its directory.
-
classmethod
from_json
(file)[source]¶ Create a ThermoData object from a json file given its directory.
-
create_streams
(IDs=None)[source]¶ Create streams from data.
- Parameters
IDs=None (Iterable[str] or str, optional) – IDs of streams to create. Defaults to all streams.
-
create_chemicals
(IDs=None)[source]¶ Create streams from data.
- Parameters
IDs=None (Iterable[str] or str, optional) – IDs of chemicals to create. Defaults to all chemicals.
-
set_synonyms
(chemicals)[source]¶ Set synonyms to chemicals.
- Parameters
chemicals (CompiledChemicals) –