Skip to content
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

[DEFECT] Pyomo Expressions for metrics other than NPV return an error #60

Open
10 tasks
GabrielSoto-INL opened this issue Sep 19, 2022 · 0 comments
Open
10 tasks
Labels
defect Something isn't working

Comments

@GabrielSoto-INL
Copy link
Collaborator


Defect Description

Describe the defect

What did you expect to see happen?

When running TEAL/tests/PyomoTest.py I get an error message when adding another indicator that is not 'NPV', specifically in the "build_econ_settings" method current Line 52:
'Indicator': {'name': ['NPV','PI'], #could also add 'IRR' 'active': active}
Expected TEAL to generate the PI metric as a Pyomo Expression after all cashflows are defined since pyomoVar is set to True.

What did you see instead?

Instead, I get an error:
Traceback (most recent call last): File "C:\Users\sotogj\Miniconda3\envs\raven_libraries\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "C:\Users\sotogj\Miniconda3\envs\raven_libraries\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "c:\Users\sotogj\.vscode\extensions\ms-python.python-2022.14.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy\__main__.py", line 39, in <module> cli.main() File "c:\Users\sotogj\.vscode\extensions\ms-python.python-2022.14.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430, in main run() File "c:\Users\sotogj\.vscode\extensions\ms-python.python-2022.14.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 284, in run_file runpy.run_path(target, run_name="__main__") File "c:\Users\sotogj\.vscode\extensions\ms-python.python-2022.14.0\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 322, in run_path pkg_name=pkg_name, script_name=fname) File "c:\Users\sotogj\.vscode\extensions\ms-python.python-2022.14.0\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 136, in _run_module_code mod_name, mod_spec, pkg_name, script_name) fcff = FCFF(components, cashFlows, projectpython.python-2022.14.0\pythonFiles\lib\python\debugpy\_vendored\pydevdLength, mult=mult, v=v, pyomoVar=pyomoVar) _run_code File "c:\Users\sotogj\projects\TEAL\src\main.py", line 520, in FCFF omoTest.py", line 268, in <module> fcff[i] += data[i] enerator, market], {}, pyomoVar=True) # Past version was pyomoChk File "pyomo\core\expr\numvalue.pyx", line 61.py", line 687, in run6, in pyomo.core.expr.numvalue.NumericValue.__projectLength, settings.getDiscountRate(), v=v)float__ .py", line 583, in PI TypeError: Implicit conversion of Pyomo numerijectLength, discountRate, mult=mult, v=v, returnFcff=True)c value (-1000.0*gen_size) to float is disable.py", line 545, in NPVd. Length, mult=mult, v=v, pyomoVar=pyomoVar) This error is often the result of using Pyomo .py", line 520, in FCFF components as arguments to one of the Python built-in math module functions when defining expressions. Avoid this error by using Pyomo-provided math functions or explicitly resolving the numeric value using the Pyomo value() function.

Do you have a suggested fix for the development team?

It seems the issue is that "pyomoVar" is only passed in TEAL/src/main.py to the 'NPV' indicator and not the others. So when a PyomoExpression is requested, it errors out.

Describe how to Reproduce
Steps to reproduce the behavior:

  1. Run TEAL/tests/PyomoTest.py with an indicator other than 'NPV' and pyomoVar set to True.

Screenshots and Input Files
Please attach the input file(s) that generate this error. The simpler the input, the faster we can find the issue.

Platform (please complete the following information):

  • OS: Windows
  • Version: [e.g. 22]
  • Dependencies Installation: [CONDA or PIP]

For Change Control Board: Issue Review

This review should occur before any development is performed as a response to this issue.

  • 1. Is it tagged with a type: defect or task?
  • 2. Is it tagged with a priority: critical, normal or minor?
  • 3. If it will impact requirements or requirements tests, is it tagged with requirements?
  • 4. If it is a defect, can it cause wrong results for users? If so an email needs to be sent to the users.
  • 5. Is a rationale provided? (Such as explaining why the improvement is needed or why current code is wrong.)

For Change Control Board: Issue Closure

This review should occur when the issue is imminently going to be closed.

  • 1. If the issue is a defect, is the defect fixed?
  • 2. If the issue is a defect, is the defect tested for in the regression test system? (If not explain why not.)
  • 3. If the issue can impact users, has an email to the users group been written (the email should specify if the defect impacts stable or master)?
  • 4. If the issue is a defect, does it impact the latest release branch? If yes, is there any issue tagged with release (create if needed)?
  • 5. If the issue is being closed without a pull request, has an explanation of why it is being closed been provided?
@GabrielSoto-INL GabrielSoto-INL added the defect Something isn't working label Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant