Giter Site home page Giter Site logo

mesmo-dev / mesmo Goto Github PK

View Code? Open in Web Editor NEW
44.0 12.0 11.0 450.9 MB

MESMO - Multi-Energy System Modeling and Optimization

Home Page: https://mesmo-dev.github.io/mesmo

License: MIT License

Python 99.92% Dockerfile 0.08%
optimal-power-flow smart-grid multi-energy-systems

mesmo's People

Contributors

arifa7med avatar stroitzsch avatar tomschelo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mesmo's Issues

DER state space model automatic scaling / normalization

Implementation of automatic scaling / normalization of state space matrices. Thus, translation state space variables into appropriate per-unit values to avoid numerical issues during optimization in CPLEX / Gurobi.

  • Formulate scaling approach (how to define normalization base, etc.).
  • Add generalized scaling method to FlexibleDERModel.
  • Consider scaling when defining objective values.
  • Consider scaling when obtaining simulation / optimization results.
  • Validate behavior for all DER model types.

Optimization solver interfaces

Optimization problem setup through cvxpy is slow for large test cases in FLEDGE (which seems to be a known issue: cvxpy/cvxpy#708, cvxpy/cvxpy#1159, cvxpy/cvxpy#706). I'd like to try adding direct optimization solver interfaces to see if we can get better performance. To keep things clean & make switching interfaces easier in future, we will need some internal abstractions to define optimization variables / constraints / objective.

  • Refactor optimization problem standard form object with methods for variable / constraint / objective definition.
  • Refactor optimization problem standard form object to allow different solver interfaces (while retaining cvxpy as fallback interface).
  • Add gurobipy interface.
  • Enable retrieving of dual variables (requires labeling of constraints & retrieving dual values from solvers).
  • Enable adding fully featured matrix equations. (= broadcasting of multiplication along one dimension)
  • Enable quadratic objective (generate Q matrix).
  • Fix: Invalid constraint dimension if no constant defined.
  • Add high-level define_objective().
  • Enable using parameters in place of numerical values (For updating optimization problem without redefining constraints).
  • Replace optimization problem object with standard form object,
  • Redefine model class methods: define_optimization_variables(), define_optimization_constraints(), define_optimization_objective(), get_optimization_results(), get_optimization_dlmps().

Source node name affects power flow solution

When the source node name is such that the source node is not named "0", it may not appear first in the nodes index set (because the node names are sorted alphabetically). In those cases, the admittance matrix is not sliced correctly during the power flow solution & the solution is wrong.

  • Check / fix nodes index set definition.
  • Check / fix admittance matrix definition.
  • Check / fix slicing of admittance matrix in power flow solution.

Linear electric grid model automatic scaling / normalization

Implementation of automatic scaling / normalization of linear grid model matrices. Thus, translation of linear model variables into appropriate per-unit values to avoid numerical issues during optimization in CPLEX / Gurobi.

  • Blocking: Linear electric grid model variables to be defined as "absolute" instead as "change"
  • Formulate scaling approach (how to define normalization base, etc.).
  • Add generalized scaling method to LinearGridModel.
  • Consider scaling when defining objective values.
  • Consider scaling when obtaining simulation / optimization results.

Mathematical model documentation

The mathematical model documentation is currently only available in my thesis, but needs to become part of the online documentation.

  • Decide inclusion workflow (LaTeX vs RST vs MD).
  • Add / proofread mathematical documentation contents.
  • Revise documentation build workflow, if needed.

Add more test cases

Include more power system test cases in the MESMO repository.

  • Restructure data directory for better differentiation between "templates", "type library" and "test cases".
  • Gather list of desired test cases. Please help: @arifa7med @cdesmond @kaiATtum
  • Add & validate test cases.

DER marginal cost incorrect unit

Hi Sebastian,
I hope you are doing well.
I downloaded the latest version of mesmo and I found out that as I had reported earlier the DER's marginal cost unit is not in 1/Wh as for price_timeseries but it is in 1/kWh.

So I guess the line 146 in der_model.py should be replaced by the following:

self.marginal_cost = der.at["marginal_cost"] / 1e3 * der_data.scenario_data.scenario.at["base_apparent_power"] \ if pd.notnull(der.at["marginal_cost"]) else 0.0

BR,
Milad

Multi-objective Optimization based on Augmecon

Hi Sebastian,
I would like to let you know that I implemented Augmecon for the multi-objective optimization inside the solution.py module at the multi_objective_mesmo branch. The model is solved successfully in the case of non-parallel processing.
However, when using parallel processing, there is a share_state_actor inside each function that genuinely is a dictionary that is supposed to be updated at each iteration then it should be accessible by other parallel actors to avoid double-solving some iterations.
Therefore, it still solves the problem in the parallel mode but does not skip some problems that were supposed to be skipped.

Basically, a new class is added to the solution.py module called Augmecon. and a new class is added to the util.py module called SharedStateActor. The model of a benchmark tri-objective problem is given in the examples/develop folder

I would highly appreciate it if you could help fix the issue at your earliest convenience.
Best regards,
Milad

MESMO plotting library entrypoint

  • Provide simple entry-point / script to trigger generation of MESMO plots
  • Review interfaces of existing plotting functions
  • Takes as input: MESMO input data, MESMO results data
  • Output: Plottable items as JSON

Trust-region algorithm

Implement trust-region algorithm for operation problem solution.

  • Check existing code in examples/development/run_electric_grid_optimal_power_flow_trust_region.py
  • Revise implementation to work with latest linear model changes (change values -> absolute values)
  • Make it work for multiple timesteps
  • Blocking: Local linear electric grid model #5 @stroitzsch
  • Blocking: DLMPs with a "different" linear_electric_grid_model for each timestep @stroitzsch
  • Make it work with local linear model
  • Move implementation to problems module (exact location TBD)

RuntimeError: HiGHS solution status could not be retrieved

Hello sir,

Hope you are doing well.

I have followed the installation guidelines and installed after cloning the package.

When i run any of the given examples in the repository, i get the below error. Request you to kindly help me resolve the error.

Thank you...

(base) C:\Users\Ishan Kholkar\Desktop\smartgrid\mesmo>conda activate mesmo

(mesmo) C:\Users\Ishan Kholkar\Desktop\smartgrid\mesmo>"C:/Users/Ishan Kholkar/anaconda3/envs/mesmo/python.exe" "c:/Users/Ishan Kholkar/Desktop/smartgrid/mesmo/examples/tutorial/example_3.py"
File "C:\Users\Ishan Kholkar\Desktop\smartgrid\mesmo\mesmo\solutions.py", line 1218, in solve_highs
status = next(line for line in output if line.startswith("Model status : "))
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:/Users/Ishan Kholkar/Desktop/smartgrid/mesmo/examples/tutorial/example_3.py", line 54, in
main()
File "c:/Users/Ishan Kholkar/Desktop/smartgrid/mesmo/examples/tutorial/example_3.py", line 45, in main
optimization_problem.solve()
File "C:\Users\Ishan Kholkar\Desktop\smartgrid\mesmo\mesmo\solutions.py", line 1054, in solve
self.solve_highs()
File "C:\Users\Ishan Kholkar\Desktop\smartgrid\mesmo\mesmo\solutions.py", line 1221, in solve_highs
raise RuntimeError(f"HiGHS solution status could not be retrieved:\n{command}\n{''.join(output)}")
RuntimeError: HiGHS solution status could not be retrieved:
C:\Users\Ishan Kholkar\Desktop\smartgrid\mesmo\highs\bin\highs --model_file C:\Users\Ishan Kholkar\Desktop\smartgrid\mesmo\results\temp_2022-10-11_17-30-49_318556\problem.mps --options_file C:\Users\Ishan Kholkar\Desktop\smartgrid\mesmo\results\temp_2022-10-11_17-30-49_318556\options.txt --solution_file C:\Users\Ishan Kholkar\Desktop\smartgrid\mesmo\results\temp_2022-10-11_17-30-49_318556\solution.txt
'C:\Users\Ishan' is not recognized as an internal or external command,
operable program or batch file.

(mesmo) C:\Users\Ishan Kholkar\Desktop\smartgrid\mesmo>

Raise errors for invalid scenario definitions

Introduce checks in data_interface such that definition issues are caught early and raise clear error messages.

Typical issues (Please add / edit):

  • Isolated nodes (nodes not connected through lines / transformers to source node)
  • Isolated DERs (invalid node name)
  • Isolated lines / transformers (invalid node names)
  • Invalid source node name
  • Invalid line type definition (leading to singular admittance matrix)
  • Missing values (NULL, NaN) in any required column
  • ...

Support for meshed thermal grids

The current implementations in the thermal grid models module cater only to radial networks. This can be extended to cater for meshed networks based on existing approaches from literature.

  • Identify branch loops for meshed networks [1].
  • Update thermal grid model indexes / incidence matrices to align with [2].
  • Implement Newton-Raphson method for thermal power flow solution based on [2].
  • Revise linear thermal grid model formulation for meshed networks.
  • Document Newton-Raphson method / revised linear grid model.
  • Add test cases for radial / meshed networks.

[1] https://doi.org/10/d5h9sh
[2] https://doi.org/10/f4tgrg

Run in jupytor lab

I tried to follow the instruction and download the repository but each time it asked to install Cobmo directory properly . Although in anconda prompt it says installed
could you please guide on that

Module architecture revisions

There are a few planned structural revisions, which I will document here for everyone's awareness:

  • Move OptimizationProblem to dedicated optimization solutions module.
  • Merge ElectricGridModelBase & ElectricGridModel and make ElectricGridModelOpenDSS subclass of ElectricGridModel.
  • Change PowerFlowSolution to PowerFlowSolutionBase and create new class PowerFlowSolution that serves as a wrapper for the PowerFlowSolutionXXXMethod classes & automatically selects the appropriate solution method. (For both electric_grid_models & thermal_grid_models.)
  • Add ResultsDict, Problem, ProblemDict in the problems module (already has class skeletons).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.