Skip to content

definitions

read_definitions

read_definitions

Description

Reads YAML files from definitions directory, extracts tags, inserts tags into definitions, replaces tokens in definitions, and returns the updated definitions.

Usage

read_definitions(definitions_dir, flows, techs)

Arguments

Argument Description
definitions_dir Character. Path leading to the definitions.
flows List. Dictionary containing the different flow types. Each key represents a flow type, the corresponding value is a dictionary containing key value pairs of attributes like density, energy content and their values.
techs List. Dictionary containing information about different technologies. Each key in the dictionary represents a unique technology ID, and the corresponding value is a dictionary containing various specifications for that technology, like 'description', 'class', 'primary output' etc.

Return Value

List. Dictionary containing the definitions after processing and replacing tags and tokens.

replace_tags

replace_tags

Description

Replaces specified tags in dictionary keys and values with corresponding items from another dictionary.

Usage

replace_tags(definitions, tag, items)

Arguments

Argument Description
definitions List. Dictionary containing the definitions, where the tags should be replaced by the items.
tag Character. String to identify where replacements should be made in the definitions. Specifies the placeholder that needs to be replaced with actual values from the items dictionary.
items List. Dictionary containing the items from which to replace the definitions.

Return Value

List. Dictionary containing the definitions with replacements based on the provided tag and items.

unit_token_func

unit_token_func

Description

Takes a unit component type and a dictionary of flows, and returns a lambda function that extracts the default unit based on the specified component type from the flow dictionary.

Usage

unit_token_func(unit_component, flows)

Arguments

Argument Description
unit_component Character. Specifies the type of unit token to be returned. Possible values are 'full', 'raw', 'variant'.
flows List. Dictionary containing the flows.

Return Value

Function. Lambda function that takes a dictionary def_specs as input. The lambda function will return different values based on the unit_component parameter.