-
Notifications
You must be signed in to change notification settings - Fork 9
V3.0.0/main #284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V3.0.0/main #284
Changes from all commits
967174c
d24b5e7
a3c7d47
0977c1f
5cf6e0e
4cfa27f
16fd74c
67d1716
b968027
9f2f38b
dbfb1b5
6738d34
c64d12e
0499497
ee00577
a11ed92
2400244
0f9b30a
26e89a9
c0cbaae
67ebfbb
9edd1fa
d3c0c48
e6e680c
3d89b74
cc772a4
d92349e
5c2900a
8e2e949
8d3bbe9
be6572d
f63db8b
167fb2c
fc76adf
cc7b155
ec6e792
b42aad2
b55af45
d5ace96
4187f30
617600f
e80bba0
387cac6
27734cf
4915b81
fc5549a
299ff43
abc22b1
9b4c44c
0ab7ea6
1dcbbb0
9aec990
e370311
793e820
b87d979
8ec265e
a46fe64
201d066
10d2925
cf9d17f
bd52e05
aa36689
63b1c92
29062fa
18c43e4
1f9ef07
5d88fde
1e94de3
e5828ad
870efee
e97ec5f
f15113e
284072e
ebbb5dd
a501e05
1825089
126b07f
94d841d
c19edc8
36cf47d
8f1261d
89d69f0
76f51a8
0ff4d29
84c850b
8b9dabb
7e72ab5
17632f3
3c355c9
f473ce5
7869a72
bb29ef2
8d96a49
8240da1
8ac2664
43a64ea
7b67f8d
b3fe443
483ba12
dee1de4
4ec3914
2554d8a
d062727
6dc23f5
e6100d6
46f2035
6baeb8e
aeaaa83
15fd124
d0b231d
4ebe6a5
6b56dac
a7ec994
2a75ed3
dae9f01
ba195ff
605f034
6560006
78132ef
a53c116
2cb551b
d7be766
e60dd07
bd2f1b8
a7da9d2
b8f0e22
7123b6b
fa5475d
80cb161
81ad3ba
691a45e
3931ac5
75a45e1
2882147
50491ff
4f3a798
314aef9
0302947
40c437a
8d2d208
9c0c95f
d568ad6
ffc196a
6142f44
cec7367
eba1ec4
5f97bf3
9351083
99e6b19
4981a9c
516f45b
ef0acfc
706c1ec
a4cdb43
148a852
61755f9
66f6a86
a757e7f
941d93f
745e885
c9bae2a
d1b5509
c7568dd
fc62634
e320b9f
33a22aa
904211f
3c6c08b
22a1cef
44dbefc
f82556a
33460a0
ff70674
fa5e30a
a3511f9
404dc03
1ad74ce
d1408a4
ab000ca
2afc24e
b248f58
d34445c
bde07b4
5861b28
7809ee4
2bbdb44
2a01abe
1f1ebb7
c7b351f
5d9b591
5c56b63
9d242b6
0997843
1d6ef97
972cb90
29bec8c
370ac94
0f89ff0
4781cff
333ab83
9702303
91bd461
94314c3
50cc2cb
e52f800
9281256
9001c6a
286a8b7
ae1752b
1822384
2aa9d4b
5ca9707
7e04399
4f95ebc
f73fe99
2d9c920
5fd05e3
20a1964
9b05f8f
4d7fd29
3626517
50fbb67
9368985
e4ec410
66283cb
a84dfad
d2182aa
75c05ee
66a6ff1
e2e1f13
62b18b6
5f0b503
15a08e9
97de53c
25f726e
1716607
b4a9236
b7734f8
e06692b
cf0186c
5510297
b694dbe
262e8b4
2a469f1
159bcb3
e764a13
20f74f3
1474af6
be6bd42
26e091a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,115 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Investments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Current state | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| \beta_{\text{invest}} \cdot \text{max}(\epsilon, \text V^{\text L}) \leq V \leq \beta_{\text{invest}} \cdot \text V^{\text U} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| With: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - $V$ = size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - $V^{\text L}$ = minimum size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - $V^{\text U}$ = maximum size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - $\epsilon$ = epsilon, a small number (such as $1e^{-5}$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - $\beta_{invest} \in {0,1}$ = wether the size is invested or not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+5
to
+12
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix LaTeX and definition typos in the core inequality. Use proper LaTeX for max, symbols, and sets; also fix spelling/wording in definitions. Apply: -$$
-\beta_{\text{invest}} \cdot \text{max}(\epsilon, \text V^{\text L}) \leq V \leq \beta_{\text{invest}} \cdot \text V^{\text U}
-$$
+$$
+\beta_{\mathrm{invest}} \cdot \max(\varepsilon, V^{\mathrm L}) \le V \le \beta_{\mathrm{invest}} \cdot V^{\mathrm U}
+$$
@@
-- $\epsilon$ = epsilon, a small number (such as $1e^{-5}$)
-- $\beta_{invest} \in {0,1}$ = wether the size is invested or not
+- $\varepsilon$ = small positive number (e.g., $10^{-5}$)
+- $\beta_{\mathrm{invest}} \in \{0,1\}$ = whether the size is invested📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _Please edit the use cases as needed_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Quickfix 1: Optimize the single best size overall | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### Single variable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| This is already possible and should be, as this is a needed use case | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| An additional factor to when the size is actually available might me practical (Which indicates the (fixed) time of investment) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Math | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| V(p) = V * a(p) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - $V$ = size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - $a(p)$ = factor for availlability per period | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Factor $a(p)$ is simply multiplied with relative minimum or maximum(t). This is already possible by doing this yourself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Effectively, the relative minimum or maximum are altered before using the same constraiints as before. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| THis might lead to some issues regariding minimum_load factor, or others, as the size is not 0 in a scenario where the component cant produce. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| **Therefore this might not be the best choice. See (#Variable per Scenario) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+27
to
+31
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typos, grammar, and anchor link. -Factor $a(p)$ is simply multiplied with relative minimum or maximum(t). This is already possible by doing this yourself.
-Effectively, the relative minimum or maximum are altered before using the same constraiints as before.
-THis might lead to some issues regariding minimum_load factor, or others, as the size is not 0 in a scenario where the component cant produce.
-**Therefore this might not be the best choice. See (#Variable per Scenario)
+Factor $a(p)$ is simply multiplied with the relative minimum or maximum(t). This is already possible to express externally.
+Effectively, the relative minimum or maximum are altered before applying the same constraints as before.
+This might lead to issues regarding a minimum_load factor or others, since the size is not 0 in a scenario where the component can't produce.
+**Therefore this might not be the best choice. See [Variable per Scenario](#variable-per-scenario).**📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ## Variable per Scenario | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - **size** and **invest** as a variable per period $V(s)$ and $\beta_{invest}(s)$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - with scenario $s \in S$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### Usecase 1: Optimize the size for each Scenario independently | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Restrictions are seperatly for each scenario | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| No changes needed. This could be the default behaviour. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### Usecase 2: Optimize ONE size for ALL scenarios | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| The size is the same globally, but not a scalar, but a variable per scenario $V(s)$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #### 2a: The same size in all scenarios | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| V(s) = V(s') \quad \forall s,s' \in S | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| With: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - $V(s)$ and $V(s')$ = size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - $S$ = set of scenarios | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #### 2b: The same size, but can be 0 prior to the first increment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Find the Optimal time of investment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Force an investment in a certain scenario (parameter optional as a list/array ob booleans) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Combine optional and minimum/maximum size to force an investment inside a range if scenarios | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| \beta_{\text{invest}}(s) \leq \beta_{\text{invest}}(s+1) \quad \forall s \in \{1,2,\ldots,S-1\} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| V(s') - V(s) \leq M \cdot (2 - \beta_{\text{invest}}(s) - \beta_{\text{invest}}(s')) \quad \forall s, s' \in S | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| V(s') - V(s) \geq M \cdot (2 - \beta_{\text{invest}}(s) - \beta_{\text{invest}}(s')) \quad \forall s, s' \in S | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+56
to
+66
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Big‑M pair: lower bound sign is wrong; define M. The second inequality must use a negative RHS; otherwise it forces a large positive difference when any beta is 0. \beta_{\text{invest}}(s) \leq \beta_{\text{invest}}(s+1) \quad \forall s \in \{1,2,\ldots,S-1\}
@@
-V(s') - V(s) \geq M \cdot (2 - \beta_{\text{invest}}(s) - \beta_{\text{invest}}(s')) \quad \forall s, s' \in S
+V(s') - V(s) \geq -\,M \cdot (2 - \beta_{\text{invest}}(s) - \beta_{\text{invest}}(s')) \quad \forall s, s' \in S
@@
-This could be the default behaviour. (which would be consistent with other variables)
+Here, $M$ is a sufficiently large constant (Big‑M). This could be the default behaviour (consistent with other variables).📝 Committable suggestion
Suggested change
🧰 Tools🪛 markdownlint-cli2 (0.17.2)56-56: Unordered list indentation (MD007, ul-indent) 58-58: Unordered list indentation (MD007, ul-indent) 59-59: Unordered list indentation (MD007, ul-indent) 60-60: Unordered list indentation (MD007, ul-indent) 61-61: Unordered list indentation (MD007, ul-indent) 63-63: Unordered list indentation (MD007, ul-indent) 64-64: Unordered list indentation (MD007, ul-indent) 66-66: Unordered list indentation (MD007, ul-indent) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| This could be the default behaviour. (which would be consistent with other variables) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### Switch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| \begin{aligned} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| & \text{SWITCH}_s \in \{0,1\} \quad \forall s \in \{1,2,\ldots,S\} \\ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| & \sum_{s=1}^{S} \text{SWITCH}_s = 1 \\ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| & \beta_{\text{invest}}(s) = \sum_{s'=1}^{s} \text{SWITCH}_{s'} \quad \forall s \in \{1,2,\ldots,S\} \\ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| \end{aligned} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| \begin{aligned} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| & V(s) \leq V_{\text{actual}} \quad \forall s \in \{1,2,\ldots,S\} \\ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| & V(s) \geq V_{\text{actual}} - M \cdot (1 - \beta_{\text{invest}}(s)) \quad \forall s \in \{1,2,\ldots,S\} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| \end{aligned} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $$ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+70
to
+85
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Define V_actual and add non‑negativity (or lower bound). \sum_{s=1}^{S} \text{SWITCH}_s = 1 \\
\beta_{\text{invest}}(s) = \sum_{s'=1}^{s} \text{SWITCH}_{s'} \quad \forall s \in \{1,2,\ldots,S\} \\
@@
-& V(s) \leq V_{\text{actual}} \quad \forall s \in \{1,2,\ldots,S\} \\
-& V(s) \geq V_{\text{actual}} - M \cdot (1 - \beta_{\text{invest}}(s)) \quad \forall s \in \{1,2,\ldots,S\}
+& V(s) \leq V_{\text{actual}} \quad \forall s \in \{1,2,\ldots,S\} \\
+& V(s) \geq V_{\text{actual}} - M \cdot (1 - \beta_{\text{invest}}(s)) \quad \forall s \in \{1,2,\ldots,S\} \\
+& V(s) \ge 0 \quad \forall s \in \{1,2,\ldots,S\}Add a short sentence after the block: +where $V_{\text{actual}}$ is the global size variable shared across scenarios.📝 Committable suggestion
Suggested change
🧰 Tools🪛 markdownlint-cli2 (0.17.2)70-70: Unordered list indentation (MD007, ul-indent) 71-71: Unordered list indentation (MD007, ul-indent) 76-76: Strong style (MD050, strong-style) 76-76: Strong style (MD050, strong-style) 82-82: Trailing punctuation in heading (MD026, no-trailing-punctuation) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### Usecase 3: Find the best scenario to increment the size (Timing of the investment) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| The size can only increment once (based on a starting point). This allows to optimize the timing of an investment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #### Math | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Treat $\beta_{invest}$ like an ON/OFF variable, and introduce a SwitchOn, that can only be active once. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| *Thoughts:* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Treating $\beta_{invest}$ like an ON/OFF variable suggest using the already presentconstraints linked to On/OffModel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - The timing could be constraint to be first in scenario x, or last in scenario y | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Restrict the number of consecutive scenarios | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| THis might needs the OnOffModel to be more generic (HOURS). Further, the span between scenarios needs to be weighted (like dt_in_hours), or the scenarios need to be measureable (integers) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### Others | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #### Usecase 4: Only increase/decrease the size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Start from a certain size. For each scenario, the size can increase, but never decrease. (Or the other way around). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| This would mean that a size expansion is possible, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #### Usecase 5: Restrict the increment in size per scenario | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Restrict how much the size can increase/decrease for in scenario, based on the prior scenario. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Many more are possible | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -48,9 +48,9 @@ | |||||||||||||
|
|
||||||||||||||
| # TimeSeriesData objects | ||||||||||||||
| TS_heat_demand = fx.TimeSeriesData(heat_demand) | ||||||||||||||
| TS_electricity_demand = fx.TimeSeriesData(electricity_demand, agg_weight=0.7) | ||||||||||||||
| TS_electricity_price_sell = fx.TimeSeriesData(-(electricity_demand - 0.5), agg_group='p_el') | ||||||||||||||
| TS_electricity_price_buy = fx.TimeSeriesData(electricity_price + 0.5, agg_group='p_el') | ||||||||||||||
| TS_electricity_demand = fx.TimeSeriesData(electricity_demand, aggregation_weight=0.7) | ||||||||||||||
| TS_electricity_price_sell = fx.TimeSeriesData(-(electricity_demand - 0.5), aggregation_group='p_el') | ||||||||||||||
| TS_electricity_price_buy = fx.TimeSeriesData(electricity_price + 0.5, aggregation_group='p_el') | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
+51
to
54
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix sell-price series: using demand instead of price
Apply: -TS_electricity_price_sell = fx.TimeSeriesData(-(electricity_demand - 0.5), aggregation_group='p_el')
+TS_electricity_price_sell = fx.TimeSeriesData(-(electricity_price - 0.5), aggregation_group='p_el')📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| flow_system = fx.FlowSystem(timesteps) | ||||||||||||||
| flow_system.add_elements( | ||||||||||||||
|
|
@@ -164,12 +164,12 @@ | |||||||||||||
| if full: | ||||||||||||||
| calculation = fx.FullCalculation('Full', flow_system) | ||||||||||||||
| calculation.do_modeling() | ||||||||||||||
| calculation.solve(fx.solvers.HighsSolver(0, 60)) | ||||||||||||||
| calculation.solve(fx.solvers.HighsSolver(0.01 / 100, 60)) | ||||||||||||||
| calculations.append(calculation) | ||||||||||||||
|
|
||||||||||||||
| if segmented: | ||||||||||||||
| calculation = fx.SegmentedCalculation('Segmented', flow_system, segment_length, overlap_length) | ||||||||||||||
| calculation.do_modeling_and_solve(fx.solvers.HighsSolver(0, 60)) | ||||||||||||||
| calculation.do_modeling_and_solve(fx.solvers.HighsSolver(0.01 / 100, 60)) | ||||||||||||||
| calculations.append(calculation) | ||||||||||||||
|
|
||||||||||||||
| if aggregated: | ||||||||||||||
|
|
@@ -178,7 +178,7 @@ | |||||||||||||
| aggregation_parameters.time_series_for_low_peaks = [TS_electricity_demand, TS_heat_demand] | ||||||||||||||
| calculation = fx.AggregatedCalculation('Aggregated', flow_system, aggregation_parameters) | ||||||||||||||
| calculation.do_modeling() | ||||||||||||||
| calculation.solve(fx.solvers.HighsSolver(0, 60)) | ||||||||||||||
| calculation.solve(fx.solvers.HighsSolver(0.01 / 100, 60)) | ||||||||||||||
| calculations.append(calculation) | ||||||||||||||
|
|
||||||||||||||
| # Get solutions for plotting for different calculations | ||||||||||||||
|
|
@@ -194,34 +194,35 @@ def get_solutions(calcs: List, variable: str) -> xr.Dataset: | |||||||||||||
| # --- Plotting for comparison --- | ||||||||||||||
| fx.plotting.with_plotly( | ||||||||||||||
| get_solutions(calculations, 'Speicher|charge_state').to_dataframe(), | ||||||||||||||
| mode='line', | ||||||||||||||
| style='line', | ||||||||||||||
| title='Charge State Comparison', | ||||||||||||||
| ylabel='Charge state', | ||||||||||||||
| ).write_html('results/Charge State.html') | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
195
to
201
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Ensure 'results' directory exists before writing HTML Prevent FileNotFoundError when writing plots. fx.plotting.with_plotly(
get_solutions(calculations, 'Speicher|charge_state').to_dataframe(),
style='line',
title='Charge State Comparison',
ylabel='Charge state',
).write_html('results/Charge State.html')
+
+# Create once before first write_html
+pathlib.Path('results').mkdir(parents=True, exist_ok=True)
🤖 Prompt for AI Agents |
||||||||||||||
| fx.plotting.with_plotly( | ||||||||||||||
| get_solutions(calculations, 'BHKW2(Q_th)|flow_rate').to_dataframe(), | ||||||||||||||
| mode='line', | ||||||||||||||
| style='line', | ||||||||||||||
| title='BHKW2(Q_th) Flow Rate Comparison', | ||||||||||||||
| ylabel='Flow rate', | ||||||||||||||
| ).write_html('results/BHKW2 Thermal Power.html') | ||||||||||||||
|
|
||||||||||||||
| fx.plotting.with_plotly( | ||||||||||||||
| get_solutions(calculations, 'costs(operation)|total_per_timestep').to_dataframe(), | ||||||||||||||
| mode='line', | ||||||||||||||
| style='line', | ||||||||||||||
| title='Operation Cost Comparison', | ||||||||||||||
| ylabel='Costs [€]', | ||||||||||||||
| ).write_html('results/Operation Costs.html') | ||||||||||||||
|
|
||||||||||||||
| fx.plotting.with_plotly( | ||||||||||||||
| pd.DataFrame(get_solutions(calculations, 'costs(operation)|total_per_timestep').to_dataframe().sum()).T, | ||||||||||||||
| mode='bar', | ||||||||||||||
| style='stacked_bar', | ||||||||||||||
| title='Total Cost Comparison', | ||||||||||||||
| ylabel='Costs [€]', | ||||||||||||||
| ).update_layout(barmode='group').write_html('results/Total Costs.html') | ||||||||||||||
|
|
||||||||||||||
| fx.plotting.with_plotly( | ||||||||||||||
| pd.DataFrame([calc.durations for calc in calculations], index=[calc.name for calc in calculations]), 'bar' | ||||||||||||||
| pd.DataFrame([calc.durations for calc in calculations], index=[calc.name for calc in calculations]), | ||||||||||||||
| 'stacked_bar', | ||||||||||||||
| ).update_layout(title='Duration Comparison', xaxis_title='Calculation type', yaxis_title='Time (s)').write_html( | ||||||||||||||
| 'results/Speed Comparison.html' | ||||||||||||||
| ) | ||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be redone probably.