PyPSA GlobalConstraints + Authorizing LB=UB#105
PyPSA GlobalConstraints + Authorizing LB=UB#105aoustry merged 37 commits intoAntaresSimulatorTeam:mainfrom
Conversation
Introduce a new test script to validate pypsa-eur data conversion logic. This ensures the system accurately handles PyPSA input files like those generated by PyPSA-EUR.
Commented out equality bound check in optimization logic while retaining the checks for invalid bounds. Introduced a comprehensive test script to convert and run PyPSA studies in Andromede, including utility functions for network adjustments and optimization problem building.
New test cases for the Generator model
…prototype-interop into test-pypsa-eur-2
Merge branch 'AntaresSimulatorTeam:main' into pypsa/global-constraint
Test pypsa eur 2
Managing PyPSA GlobalConstraints related to CO2 emissions
| f"Upper and lower bounds of variable {solver_var_name} have the same value: {lower_bound}" | ||
| ) | ||
| elif lower_bound > upper_bound: | ||
| # if math.isclose(lower_bound, upper_bound): |
| status = problem.solver.Solve() | ||
| assert status == problem.solver.INFEASIBLE # Infeasible | ||
|
|
||
| """ Test disabled: it is now authorized to have LB and UB with same value |
There was a problem hiding this comment.
Instead of disabling the test, you should keep it, and change the assert, i.e. check that the build runs without error / you manage to solve it with the correct output
| self.pypsa_network.global_constraints.loc[pypsa_model_id, "type"] | ||
| == "primary_energy" | ||
| ) | ||
| assert ( |
There was a problem hiding this comment.
Does this mean that you onlt handle global constraints representing co2 emissions for nnow ?
| self.pypsa_network.loads.index = ( | ||
| self.pypsa_network.loads.index.astype(str) + "_load" | ||
| ) | ||
| for key, val in self.pypsa_network.loads_t.items(): | ||
| val.columns = val.columns + "_load" |
There was a problem hiding this comment.
Duplicate of lines 159-163 ?
| max_growth=any_to_float(inf), | ||
| ) | ||
| self.pypsa_network.carriers[ | ||
| "carrier" |
There was a problem hiding this comment.
Is it intended to be "Carrier" or not ?
|
|
||
| def _convert_pypsa_components_of_given_model( | ||
| self, pysa_components_data: PyPSAComponentData | ||
| self, pypsa_components_data: PyPSAComponentData |
There was a problem hiding this comment.
The docstring of this function is not up to date
|
|
||
| def extend_quota(network: Network) -> Network: | ||
| # Temporary function, used while the GlobalConstraint model is not implemented yet. | ||
| # Set the CO2 bound to very alrge value |
There was a problem hiding this comment.
| # Set the CO2 bound to very alrge value | |
| # Set the CO2 bound to very large value |
| return network | ||
|
|
||
|
|
||
| def convert_pypsa_network( |
There was a problem hiding this comment.
As this function is also used in test_pypsa_converter.py, you can put it in a file utils.py in this directory and import it from there
| return input_system_from_pypsa_converter | ||
|
|
||
|
|
||
| def build_problem_from_system( |
No description provided.