Skip to content

Commit 7624191

Browse files
authored
Feature/v3/feature/common resources in examples (#401)
* Typo * Typos in scenario_example.py * Improve data files in examples * Improve data files in examples * Handle local install more gracefully with __version__ * Remove bad example * Increase timeout in examples * Improve test_examples.py * Improve example * Fixx Error message in test * Fix: Dependecy issue with python 3.10
1 parent 3bc90f4 commit 7624191

16 files changed

Lines changed: 66 additions & 35789 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ This replaces `specific_share_to_other_effects_*` parameters and inverts the dir
150150
- Rewrote README and landing page with clearer vision, roadmap, and universal applicability emphasis
151151
- Removed deprecated `docs/SUMMARY.md`, updated `mkdocs.yml` for new structure
152152
- Tightened docstrings in core modules with better cross-referencing
153-
- Added recipies section to docs
153+
- Added recipes section to docs
154154
155155
### 🚧 Known Issues
156156

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ We believe that optimization modeling should be **approachable for beginners** y
1919
- **Interactive tutorials**: Browser-based, reactive tutorials for learning FlixOpt without local installation (marimo)
2020
- **Standardized cost calculations**: Align with industry standards (VDI 2067) for CAPEX/OPEX calculations
2121
- **Advanced result analysis**: Time-series aggregation, automated reporting, and rich visualization options
22-
- **Recipe collection**: Community-driven library of common modeling patterns, data manipulation techniques, and optimization strategies (see [Recipes](user-guide/recipies/index.md) - help wanted!)
22+
- **Recipe collection**: Community-driven library of common modeling patterns, data manipulation techniques, and optimization strategies (see [Recipes](user-guide/recipes/index.md) - help wanted!)
2323

2424
**Long-term vision:**
2525

docs/user-guide/recipies/index.md

Lines changed: 0 additions & 47 deletions
This file was deleted.

examples/02_Complex/complex_example.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@
7575
on_hours_total_min=0, # Minimum operating hours
7676
on_hours_total_max=1000, # Maximum operating hours
7777
consecutive_on_hours_max=10, # Max consecutive operating hours
78-
consecutive_on_hours_min=np.array(
79-
[1, 1, 1, 1, 1, 2, 2, 2, 2]
80-
), # min consecutive operation hoursconsecutive_off_hours_max=10, # Max consecutive off hours
78+
consecutive_on_hours_min=np.array([1, 1, 1, 1, 1, 2, 2, 2, 2]), # min consecutive operation hours
79+
consecutive_off_hours_max=10, # Max consecutive off hours
8180
effects_per_switch_on=0.01, # Cost per switch-on
8281
switch_on_total_max=1000, # Max number of starts
8382
),
@@ -191,7 +190,7 @@
191190
flow_system.add_elements(bhkw_2) if use_chp_with_piecewise_conversion else flow_system.add_elements(bhkw)
192191

193192
pprint(flow_system) # Get a string representation of the FlowSystem
194-
flow_system.start_network_app() # Start the network app. DOes only work with extra dependencies installed
193+
flow_system.start_network_app() # Start the network app. Does only work with extra dependencies installed
195194

196195
# --- Solve FlowSystem ---
197196
calculation = fx.FullCalculation('complex example', flow_system, time_indices)

examples/03_Calculation_types/example_calculation_types.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
excess_penalty = 1e5 # or set to None if not needed
3434

3535
# Data Import
36-
data_import = pd.read_csv(pathlib.Path('Zeitreihen2020.csv'), index_col=0).sort_index()
36+
data_import = pd.read_csv(
37+
pathlib.Path(__file__).parent.parent / 'resources' / 'Zeitreihen2020.csv', index_col=0
38+
).sort_index()
3739
filtered_data = data_import['2020-01-01':'2020-01-02 23:45:00']
3840
# filtered_data = data_import[0:500] # Alternatively filter by index
3941

examples/04_Scenarios/scenario_example.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,13 @@
132132
# Convert the results for the storage component to a dataframe and display
133133
df = calculation.results['Storage'].node_balance_with_charge_state()
134134
print(df)
135-
calculation.results['Storage'].plot_charge_state(engine='matplotlib')
135+
136+
# Plot charge state using matplotlib
137+
fig, ax = calculation.results['Storage'].plot_charge_state(engine='matplotlib')
138+
# Customize the plot further if needed
139+
ax.set_title('Storage Charge State Over Time')
140+
# Or save the figure
141+
# fig.savefig('storage_charge_state.png')
136142

137143
# Save results to file for later usage
138144
calculation.results.to_file()
139-
fig, ax = calculation.results['Storage'].plot_charge_state(engine='matplotlib')

0 commit comments

Comments
 (0)