Recent Releases of flixOpt
flixOpt - v2.1.0
Release v2.1.0
Release Date: 2025-04-11
What's Changed
- Allow Python 3.13 by @FBumann in https://github.com/flixOpt/flixopt/pull/217
- Fixes/tests by @FBumann in https://github.com/flixOpt/flixopt/pull/234
- Fixes/tests more by @FBumann in https://github.com/flixOpt/flixopt/pull/239
- Feature/binary models by @FBumann in https://github.com/flixOpt/flixopt/pull/235
Improvements
- Add logger warning if relative_minimum is used without on_off_parameters in Flow, as this prevents the flow_rate from switching "OFF"
- Python 3.13 support added
- Greatly improved internal testing infrastructure by leveraging linopy's testing framework
Bug Fixes
- Bugfixing the lower bound of
flow_rate
when using optional investments without OnOffParameters. - Fixes a Bug that prevented divest effects from working.
- added lower bounds of 0 to two unbounded vars (only numerical better)
Breaking Changes
- We restructured the modeling of the On/Off state of FLows or Components. This leads to slightly renaming of variables and constraints.
Variable renaming
- "...|consecutive_on_hours" is now "...|ConsecutiveOn|hours"
- "...|consecutive_off_hours" is now "...|ConsecutiveOff|hours"
Constraint renaming
- "...|consecutive_on_hours_con1" is now "...|ConsecutiveOn|con1"
- "...|consecutive_on_hours_con2a" is now "...|ConsecutiveOn|con2a"
- "...|consecutive_on_hours_con2b" is now "...|ConsecutiveOn|con2b"
- "...|consecutive_on_hours_initial" is now "...|ConsecutiveOn|initial"
- "...|consecutive_on_hours_minimum_duration" is now "...|ConsecutiveOn|minimum"
The same goes for "...|consecutive_off..." --> "...|ConsecutiveOff|..."
Full Changelog: https://github.com/flixOpt/flixopt/compare/v2.0.1...v2.1.0
Energy Systems - Energy System Modeling Frameworks
- Python
Published by FBumann 22 days ago
flixOpt - v2.0.1
What's Changed
- Replace "|" with "__" by @PStange in https://github.com/flixOpt/flixopt/pull/225
- Add warning if relative_minimum is used without on_off_parameters by @FBumann in https://github.com/flixOpt/flixopt/pull/226
- Bugfix of load_factor? by @FBumann in https://github.com/flixOpt/flixopt/pull/231
New Contributors
- @PStange made their first contribution in https://github.com/flixOpt/flixopt/pull/225
Full Changelog: https://github.com/flixOpt/flixopt/compare/v2.0.0...v2.0.1
Energy Systems - Energy System Modeling Frameworks
- Python
Published by FBumann 23 days ago
flixOpt - v2.0.0
Release v2.0.0
Release Date: March 29, 2025
π Major Framework Changes
- Migration from Pyomo to Linopy: Completely rebuilt the optimization foundation to use Linopy instead of Pyomo
- Significant performance improvements, especially for large models
- Internal useage of linopys mathematical modeling language
- xarray-Based Data Architecture: Redesigned data handling to rely on xarray.Dataset throughout the package for:
- Improved solution representation and analysis
- Enhanced time series management
- Consistent serialization across all elements
- Reduced file size and improved performance
- Saving and restoring unsolved Models: The FlowSystem is now fully serializable and can be saved to a file.
- Share your work with others by saving the FlowSystem to a file
- Load a FlowSystem from a file to extend or modify your work
π§ Key Improvements
Model Handling
- Extend every flixopt model with the linopy language: Add any additional constraint or variable to your flixopt model by using the linopy language.
- Full Model Export/Import: As a result of the migration to Linopy, the linopy.Model can be exported before or after the solve.
- Improved Infeasible Model Handling: Added better detection and reporting for infeasible optimization models
- Improved Model Documentation: Every model can be documented in a .yaml file, containing human readable mathematical formulations of all variables and constraints. THis is used to document every Calculation.
Calculation Results and documentation:
The CalculationResults
class has been completely redesigned to provide a more streamlined and intuitive interface.
Accessing the results of a Calculation is now as simple as:
fx.FullCalculation('Sim1', flow_system)
calculation.solve(fx.solvers.HighsSolver())
calculation.results # This object can be entirely saved and reloaded to file without any information loss
This access doesn't change if you save and load the results to a file or use them in your script directly!
- Improved Documentation: The FlowSystem as well as a model Documentation is created for every model run.
- Results without saving to file: The results of a Calculation can now be properly accessed without saving the results to a file first.
- Unified Solution exploration: Every
Calculation
has aCalculation.results
attribute, which accesses the solution. This can be saved and reloaded without any information loss. - Improved Calculation Results: The results of a Calculation are now more intuitive and easier to access. The
CalculationResults
class has been completely redesigned to provide a more streamlined and intuitive interface.
Data Management & I/O
- Unified Serialization: Standardized serialization and deserialization across all elements
- Compression Support: Added data compression when saving results to reduce file size
- to_netcdf/from_netcdf Methods: Added for FlowSystem and other core components
Details
TimeSeries Enhancements
- xarray Integration: Redesigned TimeSeries to depend on xr.DataArray
- datatypes: Added support for more datatypes, with methods for conversion to TimeSeries
- Improved TimeSeriesCollection: Enhanced indexing, representation, and dataset conversion
- Simplified Time Management: Removed period concepts and focused on timesteps for more intuitive time handling
π Documentation
- Improved documentation of the FlixOpt API and mathematical formulations
- Google Style Docstrings: Updated all docstrings to Google style format
π Dependencies
- Linopy: Added as the core dependency replacing Pyomo
- xarray: Now a critical dependency for data handling and file I/O
- netcdf4: Dependency for fast and efficient file I/O
Dropped Dependencies
- pyomo: Replaced by linopy as the modeling language
π Migration Notes
This version represents a significant architecture change. If you're upgrading:
- Code that directly accessed Pyomo models will need to be updated to work with Linopy
- Data handling now uses xarray.Dataset throughout, which may require changes in how you interact with results
- The way labels are constructed has changed throughout the system
- The results of calculations are now handled differently, and may require changes in how you access results
- The framework was renamed from flixOpt to flixopt. Use
import flixopt as fx
.
For complete details, please refer to the full commit history.
Installation
pip install flixopt==2.0.0
Upgrading
pip install --upgrade flixopt
Full Changelog: https://github.com/flixOpt/flixopt/compare/v1.0.12...v2.0.0
Energy Systems - Energy System Modeling Frameworks
- Python
Published by FBumann about 1 month ago
flixOpt - Deploy docs
Energy Systems - Energy System Modeling Frameworks
- Python
Published by FBumann about 2 months ago
flixOpt - v1.0.12
Release flixOpt on Pypi
Finally, flixOpt is available on Pypi
Full Changelog: https://github.com/flixOpt/flixopt/compare/v1.0.11...v1.0.12
Energy Systems - Energy System Modeling Frameworks
- Python
Published by FBumann about 2 months ago
flixOpt - v1.0.11
What's Changed
- Make flixOpt work without having the package "tsam" installed. by @FBumann in https://github.com/flixOpt/flixopt/pull/175
Full Changelog: https://github.com/flixOpt/flixopt/compare/v1.0.10...v1.0.11
Energy Systems - Energy System Modeling Frameworks
- Python
Published by FBumann about 2 months ago
flixOpt - v1.0.10
Bugfixes:
- Bug when using a Flow with
fixed relative profile
in combination with nofixed size
.
Others:
- Simplified logic in FlowModel
Full Changelog: https://github.com/flixOpt/flixOpt/compare/v1.0.9...v1.0.10
Energy Systems - Energy System Modeling Frameworks
- Python
Published by FBumann about 2 months ago
flixOpt - v1.0.9
Release Notes for v1.0.9
Bug Fixes
- BUGFIX: initial value of consecutive duration is now reliably fixed
- Fixed a bug that always fixed the first timestep of the binary on/off variable when consecutive on/off hours are used. This previously led to an infeasibility if both
consecutive_on_hours_min
andconsecutive_off_hours_min
were used. Now, the initial state is only fixed if the previous value is greater than zero.
- Fixed a bug that always fixed the first timestep of the binary on/off variable when consecutive on/off hours are used. This previously led to an infeasibility if both
Others
- Introduce automatic version setting in pyproject.toml (#166) by @FBumann in https://github.com/flixOpt/flixOpt/pull/167
Full Changelog: https://github.com/flixOpt/flixOpt/compare/v1.0.8...v1.0.9
Energy Systems - Energy System Modeling Frameworks
- Python
Published by FBumann 2 months ago
flixOpt - v1.0.8
Bugfixes and decreased json file size
What's changed
- Bugfix in OnOffModel in special cases. A threshold is ensured in the OnOffModel in all cases (even with relative minimum is 0 or minimum_size is 0 by @FBumann
- Bugfix in class SourceAndSink: prevent_simultanious_flows now works as expected by @FBumann
- Remove indents from json files depending on the length of the time_series (currently 50) by @FBumann in https://github.com/flixOpt/flixOpt/pull/155
Full Changelog: https://github.com/flixOpt/flixOpt/compare/v1.0.7...v1.0.8
Energy Systems - Energy System Modeling Frameworks
- Python
Published by FBumann 2 months ago
flixOpt - v1.0.7
Add json export to FlowSystem
Based on the already existing dumping methods, a new method to write information about Elements and Flow System to .json files.
The Infos are stored in the .yaml file of the results, user "FlowSystem".
Energy Systems - Energy System Modeling Frameworks
- Python
Published by baumbude 3 months ago
flixOpt - v1.0.5
What's Changed
- structure.py: bugfix in normalized_center_of_mass() by @baumbude in https://github.com/flixOpt/flixOpt/pull/149
- removed resolving paths to prevent errors by @FBumann in https://github.com/flixOpt/flixOpt/pull/150
Full Changelog: https://github.com/flixOpt/flixOpt/compare/v1.0.4...v1.0.5
Energy Systems - Energy System Modeling Frameworks
- Python
Published by FBumann 3 months ago
flixOpt - v1.0.4
v1.0.4
Backwards incompatible changes
Parameter can_be_off
of class Flow
renamed to on_off_parameters
.
Fixes: Information about OnOffParameters missing in data.json and .infos()
Improve representation of arrays in print()
- Integrated "normed center of mass" in str_representation of array. Dadurch werden [0, 0, 1] von [1, 0, 0] und [0, 1, 0] unterscheidbar.
length
gekΓΌrzt auflen
Arrays in Elements are now printed as:
{'fixed_relative_profile': 'Array (min=0.00, max=110.00, mean=46.67, median=20.00, std=41.10, len=108, center=0.50)'}
Full Changelog: https://github.com/flixOpt/flixOpt/compare/v1.0.3...v1.0.4
Energy Systems - Energy System Modeling Frameworks
- Python
Published by FBumann 3 months ago
flixOpt - Bugfix in printing
Bugfix the printing of Components. Information about inputs and outputs was only the label of the Flows
Full Changelog: https://github.com/flixOpt/flixOpt/compare/v1.0.2...v1.0.3
Energy Systems - Energy System Modeling Frameworks
- Python
Published by FBumann 3 months ago
flixOpt - flixOpt 1.0.2
Improve Testing Infrastructure and Code quality
Linting and formating
Using ruff, the whole codebase was linted and formatted running ruff check .
and ruff format
Linting was also added to CI-CD. This ensures code quality throughout the project.
Following the Linting rules is easy by running ruff check . --fix
before every push.
The rules of listing and formatting are specified in pyproject.toml
. ruff
was added to the dev-dependencies
Tests
New functional_tests.py with a minimal but effective Test structure was created.
Consecutive hours
Considering previous_flow_rate when calculating the onsecutive_on_hours / off hours.
This increases the capabilities for short therm optimization, this would be a nice addition.
Especially for SegmentedCalculation, this can significantly impact results.
Improving the internal data structures
In order to make all elements in a FLowSystem more easily accessible, they are now stored in Dictionaries instead of lists.
Improved exporting
The Representations as dict and str are improved and the logic was simplified.
For the new improved printing, the package rich
is used.
Energy Systems - Energy System Modeling Frameworks
- Python
Published by FBumann 3 months ago
flixOpt - v1.0.1
flixOpt 1.0.1
In Short
- Feature/66 change default values of network visualization by @FBumann in https://github.com/flixOpt/flixOpt/pull/117
- Feature/config by @FBumann in https://github.com/flixOpt/flixOpt/pull/121
- Devs/empty dicts by @FBumann in https://github.com/flixOpt/flixOpt/pull/119
- flixOpt 1.0.1 by @FBumann in https://github.com/flixOpt/flixOpt/pull/122
Full Changelog: https://github.com/flixOpt/flixOpt/compare/v1.0.0...v1.0.1
This patch includes the following changes:
- a config file for flixOpt, which the user can overwrite
- default values being stored as empty dicts or empty lists instead of None whoever possible
- default values in network visualization improved
- typo in attribute of class CoolingTower fixed
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')
{}
/ []
instead of None
Default values changed: Instead of using None to represent the absence of certain values, empty Lists and Dictionaries are now used (when applicable).
This enables iterating over them easier.
LinearConverter
- conversion_factors
- segmented_conversion_factors
Flow
- effects_per_flow_hour
InvestParameters
- fix_effects
- specific_effects
- divest_effects
OnOffParameters
- effects_per_switch_on
- effects_per_running_hour
aggregation.py
AggregationParameters
- time_series_for_high_peaks
- time_series_for_low_peaks
Aggregation
- weights
- time_series_for_high_peaks
- time_series_for_low_peaks
Other improvements:
Improved an Exception message in CalculationResults.to_dataframe(), regarding not found Elements
Energy Systems - Energy System Modeling Frameworks
- Python
Published by FBumann 4 months ago
flixOpt - v1.0.0
flixOpt v1.0.0
Months of work come to an end, resulting in a big new release of flixOpt
This rework targets the following issues of the flixOpt package:
Following PEP 8 for naming conventions
This lead to renaming pretty much all classes, functions and attributes. We are confident, that every renaming was done carefully and made the package easier to understand and more concise.
Highlights are:
- nominal_val was renamed to size
- val was renamed to flow_rate
- onHours to consecutive_on_hours
- ...
Simplifying the user interface
flixOpt is now meant to be imported as import flixOpt as fx
. All relevant classes and functions will be available from there.
fx.Flow()
fx.Effect
fx.FullCalculation
fx.FlowSystem
fx.LinearConverter()
fx.Sink()
More is available through sub-modules:
fx.linear_converters.Boiler()
fx.linear_converters.CHP()
fx.solvers.HighsSolver()
explore by typing fx.
and look for hints by your IDE
Changing the Hierarchy of classes
In conjunction with renaming, the package was restructured thoroughly.
Following highlights are to be named here:
- splitting different calculation types into several classes (FullCaluclation, AggregatedCalcultion, Segmented Calculation)
- Splitting the initiation of an Element (Flow, Bus, Effect, ...) form its mathematical modeling (FlowModel, BusModel, EffectModel). This greatly streamlines the interaction of Elements and Models, making the modeling much easier to understand. Further, this makes the implementation of new Features is way easier
- Grouping parameters into classes and removing **kwargs from all elements: New classes InvestmentParameters and OnOffParameters are introduced, to centralize the documentation of them. This makes optional kwargs obsolete
Decoupling of math_modeling.py
The core of flixOpt, handling Variables, Constraints and the translation to pyomo (or other modeling languages) was greatly improved. It was completely decoupled from the rest of the package, making it actually usable for other purposes. Further, The Interfaces to solvers where moved into individual classes, accessible through solvers.py
Saving results to .json
Prior to this rework, the results of a Calculation were saved as a .yaml file for metadata and a .pickle file for the actual results. The .pickle format brings several issues through its nature of deserializing python objects, leading to security issues and issues with opening the file without having the unmodified python source code for the classes. To resolve these issues, the results of a flixOpt Calculation are now saved as .json instead of .pickle
Further, the .yaml file and .json file are now clearly structured and constructed in an easy to understand matter. This emnables for easy adoptions and changes in the future, and paths the way for simpler automated evaluation of results.
The .yaml file now holds all input parameters of the constructed FlowSystem, improving later evaluation possibilities.
The structure of both files is greatly improved and streamlined, improving automated evaluations and human readability.
Evaluation of results
As the results are now saved as a json file, the results can be analyzed anywhere and anytime. But flixOpt provides a .results.py module, which simplifies the process, providing several functions and classed for analyzing results and creating nice plots. These plots can be used as a baseline, or further modified by the user.
The plotting.py module, which the .results.yp relies on, can be used for that. But the user can modify the plots in any way he likes
This rework further brings new functionality
Logging
- Proper Logging with pretty formatting is introduced, as well as saving the log to file
fx.setup_logging()
for customizing the setup
Visualizing the FlowSystem as a Network
- using pyvis, the created FlowSystem can now be visualized as an interactive html and shown in the browser. This enables for quick debugging and documentation.
Changing attributes of Elements (Flow, Component, ...) after initiation
- The attributes of Elements are not transformed into other datatypes before FLowSystem is modeled. This enables the user to change attributes of Elements after creation without issues.
Testing
- No Changes except name changes were made in tests. All Tests passing
- examples were added to the test routine, to make sure they don't throw errors
Other changes
- flixOpt now uses the modern
pyproject.toml
instead ofsetup.py
- Output of HiGHS-Solver is printed to console (unfortunately only after the solve, and not in real time)
Bug fixes
- The were basically no Bigs in the mathematical modeling itself. The reworks main purpose was to simplify the modeling process, to enable new features to be introduced, as well as to improve user experience.
Known issues
- Solver output is not inserted into the flixOpt logger, and only printed to console.
- Solver interfaces only accept a few parameters
- Although type-hinted, no checks are performed to make sure the right datatypes are passed to Elements of flixOpt. We strongly recommend to make sure to not pass
pd.DataFrames
orpd.Series
objects, but instead convert them tonumpy.array()
by calling
series = pd.Series([1, 2, 3, 4])
array = series.to_numpy() # Output: [1 2 3 4]
# Or for DataFrames
df = pd.DataFrame({'A': [1, 2, 3, 4]})
array = df['A'].to_numpy() # Output: [1 2 3 4]
Removed Functionality
Some of the functionality of flixOpt were removed. Many of them will be readied in the future, but with a different implementation:
- Medium: Buses and Flows don't accept a Medium anymore. This was used for validation. We plan on reintroducing this with added functionality to the evaluation of results.
- plotting: The potting in general was made much simpler. Currently, we sacrificed some plots for this simpler interface (pie charts, sorted charts ('Jahresdauerlinie)).
Contributors
Felix Bumann
Reviewers
Peter Stange
Felix Panitz
Energy Systems - Energy System Modeling Frameworks
- Python
Published by FBumann 5 months ago
flixOpt - v0.2.0 - Initial Release of flixOpt
Initial Release of flixOpt
After being in development, this marks the first official release of flixOpt.
flixOpt and all its dependencies (including a solver) are now easily installable via pip (see README.md)
This release is a crucial part in preparation of a major new release with breaking changes, like new class names, module names and more.
API Changes
- HiGHS-Solver API established - Open Source and faster than other open source solvers - https://highs.dev/#docs
- Tutorial as Python Notebook added
- Time-stamp labeling in .csv export of results enabled
New features
- Limits per Time step for effects introduced
- New Concept "exists" introduced.
- This Attribute allows for multi-period investments.
- Sets The upper limit for TS_Variables to 0 when Component or Flow does not exist.
- The existence of flows is limited by the existence of the Component it is assigned to.
- Vice versa, it's possible that a Flow does not yet exist while its component does (for ex. multiple grid connections).
- The concept is introduced but, some aspects are not yet perfectly implemented.
- str() and repr() methods added for major classes, which enables the printing of a system configuration for documentation and debugging purposes
- Type Hints are added, improving readability and ease of use
- New Module flixCompsExperimental.py with a experimental and early state implementation of a CHP-Plant with variable rate between heat and power
Bug fixes
- Fixed onHoursSum_max & min in Flows
- Fixed Segmented Modeling
- Fixed max_rel in combination with no Investment in class Storage
Other changes
- Proper tests are introduced for better and safer future developments
Known issues
- onHoursSum_max & min are not yet working in Components (raises Error). Use Flow instead.
- exists is still in early state:
- on single flows does not work with segmentsOfFlows. use exists in Component
- does not affect all properties that might be expected:
- cFlow: on_valuesBeforeBegin, valuesBeforeBegin are still before the begin of the model, not at the time step before existence
- cStorage: chargeState0_inFlowHours, charge_state_end_min, charge_state_end_max and fracLossPerHour are not affected by "exists". Only the available capacity is limited to 0
Contributors
Felix Bumann
Felix Panitz
Peter Stange
Energy Systems - Energy System Modeling Frameworks
- Python
Published by FBumann 10 months ago