Skip to content

Feature/config#121

Merged
FBumann merged 10 commits intonext/patchfrom
feature/config
Jan 11, 2025
Merged

Feature/config#121
FBumann merged 10 commits intonext/patchfrom
feature/config

Conversation

@FBumann
Copy link
Copy Markdown
Member

@FBumann FBumann commented Jan 11, 2025

Adding a CONFIG to flixOpt

To control central behaviour of flixOpt without hard coding it, we introduce a CONFIG.
a default config is provided and loaded when importing the package.
The values are validated on import.
CUrrently there are Configs for:

Logging

  • logging_level
  • logging_file
  • rich: use the rich logging (for terminal formatting)

modeling

  • BIG
  • EPSILON
  • BIG_BINARY_BOUND

If the user desires to change these values, he has to provide his own config_file.

import flixOpt as fx

import numpy as np

if __name__ == '__main__':
    fx.CONFIG.load_config('new_config.yaml')
    # --- Define Thermal Load Profile ---
    # Load profile (e.g., kW) for heating demand over time
    thermal_load_profile = np.array([30., 0., 20.])
    ...

This has to be done at the beginning of your script, to work as expected.
This is currently the only way to reliably change the config values!

To change the logging level without a config file, use the existing function:

fx.change_logging_level('DEBUG')

@FBumann FBumann mentioned this pull request Jan 11, 2025
@FBumann FBumann merged commit 51d3a46 into next/patch Jan 11, 2025
@FBumann FBumann deleted the feature/config branch January 14, 2025 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant