pytrnsys_process.deck.extractor.parse_deck_for_constant_expressions#
- pytrnsys_process.deck.extractor.parse_deck_for_constant_expressions(deck_as_string: str, logger: ~logging.Logger = <Logger default_pytrnsys_process (WARNING)>) dict[str, float | int][source]#
Evaluate constant expressions in a TRNSYS deck file and return their values.
This function parses a TRNSYS deck file string, identifies constant expressions, and evaluates them to their numerical values. It handles mathematical operations, functions, and variable references.
- Parameters:
deck_as_string (str) – A string containing the contents of a TRNSYS deck file.
logger (Logger) – provide your own logger. to for example log per simulation
- Returns:
variable_values – A dictionary mapping variable names to their evaluated values (float or int). The original case of variable names is preserved in the returned dictionary. Expressions that could not be evaluated are not included in the returned dictionary.
- Return type: