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

Adds method to process modelica results #646

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open

Adds method to process modelica results #646

wants to merge 18 commits into from

Conversation

tanushree04
Copy link
Collaborator

@tanushree04 tanushree04 commented Jul 31, 2024

Objective :

  • add uo des cli call and methods to query results from modelica models
  • these results are required for the REOPT GHP LCCA analysis that will be run using the urbanopt SDK
  • this cli call will be run in the following sequence :
  1. create modelica model with GHP
  2. run thermal network to size GHP
  3. run modelica model
  4. query results using this cli call
  5. run reopt GHP LCCA analysis using urbanopt cli

This cli call takes the modelica folder created and run previously as an argument. It then reads the .mat file and queries timeseries results for heating, cooling electricity consumption of heat pumps, ets pump electricity consumption, pump associated with building electricity consumption loop pump electricity consumption and heat pump sizing for the GHP network.

This uses methods from the modelica buildingspy library to query results. https://simulationresearch.lbl.gov/modelica/buildingspy/

To test :

Use uo_des des-process <modelica_model_name>`

Run poetry run pytest tests poetry run pytest .\tests\geojson_modelica_translator\test_results_ghp.py

Check the "geojson-modelica-translator\tests\geojson_modelica_translator\data\modelica_5\modelica_5.Districts.DistrictEnergySystem_results\modelica_5.Districts.DistrictEnergySystem_result.csv" file created with results queried for REopt GHP at 15 minute intervals.

@tanushree04 tanushree04 requested a review from vtnate July 31, 2024 00:30
Copy link
Contributor

@vtnate vtnate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run pre-commit and address the linting & formatting changes.

Overall it's not clear to me what this command is for. Will you add more context to the PR description (and perhaps a bit to the cli command description) explaining what the output is, why someone would use this command, and how to interpret it?

geojson_modelica_translator/results_ghp.py Outdated Show resolved Hide resolved
management/uo_des.py Outdated Show resolved Hide resolved
management/uo_des.py Outdated Show resolved Hide resolved
:param start_time (int): start time of the simulation (seconds of a year)
:param stop_time (int): stop time of the simulation (seconds of a year)
:param step_size (int): step size of the simulation (seconds)
:param number_of_intervals (int): number of intervals to run the simulation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are valid inputs to the run-model command, aren't they? Why remove them?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These parameters are still valid, no? Why remove the documentation for them?

management/uo_des.py Outdated Show resolved Hide resolved
management/uo_des.py Show resolved Hide resolved
management/uo_des.py Show resolved Hide resolved
tests/geojson_modelica_translator/test_results_ghp.py Outdated Show resolved Hide resolved
@vtnate vtnate added the enhancement New feature or request label Aug 8, 2024
@tanushree04
Copy link
Collaborator Author

#645

This needs to be incorporated

@vtnate
Copy link
Contributor

vtnate commented Aug 13, 2024

#645

This needs to be incorporated

Ah. That is in #644.

@tanushree04
Copy link
Collaborator Author

pre-co

what is the pre commit command?

@vtnate
Copy link
Contributor

vtnate commented Aug 27, 2024

what is the pre commit command?

poetry run pre-commit run -a

Copy link
Contributor

@vtnate vtnate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the tests all pass, but there are still linting issues found by Ruff in pre-commit. Please address those as well as my comments here.

@@ -170,28 +171,28 @@ def create_model(sys_param_file: Path, geojson_feature_file: Path, project_path:
@click.option(
"-a",
"--start_time",
default=17280000,
default=0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain why we need to change the default time settings for all CLI users.

:param start_time (int): start time of the simulation (seconds of a year)
:param stop_time (int): stop time of the simulation (seconds of a year)
:param step_size (int): step size of the simulation (seconds)
:param number_of_intervals (int): number of intervals to run the simulation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These parameters are still valid, no? Why remove the documentation for them?

management/uo_des.py Show resolved Hide resolved
# See also https://github.com/urbanopt/geojson-modelica-translator/blob/develop/LICENSE.md


import unittest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the pytest setup that already exists in this repo, instead of unittest.

modelica_path = modelica_path.resolve()

# Construct the path to the CSV file
csv_file_path = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we already have output data from a modelica simulation, we don't need to change the default on the CLI, do we?

Those time options on the CLI are the specifically to allow users to set whatever timespan & timestep they require. For example, this test sets different values for those options, if you want to generate fresh data for a test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we are already testing the run command it is sufficient to test the process command separately. I have also added a light weight model to this test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants