Skip to content
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
cc7de38
Feature/398 feature facet plots in results (#419)
FBumann Oct 18, 2025
fedd6b6
Feature/398 feature facet plots in results heatmaps (#418)
FBumann Oct 18, 2025
84aa03d
Feature/398 feature facet plots in results charge state (#417)
FBumann Oct 18, 2025
51da844
Fix Error handling in plot_heatmap()
FBumann Oct 18, 2025
b94f223
Feature/398 feature facet plots in results pie (#421)
FBumann Oct 18, 2025
b2b8eb7
6. Optimized time-step check
FBumann Oct 18, 2025
c747faf
Typo
FBumann Oct 18, 2025
bf4e33d
Improve type handling
FBumann Oct 18, 2025
0c5764c
Update other tests
FBumann Oct 18, 2025
59ada64
Handle backwards compatability
FBumann Oct 18, 2025
b56ed12
Add better error messages if both new and old api are used
FBumann Oct 18, 2025
980d7de
Add old api explicitly
FBumann Oct 18, 2025
9aea60e
Add old api explicitly
FBumann Oct 18, 2025
922a95f
Improve consistency and properly deprectae the indexer parameter
FBumann Oct 18, 2025
bd88fb1
Remove amount of new tests
FBumann Oct 18, 2025
f156d3a
Remove amount of new tests
FBumann Oct 18, 2025
ab9e4a8
Fix CONTRIBUTING.md
FBumann Oct 18, 2025
a77b942
Remove old test file
FBumann Oct 18, 2025
18ba271
Add tests/test_heatmap_reshape.py
FBumann Oct 18, 2025
894533c
Add tests/test_heatmap_reshape.py
FBumann Oct 18, 2025
30ab7ec
Remove unused method
FBumann Oct 18, 2025
4763c29
- Implemented dashed line styling for "mixed" variables (variables …
FBumann Oct 18, 2025
e180e88
- Added fill parameter to module-level plot_heatmap function (line …
FBumann Oct 18, 2025
9c3c580
- Added np.random.seed(42) for reproducible test results
FBumann Oct 18, 2025
5938829
Improve Error Message if too many dims for matplotlib
FBumann Oct 18, 2025
33cd72a
Improve Error Message if too many dims for matplotlib
FBumann Oct 18, 2025
505edca
Improve Error Message if too many dims for matplotlib
FBumann Oct 18, 2025
33c4bec
Rename _apply_indexer_to_data() to _apply_selection_to_data()
FBumann Oct 19, 2025
b37dc6a
Bugfix
FBumann Oct 19, 2025
9ce25ab
Update CHANGELOG.md
FBumann Oct 19, 2025
bbad6cb
Catch edge case in with_plotly()
FBumann Oct 19, 2025
92d0590
Add strict=True
FBumann Oct 19, 2025
ae05346
Improve scenario_example.py
FBumann Oct 19, 2025
904be27
Improve scenario_example.py
FBumann Oct 19, 2025
2c8bd7f
Change logging level in essage about time reshape
FBumann Oct 19, 2025
55dfde9
Update CHANGELOG.md
FBumann Oct 19, 2025
9cef222
Merge remote-tracking branch 'origin/main' into feature/plots-with-fa…
FBumann Oct 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Thanks for your interest in contributing to FlixOpt! 🚀

2. **Install for Development**
```bash
pip install -e ".[full]"
pip install -e ".[full, dev, docs]"
```

3. **Make Changes & Submit PR**
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ If upgrading from v2.x, see the [Migration Guide](https://flixopt.github.io/flix


### ✨ Added
- Added faceting and animation options to plotting methods

### 💥 Breaking Changes

### ♻️ Changed
- Changed indexer behaviour. Defaults to not indexing instead of the first value except for time. Also changed naming when indexing.

### 🗑️ Deprecated

Expand Down
19 changes: 9 additions & 10 deletions examples/04_Scenarios/scenario_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@

if __name__ == '__main__':
# Create datetime array starting from '2020-01-01' for the given time period
timesteps = pd.date_range('2020-01-01', periods=9, freq='h')
timesteps = pd.date_range('2020-01-01', periods=9 * 20, freq='h')
scenarios = pd.Index(['Base Case', 'High Demand'])
periods = pd.Index([2020, 2021, 2022])

# --- Create Time Series Data ---
# Heat demand profile (e.g., kW) over time and corresponding power prices
heat_demand_per_h = pd.DataFrame(
{'Base Case': [30, 0, 90, 110, 110, 20, 20, 20, 20], 'High Demand': [30, 0, 100, 118, 125, 20, 20, 20, 20]},
{
'Base Case': [30, 0, 90, 110, 110, 20, 20, 20, 20] * 20,
'High Demand': [30, 0, 100, 118, 125, 20, 20, 20, 20] * 20,
},
index=timesteps,
)
power_prices = np.array([0.08, 0.09, 0.10])
Expand Down Expand Up @@ -79,11 +82,11 @@
discharging=fx.Flow('Q_th_unload', bus='Fernwärme', size=1000),
capacity_in_flow_hours=fx.InvestParameters(effects_of_investment=20, fixed_size=30, mandatory=True),
initial_charge_state=0, # Initial storage state: empty
relative_maximum_charge_state=np.array([80, 70, 80, 80, 80, 80, 80, 80, 80]) * 0.01,
relative_maximum_final_charge_state=0.8,
relative_maximum_charge_state=np.array([80, 70, 80, 80, 80, 80, 80, 80, 80] * 20) * 0.01,
relative_maximum_final_charge_state=np.array([0.8, 0.5, 0.1]),
eta_charge=0.9,
eta_discharge=1, # Efficiency factors for charging/discharging
relative_loss_per_hour=0.08, # 8% loss per hour. Absolute loss depends on current charge state
relative_loss_per_hour=np.array([0.1, 0.2]), # Assume 10% or 20% losses per hour in the scenarios
prevent_simultaneous_charge_and_discharge=True, # Prevent charging and discharging at the same time
)

Expand Down Expand Up @@ -134,11 +137,7 @@
print(df)

# Plot charge state using matplotlib
fig, ax = calculation.results['Storage'].plot_charge_state(engine='matplotlib')
# Customize the plot further if needed
ax.set_title('Storage Charge State Over Time')
# Or save the figure
# fig.savefig('storage_charge_state.png')
calculation.results['Storage'].plot_charge_state()

# Save results to file for later usage
calculation.results.to_file()
Loading