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

Add MOS file wrapper and size the 5G mass flow rate #548

Merged
merged 5 commits into from May 8, 2023
Merged

Conversation

nllong
Copy link
Member

@nllong nllong commented May 5, 2023

Any background context you want to provide?

We were parsing the MOS file by hand, the sizing of the mass flow rate was fixed, and the plant flow rate.

What does this PR accomplish?

  • Add a new class to read in an MOS file. The class can read the variables in the header and can set variable values.
  • Refactor the reading of the water heating load to use the new class
  • Expose the plant mass flow rate to the DES5G mot file
  • Size the mass flow rates according to the total heating/cooling load, delta T, and Cp

How should this be manually tested?

  • Ideally, generate the DES_5G test and run in Dymola (I confirmed that it ran)
  • The unit tests should cover the MOS file class

What are the relevant tickets?

n/a

Screenshots (if appropriate)

@nllong nllong requested a review from vtnate May 5, 2023 20:59
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.

The model even compiles and simulates in OpenModelica! 🙌 OM whines a little bit about initial conditions, but it does that with most of our models anyway.

str: Value of the key
"""
# check if the peak water heating load is zero, otherwise just skip
key_re = rf'#(\s?{key}\s?)=\s?(-?\b\d[\d,.]*\b)(.*\s)'
Copy link
Contributor

Choose a reason for hiding this comment

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

regex hurts my brain

from geojson_modelica_translator.modelica.modelica_mos_file import ModelicaMOS


class ModelicaMOSTest(unittest.TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

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

😍

@vtnate vtnate merged commit 4b39004 into develop May 8, 2023
9 checks passed
@vtnate vtnate deleted the size-mf-5g branch May 8, 2023 18:46
nllong added a commit that referenced this pull request Jun 9, 2023
* Add support for Python 3.11 (#518)

* adjust dependency versions to support python 3.11

* skip compilation and simulation tests in tox env

* update ci for python 3.11

* change asserts to if/raise statements in modelica_runner

* ugh, forgot to change the test when I changed the assertions

* update poetry version in ci

* `poetry update`

* specify ports for each time series building in instance template (#525)

Co-authored-by: Nicholas Long <1907354+nllong@users.noreply.github.com>

* update license language (#529)

* add max_electrical_load to building sys-param data (#530)

* add max_electrical_load to building sys-param data

* alphabetize some template sys-param entries

* Modifications for GHE  (#526)

* Add GHE properties to system parameter

* add ghe parameters

* add end of file line

* Add test

* modify schema

* additional properties

* run precommit

* add description and default

* pre-commit

* add schema changes

* edit default

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* update dependency versions (#534)

* Removing remaining tox calls (#535)

* removing remaining tox parts

* `poetry update`

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* pre-commit has been running on all checks already (#538)

* Add Level 1 5G DES system (#539)

* update dependency versions

* initial files added for creating 5g system from existing load files

* fix path type, ignore for now

* fix types on methods, bump to python 3.8 (#540)

* fix types on methods, bump to python 3.8

* update ci exclude

* add in directory to the mos copying

* systemparameter needs to use the same data... favor param_template over data.

* expose nBui to set correctly

* default to openmodelica and fix space check in file name

* Set SWH peak to 1/10th of space heating or min 5000W (#542)

* set swh peak to one-tenth of space heating or min 5000W

* max/min are hard

* Update geojson_modelica_translator/modelica/GMT_Lib/DHC/DHC_5G_waste_heat_GHX.py

* Update geojson_modelica_translator/modelica/GMT_Lib/DHC/DHC_5G_waste_heat_GHX.py

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* float precision is not needed. now using int instead

* test for new int value in shw instead of float

* update dependencies

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Issue511 ghe templates (#533)

* Add redeclaration of allowFlowReverseSer=true

* Inital implementation of district system template with single GHE

* Add modified GroundTemperatureResponse class to overwrite MBL

* Initial implementation of OneUTube and PartialBorefield templates

* Fix bug of inconsistent template name and Modelica class name of BuildingTimeSeries

* Update system template, removed temperature sensors

* District energy test file that has multiple buildings

* Add comment and test version control with VSCode

* Add declaration of borefield data parameters

* Add template for TwoUTubes borefield

* Remove unneeded mo files

* Modify input field names based on schema

* Change within statement

* Initial implementation of borefield.py

* Conversion of shank spacing

* Modify shank spacing conversion

* Remove unneeded mo file

* Minor changes to model_name

* Add system template for testing borefield template

* Initial implementation of borefield test

* Move ghe system parameter files to right location

* Take out SingleGHE system template for now

* Change within statement

* Initial implementation of borefield coupling

* Add code to point to BorefieldSystem.mot

* Remove duplicated test script

* Rename package

* Add {%endraw%} at the end

* Add input fields needed for the test

* Debugging changes

* Add borefield_instance.mopt

* Changes for debugging, now the test passes

* Add borehole_length to example system params file

* Debug PartialBorefield.mot, it passes check

* Change coupling definitions

* Minor changes

* Remove partial template models

* Add sample g-function and path

* Reverting 3 system params files

* pre-commit now with more modelica-fmt

* Apply uniform 5G district system template

* Remove unused GHE district template

* Fix for non-ghe 5G districts

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Add MOS file wrapper and size the 5G mass flow rate (#548)

* new class for reading mos file variables

* add mf sizing and expose plant mass flow variable

* fix typing warning for round

* reduce delta t to 10C

* reduce delta t to 5C

* Add OpenModelica compatibility (#516)

* updating plant components to work with OpenModelica

* add "each" to array of parameters. first pass

* remove nports count setting for OM

* bump requests version to remove RequestsDependencyWarning about charset_normalizer

* `poetry update`

* redeclare the correct building class in 5G timeseries template

* `allowFlowReversal` in timeseries_instance to make OM solver happy

* put FlowReversal only in the 5g part of TimeSeries_Instance

* lower 5G building hot water supply/return temps

* restore nports=1 for 4g timeseries buildings

* allowFlowReversal=true in heat exchanger

* add within statement at top of getPeakMassFlowRate.mo

* read getPeakMassFlowRate.mo as a template, so we can have the model name added properly

* add spaces around project_name in mft template

* add allowFlowReversal=true to all 4G timeseries buildings

* allowFlowReversal=true in network2pip_instance [skip-ci]

* set all remaining allowFlowReversal=true [ci skip]

* tell modelica formatter to ignore getPeakMassFlowRate.mo because of failures

* change getPeakMassFlowRate.mo to *.mot, reactivate modelica-fmt on it

* oops, look for new filename [ci-skip]

* remove commented code [skip ci]

* add Medium redeclaration in MFT template

* add OM files folder

* All_spawn_models

* Teaser Single worked

* add timeseries output nodes to make OM happy

* allow flow reversal in spawn building

* relax thermal zone constraint in teaser

* properly check for chp in sys param file

* fix double appending of heating plant when no chp to package.order

* pre-commit on Jiazhen's temp files for OM testing; remove some spawn-single files

* remove requirements.txt check from pre-commit, since we don't use that

* `poetry update`

* Spawn and Teaser changes

* pre-commit formatted Jiazhens modelica files

* hardcode numberofchillers=2 as a hack because OM does not do dot access

* add `allowFlowReversal=true` to spawn load instance

* hack in the hardcoded numberofchillers to make OM happy

* update 5g sys-param file to use 5g ets params

* add district 5g timeseries test

* `poetry update`

* add `.pytest_cache` to gitignore

* update mft connect statements to work in OM

* remove commented template code

* get 5g districts of multiple buildings working

* remove test models from Jiazhen

* `poetry update`

* use newer version of poetry in ci

* remove redundant `precommit` test env from CI matrix

* remind poetry that we only support python >=3.9 now

* `poetry update`

* use newest poetry patch in ci

* autopep8

---------

Co-authored-by: jiazhenling <89460432+jiazhenling@users.noreply.github.com>

* Modify GHE params (#537)

* remove connectors from ghe params

* modify test and ghe system param file

* update ghe parameters schema

* modify ghe parameters

* modify ghe parameters

* add system parameter files for borehole test

* update example files

* update example files for model connectors

* add ets 5th gen params

* add array for ghe geometry params

* remove print statement from test

* Adds defaults and required fields for ghe_params and 5th gen ets params

---------

Co-authored-by: Nicholas Long <1907354+nllong@users.noreply.github.com>

* Fixing borefield test breaks due to schema changes (#550)

* Add redeclaration of allowFlowReverseSer=true

* Inital implementation of district system template with single GHE

* Add modified GroundTemperatureResponse class to overwrite MBL

* Initial implementation of OneUTube and PartialBorefield templates

* Fix bug of inconsistent template name and Modelica class name of BuildingTimeSeries

* Update system template, removed temperature sensors

* District energy test file that has multiple buildings

* Add comment and test version control with VSCode

* Add declaration of borefield data parameters

* Add template for TwoUTubes borefield

* Remove unneeded mo files

* Modify input field names based on schema

* Change within statement

* Initial implementation of borefield.py

* Conversion of shank spacing

* Modify shank spacing conversion

* Remove unneeded mo file

* Minor changes to model_name

* Add system template for testing borefield template

* Initial implementation of borefield test

* Move ghe system parameter files to right location

* Take out SingleGHE system template for now

* Change within statement

* Initial implementation of borefield coupling

* Add code to point to BorefieldSystem.mot

* Remove duplicated test script

* Rename package

* Add {%endraw%} at the end

* Add input fields needed for the test

* Debugging changes

* Add borefield_instance.mopt

* Changes for debugging, now the test passes

* Add borehole_length to example system params file

* Debug PartialBorefield.mot, it passes check

* Change coupling definitions

* Minor changes

* Remove partial template models

* Add sample g-function and path

* Reverting 3 system params files

* pre-commit now with more modelica-fmt

* Apply uniform 5G district system template

* Remove unused GHE district template

* Fix for non-ghe 5G districts

* Delete sys_param files not needed

* Replace Gfunction input with csv file

* Point to the right sys_param file

* Updated template to reflect schema changes

* Changes for the test to run

* Fix backslashes

* Change to adapt to recent commits

* Temporary fixes to make the test pass

* Change ghe_dir to relative path

* Use pathlib to handle ghe_dir

* Add if statement to avoid breaking other 5G tests

* Change due to schema change

* Pre-commit changes

* Fix bug

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Updating GHE Parameters: Modifying GHE Parameters schema and example files (#551)

* remove loads as required

* add objects for unique ghe properties

* update ghe specific schema objects

* add borehole to ghe specific properties

* update schema and example to not require autopopulated fields

* update to relative path

* update model connector examples

* Fix borefield test breaks due to the schema changes in issue #551 (#554)

* Add redeclaration of allowFlowReverseSer=true

* Inital implementation of district system template with single GHE

* Add modified GroundTemperatureResponse class to overwrite MBL

* Initial implementation of OneUTube and PartialBorefield templates

* Fix bug of inconsistent template name and Modelica class name of BuildingTimeSeries

* Update system template, removed temperature sensors

* District energy test file that has multiple buildings

* Add comment and test version control with VSCode

* Add declaration of borefield data parameters

* Add template for TwoUTubes borefield

* Remove unneeded mo files

* Modify input field names based on schema

* Change within statement

* Initial implementation of borefield.py

* Conversion of shank spacing

* Modify shank spacing conversion

* Remove unneeded mo file

* Minor changes to model_name

* Add system template for testing borefield template

* Initial implementation of borefield test

* Move ghe system parameter files to right location

* Take out SingleGHE system template for now

* Change within statement

* Initial implementation of borefield coupling

* Add code to point to BorefieldSystem.mot

* Remove duplicated test script

* Rename package

* Add {%endraw%} at the end

* Add input fields needed for the test

* Debugging changes

* Add borefield_instance.mopt

* Changes for debugging, now the test passes

* Add borehole_length to example system params file

* Debug PartialBorefield.mot, it passes check

* Change coupling definitions

* Minor changes

* Remove partial template models

* Add sample g-function and path

* Reverting 3 system params files

* pre-commit now with more modelica-fmt

* Apply uniform 5G district system template

* Remove unused GHE district template

* Fix for non-ghe 5G districts

* Delete sys_param files not needed

* Replace Gfunction input with csv file

* Point to the right sys_param file

* Updated template to reflect schema changes

* Changes for the test to run

* Fix backslashes

* Change to adapt to recent commits

* Temporary fixes to make the test pass

* Change ghe_dir to relative path

* Use pathlib to handle ghe_dir

* Add if statement to avoid breaking other 5G tests

* Change due to schema change

* Pre-commit changes

* Fix bug

* Changes due to schema change

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

---------

Co-authored-by: Jing Wang <31628742+JingWang-CUB@users.noreply.github.com>
Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Enable compile & simulate with OpenModelica in Docker (#545)

* updating plant components to work with OpenModelica

* add "each" to array of parameters. first pass

* remove nports count setting for OM

* bump requests version to remove RequestsDependencyWarning about charset_normalizer

* `poetry update`

* redeclare the correct building class in 5G timeseries template

* `allowFlowReversal` in timeseries_instance to make OM solver happy

* put FlowReversal only in the 5g part of TimeSeries_Instance

* lower 5G building hot water supply/return temps

* restore nports=1 for 4g timeseries buildings

* allowFlowReversal=true in heat exchanger

* add within statement at top of getPeakMassFlowRate.mo

* read getPeakMassFlowRate.mo as a template, so we can have the model name added properly

* add spaces around project_name in mft template

* add allowFlowReversal=true to all 4G timeseries buildings

* allowFlowReversal=true in network2pip_instance [skip-ci]

* set all remaining allowFlowReversal=true [ci skip]

* tell modelica formatter to ignore getPeakMassFlowRate.mo because of failures

* change getPeakMassFlowRate.mo to *.mot, reactivate modelica-fmt on it

* oops, look for new filename [ci-skip]

* remove commented code [skip ci]

* add Medium redeclaration in MFT template

* add OM files folder

* All_spawn_models

* Teaser Single worked

* add timeseries output nodes to make OM happy

* allow flow reversal in spawn building

* relax thermal zone constraint in teaser

* properly check for chp in sys param file

* fix double appending of heating plant when no chp to package.order

* pre-commit on Jiazhen's temp files for OM testing; remove some spawn-single files

* remove requirements.txt check from pre-commit, since we don't use that

* `poetry update`

* Spawn and Teaser changes

* pre-commit formatted Jiazhens modelica files

* hardcode numberofchillers=2 as a hack because OM does not do dot access

* add `allowFlowReversal=true` to spawn load instance

* hack in the hardcoded numberofchillers to make OM happy

* update 5g sys-param file to use 5g ets params

* add district 5g timeseries test

* `poetry update`

* add `.pytest_cache` to gitignore

* update mft connect statements to work in OM

* remove commented template code

* get 5g districts of multiple buildings working

* remove test models from Jiazhen

* `poetry update`

* use newer version of poetry in ci

* remove redundant `precommit` test env from CI matrix

* wip: OM Docker code partial setup. Needs at least more Dockerfile work

* remind poetry that we only support python >=3.9 now

* `poetry update`

* use newest poetry patch in ci

* autopep8

* ignore typing error, and temporarily(?) remove method argument

* om docker-compose yml file

* change call from `spawn_docker.sh` to `om_docker.sh`

* OM Dockerfile, and remove old Dockerfile

* update modelica_runner for OM and remove spawn references

* update python and shell scripts to run OM in Docker container

* remove files no longer necessary

* more updates for switch from spawn to OM

* update test regarding switch from spawn to OM

* re-enable a third cli argument for om.py in the container

* handle a third argument to the cli inside the container

* clean up docstring, try a new path to om_docker.sh

* uncomment the file moving lines I commented. doh

* tell mypy to ignore a line in om.py

* run the same model we're testing for build success

* Enable tests to run in docker with omc (#552)

* Modify GHE params (#537)

* remove connectors from ghe params

* modify test and ghe system param file

* update ghe parameters schema

* modify ghe parameters

* modify ghe parameters

* add system parameter files for borehole test

* update example files

* update example files for model connectors

* add ets 5th gen params

* add array for ghe geometry params

* remove print statement from test

* Adds defaults and required fields for ghe_params and 5th gen ets params

---------

Co-authored-by: Nicholas Long <1907354+nllong@users.noreply.github.com>

* incremental updates, bouncingball should work

* refactor the run in docker command

* symlink mbl when running om.py

* update the signature of the run_in_docker command.

* mypy updates

* remove optimica vars and enable running simulations

* do not run simulations on windows

* update lock files

* update poetry, cleanup results to not include c code

* fix boreholefield build, run still fails--ignoring

* mark spawn and teaser models as failing. There are errors reported even though the mat file is created

* udpate create_mbl_mount bash function to get mbl path in a better way

* handle case where user downloads MBL and the Buildings path is one level higher

* update poetry lock

* dedent

* Dockerfile now builds image that works with ARM chips

* Update uo_des.py

---------

Co-authored-by: tanushree04 <47833030+tanushree04@users.noreply.github.com>
Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

---------

Co-authored-by: jiazhenling <89460432+jiazhenling@users.noreply.github.com>
Co-authored-by: Nicholas Long <1907354+nllong@users.noreply.github.com>
Co-authored-by: tanushree04 <47833030+tanushree04@users.noreply.github.com>
Co-authored-by: Nicholas Long <nicholas.long@nrel.gov>

* Enhance and expand microgrid templates and code (#549)

* capacitor template from zhanwei and code to render it

* refactor to reduce line-length

* add minimal capacitor examples to microgrid test sys-param

* new test for creating a capacitor model from template

* district battery template and code

* test for building district battery from template

* generator code and template

* update microgrid test sys-param file to include building generators

* test for building a generator model

* reformat simple_gmt_base.py to shorten line length

* clarify variables in generator code

* template and code for electrical grid

* updated micrigrid example sys-param to include electrical grid params

* add test for creating grid model

* inductive load template and code

* microgrid sys-params for ac inductive loads

* test for building inductive load model

* simplify `within` statement because the models are still simple

* fix ACLine template to work with OM

* capitalize Inductive.py (and change test call to it) to make github happy

* also capitalizing Battery.py and changing the test to match

* additional parameters for capacitors so simulations succeed on OM

---------

Co-authored-by: Nicholas Long <1907354+nllong@users.noreply.github.com>

* Prepare 0.5 release (#556)

* prep release

* add changelog

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>
Co-authored-by: tanushree04 <47833030+tanushree04@users.noreply.github.com>
Co-authored-by: Jing Wang <31628742+JingWang-CUB@users.noreply.github.com>
Co-authored-by: jiazhenling <89460432+jiazhenling@users.noreply.github.com>
@nllong nllong mentioned this pull request Jun 9, 2023
nllong added a commit that referenced this pull request Jun 9, 2023
* Add support for Python 3.11 (#518)

* adjust dependency versions to support python 3.11

* skip compilation and simulation tests in tox env

* update ci for python 3.11

* change asserts to if/raise statements in modelica_runner

* ugh, forgot to change the test when I changed the assertions

* update poetry version in ci

* `poetry update`

* specify ports for each time series building in instance template (#525)



* update license language (#529)

* add max_electrical_load to building sys-param data (#530)

* add max_electrical_load to building sys-param data

* alphabetize some template sys-param entries

* Modifications for GHE  (#526)

* Add GHE properties to system parameter

* add ghe parameters

* add end of file line

* Add test

* modify schema

* additional properties

* run precommit

* add description and default

* pre-commit

* add schema changes

* edit default

---------



* update dependency versions (#534)

* Removing remaining tox calls (#535)

* removing remaining tox parts

* `poetry update`

---------



* pre-commit has been running on all checks already (#538)

* Add Level 1 5G DES system (#539)

* update dependency versions

* initial files added for creating 5g system from existing load files

* fix path type, ignore for now

* fix types on methods, bump to python 3.8 (#540)

* fix types on methods, bump to python 3.8

* update ci exclude

* add in directory to the mos copying

* systemparameter needs to use the same data... favor param_template over data.

* expose nBui to set correctly

* default to openmodelica and fix space check in file name

* Set SWH peak to 1/10th of space heating or min 5000W (#542)

* set swh peak to one-tenth of space heating or min 5000W

* max/min are hard

* Update geojson_modelica_translator/modelica/GMT_Lib/DHC/DHC_5G_waste_heat_GHX.py

* Update geojson_modelica_translator/modelica/GMT_Lib/DHC/DHC_5G_waste_heat_GHX.py



* float precision is not needed. now using int instead

* test for new int value in shw instead of float

* update dependencies

---------



* Issue511 ghe templates (#533)

* Add redeclaration of allowFlowReverseSer=true

* Inital implementation of district system template with single GHE

* Add modified GroundTemperatureResponse class to overwrite MBL

* Initial implementation of OneUTube and PartialBorefield templates

* Fix bug of inconsistent template name and Modelica class name of BuildingTimeSeries

* Update system template, removed temperature sensors

* District energy test file that has multiple buildings

* Add comment and test version control with VSCode

* Add declaration of borefield data parameters

* Add template for TwoUTubes borefield

* Remove unneeded mo files

* Modify input field names based on schema

* Change within statement

* Initial implementation of borefield.py

* Conversion of shank spacing

* Modify shank spacing conversion

* Remove unneeded mo file

* Minor changes to model_name

* Add system template for testing borefield template

* Initial implementation of borefield test

* Move ghe system parameter files to right location

* Take out SingleGHE system template for now

* Change within statement

* Initial implementation of borefield coupling

* Add code to point to BorefieldSystem.mot

* Remove duplicated test script

* Rename package

* Add {%endraw%} at the end

* Add input fields needed for the test

* Debugging changes

* Add borefield_instance.mopt

* Changes for debugging, now the test passes

* Add borehole_length to example system params file

* Debug PartialBorefield.mot, it passes check

* Change coupling definitions

* Minor changes

* Remove partial template models

* Add sample g-function and path

* Reverting 3 system params files

* pre-commit now with more modelica-fmt

* Apply uniform 5G district system template

* Remove unused GHE district template

* Fix for non-ghe 5G districts

---------



* Add MOS file wrapper and size the 5G mass flow rate (#548)

* new class for reading mos file variables

* add mf sizing and expose plant mass flow variable

* fix typing warning for round

* reduce delta t to 10C

* reduce delta t to 5C

* Add OpenModelica compatibility (#516)

* updating plant components to work with OpenModelica

* add "each" to array of parameters. first pass

* remove nports count setting for OM

* bump requests version to remove RequestsDependencyWarning about charset_normalizer

* `poetry update`

* redeclare the correct building class in 5G timeseries template

* `allowFlowReversal` in timeseries_instance to make OM solver happy

* put FlowReversal only in the 5g part of TimeSeries_Instance

* lower 5G building hot water supply/return temps

* restore nports=1 for 4g timeseries buildings

* allowFlowReversal=true in heat exchanger

* add within statement at top of getPeakMassFlowRate.mo

* read getPeakMassFlowRate.mo as a template, so we can have the model name added properly

* add spaces around project_name in mft template

* add allowFlowReversal=true to all 4G timeseries buildings

* allowFlowReversal=true in network2pip_instance [skip-ci]

* set all remaining allowFlowReversal=true [ci skip]

* tell modelica formatter to ignore getPeakMassFlowRate.mo because of failures

* change getPeakMassFlowRate.mo to *.mot, reactivate modelica-fmt on it

* oops, look for new filename [ci-skip]

* remove commented code [skip ci]

* add Medium redeclaration in MFT template

* add OM files folder

* All_spawn_models

* Teaser Single worked

* add timeseries output nodes to make OM happy

* allow flow reversal in spawn building

* relax thermal zone constraint in teaser

* properly check for chp in sys param file

* fix double appending of heating plant when no chp to package.order

* pre-commit on Jiazhen's temp files for OM testing; remove some spawn-single files

* remove requirements.txt check from pre-commit, since we don't use that

* `poetry update`

* Spawn and Teaser changes

* pre-commit formatted Jiazhens modelica files

* hardcode numberofchillers=2 as a hack because OM does not do dot access

* add `allowFlowReversal=true` to spawn load instance

* hack in the hardcoded numberofchillers to make OM happy

* update 5g sys-param file to use 5g ets params

* add district 5g timeseries test

* `poetry update`

* add `.pytest_cache` to gitignore

* update mft connect statements to work in OM

* remove commented template code

* get 5g districts of multiple buildings working

* remove test models from Jiazhen

* `poetry update`

* use newer version of poetry in ci

* remove redundant `precommit` test env from CI matrix

* remind poetry that we only support python >=3.9 now

* `poetry update`

* use newest poetry patch in ci

* autopep8

---------



* Modify GHE params (#537)

* remove connectors from ghe params

* modify test and ghe system param file

* update ghe parameters schema

* modify ghe parameters

* modify ghe parameters

* add system parameter files for borehole test

* update example files

* update example files for model connectors

* add ets 5th gen params

* add array for ghe geometry params

* remove print statement from test

* Adds defaults and required fields for ghe_params and 5th gen ets params

---------



* Fixing borefield test breaks due to schema changes (#550)

* Add redeclaration of allowFlowReverseSer=true

* Inital implementation of district system template with single GHE

* Add modified GroundTemperatureResponse class to overwrite MBL

* Initial implementation of OneUTube and PartialBorefield templates

* Fix bug of inconsistent template name and Modelica class name of BuildingTimeSeries

* Update system template, removed temperature sensors

* District energy test file that has multiple buildings

* Add comment and test version control with VSCode

* Add declaration of borefield data parameters

* Add template for TwoUTubes borefield

* Remove unneeded mo files

* Modify input field names based on schema

* Change within statement

* Initial implementation of borefield.py

* Conversion of shank spacing

* Modify shank spacing conversion

* Remove unneeded mo file

* Minor changes to model_name

* Add system template for testing borefield template

* Initial implementation of borefield test

* Move ghe system parameter files to right location

* Take out SingleGHE system template for now

* Change within statement

* Initial implementation of borefield coupling

* Add code to point to BorefieldSystem.mot

* Remove duplicated test script

* Rename package

* Add {%endraw%} at the end

* Add input fields needed for the test

* Debugging changes

* Add borefield_instance.mopt

* Changes for debugging, now the test passes

* Add borehole_length to example system params file

* Debug PartialBorefield.mot, it passes check

* Change coupling definitions

* Minor changes

* Remove partial template models

* Add sample g-function and path

* Reverting 3 system params files

* pre-commit now with more modelica-fmt

* Apply uniform 5G district system template

* Remove unused GHE district template

* Fix for non-ghe 5G districts

* Delete sys_param files not needed

* Replace Gfunction input with csv file

* Point to the right sys_param file

* Updated template to reflect schema changes

* Changes for the test to run

* Fix backslashes

* Change to adapt to recent commits

* Temporary fixes to make the test pass

* Change ghe_dir to relative path

* Use pathlib to handle ghe_dir

* Add if statement to avoid breaking other 5G tests

* Change due to schema change

* Pre-commit changes

* Fix bug

---------



* Updating GHE Parameters: Modifying GHE Parameters schema and example files (#551)

* remove loads as required

* add objects for unique ghe properties

* update ghe specific schema objects

* add borehole to ghe specific properties

* update schema and example to not require autopopulated fields

* update to relative path

* update model connector examples

* Fix borefield test breaks due to the schema changes in issue #551 (#554)

* Add redeclaration of allowFlowReverseSer=true

* Inital implementation of district system template with single GHE

* Add modified GroundTemperatureResponse class to overwrite MBL

* Initial implementation of OneUTube and PartialBorefield templates

* Fix bug of inconsistent template name and Modelica class name of BuildingTimeSeries

* Update system template, removed temperature sensors

* District energy test file that has multiple buildings

* Add comment and test version control with VSCode

* Add declaration of borefield data parameters

* Add template for TwoUTubes borefield

* Remove unneeded mo files

* Modify input field names based on schema

* Change within statement

* Initial implementation of borefield.py

* Conversion of shank spacing

* Modify shank spacing conversion

* Remove unneeded mo file

* Minor changes to model_name

* Add system template for testing borefield template

* Initial implementation of borefield test

* Move ghe system parameter files to right location

* Take out SingleGHE system template for now

* Change within statement

* Initial implementation of borefield coupling

* Add code to point to BorefieldSystem.mot

* Remove duplicated test script

* Rename package

* Add {%endraw%} at the end

* Add input fields needed for the test

* Debugging changes

* Add borefield_instance.mopt

* Changes for debugging, now the test passes

* Add borehole_length to example system params file

* Debug PartialBorefield.mot, it passes check

* Change coupling definitions

* Minor changes

* Remove partial template models

* Add sample g-function and path

* Reverting 3 system params files

* pre-commit now with more modelica-fmt

* Apply uniform 5G district system template

* Remove unused GHE district template

* Fix for non-ghe 5G districts

* Delete sys_param files not needed

* Replace Gfunction input with csv file

* Point to the right sys_param file

* Updated template to reflect schema changes

* Changes for the test to run

* Fix backslashes

* Change to adapt to recent commits

* Temporary fixes to make the test pass

* Change ghe_dir to relative path

* Use pathlib to handle ghe_dir

* Add if statement to avoid breaking other 5G tests

* Change due to schema change

* Pre-commit changes

* Fix bug

* Changes due to schema change

---------



---------




* Enable compile & simulate with OpenModelica in Docker (#545)

* updating plant components to work with OpenModelica

* add "each" to array of parameters. first pass

* remove nports count setting for OM

* bump requests version to remove RequestsDependencyWarning about charset_normalizer

* `poetry update`

* redeclare the correct building class in 5G timeseries template

* `allowFlowReversal` in timeseries_instance to make OM solver happy

* put FlowReversal only in the 5g part of TimeSeries_Instance

* lower 5G building hot water supply/return temps

* restore nports=1 for 4g timeseries buildings

* allowFlowReversal=true in heat exchanger

* add within statement at top of getPeakMassFlowRate.mo

* read getPeakMassFlowRate.mo as a template, so we can have the model name added properly

* add spaces around project_name in mft template

* add allowFlowReversal=true to all 4G timeseries buildings

* allowFlowReversal=true in network2pip_instance [skip-ci]

* set all remaining allowFlowReversal=true [ci skip]

* tell modelica formatter to ignore getPeakMassFlowRate.mo because of failures

* change getPeakMassFlowRate.mo to *.mot, reactivate modelica-fmt on it

* oops, look for new filename [ci-skip]

* remove commented code [skip ci]

* add Medium redeclaration in MFT template

* add OM files folder

* All_spawn_models

* Teaser Single worked

* add timeseries output nodes to make OM happy

* allow flow reversal in spawn building

* relax thermal zone constraint in teaser

* properly check for chp in sys param file

* fix double appending of heating plant when no chp to package.order

* pre-commit on Jiazhen's temp files for OM testing; remove some spawn-single files

* remove requirements.txt check from pre-commit, since we don't use that

* `poetry update`

* Spawn and Teaser changes

* pre-commit formatted Jiazhens modelica files

* hardcode numberofchillers=2 as a hack because OM does not do dot access

* add `allowFlowReversal=true` to spawn load instance

* hack in the hardcoded numberofchillers to make OM happy

* update 5g sys-param file to use 5g ets params

* add district 5g timeseries test

* `poetry update`

* add `.pytest_cache` to gitignore

* update mft connect statements to work in OM

* remove commented template code

* get 5g districts of multiple buildings working

* remove test models from Jiazhen

* `poetry update`

* use newer version of poetry in ci

* remove redundant `precommit` test env from CI matrix

* wip: OM Docker code partial setup. Needs at least more Dockerfile work

* remind poetry that we only support python >=3.9 now

* `poetry update`

* use newest poetry patch in ci

* autopep8

* ignore typing error, and temporarily(?) remove method argument

* om docker-compose yml file

* change call from `spawn_docker.sh` to `om_docker.sh`

* OM Dockerfile, and remove old Dockerfile

* update modelica_runner for OM and remove spawn references

* update python and shell scripts to run OM in Docker container

* remove files no longer necessary

* more updates for switch from spawn to OM

* update test regarding switch from spawn to OM

* re-enable a third cli argument for om.py in the container

* handle a third argument to the cli inside the container

* clean up docstring, try a new path to om_docker.sh

* uncomment the file moving lines I commented. doh

* tell mypy to ignore a line in om.py

* run the same model we're testing for build success

* Enable tests to run in docker with omc (#552)

* Modify GHE params (#537)

* remove connectors from ghe params

* modify test and ghe system param file

* update ghe parameters schema

* modify ghe parameters

* modify ghe parameters

* add system parameter files for borehole test

* update example files

* update example files for model connectors

* add ets 5th gen params

* add array for ghe geometry params

* remove print statement from test

* Adds defaults and required fields for ghe_params and 5th gen ets params

---------



* incremental updates, bouncingball should work

* refactor the run in docker command

* symlink mbl when running om.py

* update the signature of the run_in_docker command.

* mypy updates

* remove optimica vars and enable running simulations

* do not run simulations on windows

* update lock files

* update poetry, cleanup results to not include c code

* fix boreholefield build, run still fails--ignoring

* mark spawn and teaser models as failing. There are errors reported even though the mat file is created

* udpate create_mbl_mount bash function to get mbl path in a better way

* handle case where user downloads MBL and the Buildings path is one level higher

* update poetry lock

* dedent

* Dockerfile now builds image that works with ARM chips

* Update uo_des.py

---------




---------






* Enhance and expand microgrid templates and code (#549)

* capacitor template from zhanwei and code to render it

* refactor to reduce line-length

* add minimal capacitor examples to microgrid test sys-param

* new test for creating a capacitor model from template

* district battery template and code

* test for building district battery from template

* generator code and template

* update microgrid test sys-param file to include building generators

* test for building a generator model

* reformat simple_gmt_base.py to shorten line length

* clarify variables in generator code

* template and code for electrical grid

* updated micrigrid example sys-param to include electrical grid params

* add test for creating grid model

* inductive load template and code

* microgrid sys-params for ac inductive loads

* test for building inductive load model

* simplify `within` statement because the models are still simple

* fix ACLine template to work with OM

* capitalize Inductive.py (and change test call to it) to make github happy

* also capitalizing Battery.py and changing the test to match

* additional parameters for capacitors so simulations succeed on OM

---------



* Prepare 0.5 release (#556)

* prep release

* add changelog

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>
Co-authored-by: tanushree04 <47833030+tanushree04@users.noreply.github.com>
Co-authored-by: Jing Wang <31628742+JingWang-CUB@users.noreply.github.com>
Co-authored-by: jiazhenling <89460432+jiazhenling@users.noreply.github.com>
@vtnate vtnate added the Feature label Aug 11, 2023
nllong added a commit that referenced this pull request Jan 12, 2024
* Add support for Python 3.11 (#518)

* adjust dependency versions to support python 3.11

* skip compilation and simulation tests in tox env

* update ci for python 3.11

* change asserts to if/raise statements in modelica_runner

* ugh, forgot to change the test when I changed the assertions

* update poetry version in ci

* `poetry update`

* specify ports for each time series building in instance template (#525)

Co-authored-by: Nicholas Long <1907354+nllong@users.noreply.github.com>

* update license language (#529)

* add max_electrical_load to building sys-param data (#530)

* add max_electrical_load to building sys-param data

* alphabetize some template sys-param entries

* Modifications for GHE  (#526)

* Add GHE properties to system parameter

* add ghe parameters

* add end of file line

* Add test

* modify schema

* additional properties

* run precommit

* add description and default

* pre-commit

* add schema changes

* edit default

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* update dependency versions (#534)

* Removing remaining tox calls (#535)

* removing remaining tox parts

* `poetry update`

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* pre-commit has been running on all checks already (#538)

* Add Level 1 5G DES system (#539)

* update dependency versions

* initial files added for creating 5g system from existing load files

* fix path type, ignore for now

* fix types on methods, bump to python 3.8 (#540)

* fix types on methods, bump to python 3.8

* update ci exclude

* add in directory to the mos copying

* systemparameter needs to use the same data... favor param_template over data.

* expose nBui to set correctly

* default to openmodelica and fix space check in file name

* Set SWH peak to 1/10th of space heating or min 5000W (#542)

* set swh peak to one-tenth of space heating or min 5000W

* max/min are hard

* Update geojson_modelica_translator/modelica/GMT_Lib/DHC/DHC_5G_waste_heat_GHX.py

* Update geojson_modelica_translator/modelica/GMT_Lib/DHC/DHC_5G_waste_heat_GHX.py

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* float precision is not needed. now using int instead

* test for new int value in shw instead of float

* update dependencies

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Issue511 ghe templates (#533)

* Add redeclaration of allowFlowReverseSer=true

* Inital implementation of district system template with single GHE

* Add modified GroundTemperatureResponse class to overwrite MBL

* Initial implementation of OneUTube and PartialBorefield templates

* Fix bug of inconsistent template name and Modelica class name of BuildingTimeSeries

* Update system template, removed temperature sensors

* District energy test file that has multiple buildings

* Add comment and test version control with VSCode

* Add declaration of borefield data parameters

* Add template for TwoUTubes borefield

* Remove unneeded mo files

* Modify input field names based on schema

* Change within statement

* Initial implementation of borefield.py

* Conversion of shank spacing

* Modify shank spacing conversion

* Remove unneeded mo file

* Minor changes to model_name

* Add system template for testing borefield template

* Initial implementation of borefield test

* Move ghe system parameter files to right location

* Take out SingleGHE system template for now

* Change within statement

* Initial implementation of borefield coupling

* Add code to point to BorefieldSystem.mot

* Remove duplicated test script

* Rename package

* Add {%endraw%} at the end

* Add input fields needed for the test

* Debugging changes

* Add borefield_instance.mopt

* Changes for debugging, now the test passes

* Add borehole_length to example system params file

* Debug PartialBorefield.mot, it passes check

* Change coupling definitions

* Minor changes

* Remove partial template models

* Add sample g-function and path

* Reverting 3 system params files

* pre-commit now with more modelica-fmt

* Apply uniform 5G district system template

* Remove unused GHE district template

* Fix for non-ghe 5G districts

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Add MOS file wrapper and size the 5G mass flow rate (#548)

* new class for reading mos file variables

* add mf sizing and expose plant mass flow variable

* fix typing warning for round

* reduce delta t to 10C

* reduce delta t to 5C

* Add OpenModelica compatibility (#516)

* updating plant components to work with OpenModelica

* add "each" to array of parameters. first pass

* remove nports count setting for OM

* bump requests version to remove RequestsDependencyWarning about charset_normalizer

* `poetry update`

* redeclare the correct building class in 5G timeseries template

* `allowFlowReversal` in timeseries_instance to make OM solver happy

* put FlowReversal only in the 5g part of TimeSeries_Instance

* lower 5G building hot water supply/return temps

* restore nports=1 for 4g timeseries buildings

* allowFlowReversal=true in heat exchanger

* add within statement at top of getPeakMassFlowRate.mo

* read getPeakMassFlowRate.mo as a template, so we can have the model name added properly

* add spaces around project_name in mft template

* add allowFlowReversal=true to all 4G timeseries buildings

* allowFlowReversal=true in network2pip_instance [skip-ci]

* set all remaining allowFlowReversal=true [ci skip]

* tell modelica formatter to ignore getPeakMassFlowRate.mo because of failures

* change getPeakMassFlowRate.mo to *.mot, reactivate modelica-fmt on it

* oops, look for new filename [ci-skip]

* remove commented code [skip ci]

* add Medium redeclaration in MFT template

* add OM files folder

* All_spawn_models

* Teaser Single worked

* add timeseries output nodes to make OM happy

* allow flow reversal in spawn building

* relax thermal zone constraint in teaser

* properly check for chp in sys param file

* fix double appending of heating plant when no chp to package.order

* pre-commit on Jiazhen's temp files for OM testing; remove some spawn-single files

* remove requirements.txt check from pre-commit, since we don't use that

* `poetry update`

* Spawn and Teaser changes

* pre-commit formatted Jiazhens modelica files

* hardcode numberofchillers=2 as a hack because OM does not do dot access

* add `allowFlowReversal=true` to spawn load instance

* hack in the hardcoded numberofchillers to make OM happy

* update 5g sys-param file to use 5g ets params

* add district 5g timeseries test

* `poetry update`

* add `.pytest_cache` to gitignore

* update mft connect statements to work in OM

* remove commented template code

* get 5g districts of multiple buildings working

* remove test models from Jiazhen

* `poetry update`

* use newer version of poetry in ci

* remove redundant `precommit` test env from CI matrix

* remind poetry that we only support python >=3.9 now

* `poetry update`

* use newest poetry patch in ci

* autopep8

---------

Co-authored-by: jiazhenling <89460432+jiazhenling@users.noreply.github.com>

* Modify GHE params (#537)

* remove connectors from ghe params

* modify test and ghe system param file

* update ghe parameters schema

* modify ghe parameters

* modify ghe parameters

* add system parameter files for borehole test

* update example files

* update example files for model connectors

* add ets 5th gen params

* add array for ghe geometry params

* remove print statement from test

* Adds defaults and required fields for ghe_params and 5th gen ets params

---------

Co-authored-by: Nicholas Long <1907354+nllong@users.noreply.github.com>

* Fixing borefield test breaks due to schema changes (#550)

* Add redeclaration of allowFlowReverseSer=true

* Inital implementation of district system template with single GHE

* Add modified GroundTemperatureResponse class to overwrite MBL

* Initial implementation of OneUTube and PartialBorefield templates

* Fix bug of inconsistent template name and Modelica class name of BuildingTimeSeries

* Update system template, removed temperature sensors

* District energy test file that has multiple buildings

* Add comment and test version control with VSCode

* Add declaration of borefield data parameters

* Add template for TwoUTubes borefield

* Remove unneeded mo files

* Modify input field names based on schema

* Change within statement

* Initial implementation of borefield.py

* Conversion of shank spacing

* Modify shank spacing conversion

* Remove unneeded mo file

* Minor changes to model_name

* Add system template for testing borefield template

* Initial implementation of borefield test

* Move ghe system parameter files to right location

* Take out SingleGHE system template for now

* Change within statement

* Initial implementation of borefield coupling

* Add code to point to BorefieldSystem.mot

* Remove duplicated test script

* Rename package

* Add {%endraw%} at the end

* Add input fields needed for the test

* Debugging changes

* Add borefield_instance.mopt

* Changes for debugging, now the test passes

* Add borehole_length to example system params file

* Debug PartialBorefield.mot, it passes check

* Change coupling definitions

* Minor changes

* Remove partial template models

* Add sample g-function and path

* Reverting 3 system params files

* pre-commit now with more modelica-fmt

* Apply uniform 5G district system template

* Remove unused GHE district template

* Fix for non-ghe 5G districts

* Delete sys_param files not needed

* Replace Gfunction input with csv file

* Point to the right sys_param file

* Updated template to reflect schema changes

* Changes for the test to run

* Fix backslashes

* Change to adapt to recent commits

* Temporary fixes to make the test pass

* Change ghe_dir to relative path

* Use pathlib to handle ghe_dir

* Add if statement to avoid breaking other 5G tests

* Change due to schema change

* Pre-commit changes

* Fix bug

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Updating GHE Parameters: Modifying GHE Parameters schema and example files (#551)

* remove loads as required

* add objects for unique ghe properties

* update ghe specific schema objects

* add borehole to ghe specific properties

* update schema and example to not require autopopulated fields

* update to relative path

* update model connector examples

* Fix borefield test breaks due to the schema changes in issue #551 (#554)

* Add redeclaration of allowFlowReverseSer=true

* Inital implementation of district system template with single GHE

* Add modified GroundTemperatureResponse class to overwrite MBL

* Initial implementation of OneUTube and PartialBorefield templates

* Fix bug of inconsistent template name and Modelica class name of BuildingTimeSeries

* Update system template, removed temperature sensors

* District energy test file that has multiple buildings

* Add comment and test version control with VSCode

* Add declaration of borefield data parameters

* Add template for TwoUTubes borefield

* Remove unneeded mo files

* Modify input field names based on schema

* Change within statement

* Initial implementation of borefield.py

* Conversion of shank spacing

* Modify shank spacing conversion

* Remove unneeded mo file

* Minor changes to model_name

* Add system template for testing borefield template

* Initial implementation of borefield test

* Move ghe system parameter files to right location

* Take out SingleGHE system template for now

* Change within statement

* Initial implementation of borefield coupling

* Add code to point to BorefieldSystem.mot

* Remove duplicated test script

* Rename package

* Add {%endraw%} at the end

* Add input fields needed for the test

* Debugging changes

* Add borefield_instance.mopt

* Changes for debugging, now the test passes

* Add borehole_length to example system params file

* Debug PartialBorefield.mot, it passes check

* Change coupling definitions

* Minor changes

* Remove partial template models

* Add sample g-function and path

* Reverting 3 system params files

* pre-commit now with more modelica-fmt

* Apply uniform 5G district system template

* Remove unused GHE district template

* Fix for non-ghe 5G districts

* Delete sys_param files not needed

* Replace Gfunction input with csv file

* Point to the right sys_param file

* Updated template to reflect schema changes

* Changes for the test to run

* Fix backslashes

* Change to adapt to recent commits

* Temporary fixes to make the test pass

* Change ghe_dir to relative path

* Use pathlib to handle ghe_dir

* Add if statement to avoid breaking other 5G tests

* Change due to schema change

* Pre-commit changes

* Fix bug

* Changes due to schema change

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

---------

Co-authored-by: Jing Wang <31628742+JingWang-CUB@users.noreply.github.com>
Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Enable compile & simulate with OpenModelica in Docker (#545)

* updating plant components to work with OpenModelica

* add "each" to array of parameters. first pass

* remove nports count setting for OM

* bump requests version to remove RequestsDependencyWarning about charset_normalizer

* `poetry update`

* redeclare the correct building class in 5G timeseries template

* `allowFlowReversal` in timeseries_instance to make OM solver happy

* put FlowReversal only in the 5g part of TimeSeries_Instance

* lower 5G building hot water supply/return temps

* restore nports=1 for 4g timeseries buildings

* allowFlowReversal=true in heat exchanger

* add within statement at top of getPeakMassFlowRate.mo

* read getPeakMassFlowRate.mo as a template, so we can have the model name added properly

* add spaces around project_name in mft template

* add allowFlowReversal=true to all 4G timeseries buildings

* allowFlowReversal=true in network2pip_instance [skip-ci]

* set all remaining allowFlowReversal=true [ci skip]

* tell modelica formatter to ignore getPeakMassFlowRate.mo because of failures

* change getPeakMassFlowRate.mo to *.mot, reactivate modelica-fmt on it

* oops, look for new filename [ci-skip]

* remove commented code [skip ci]

* add Medium redeclaration in MFT template

* add OM files folder

* All_spawn_models

* Teaser Single worked

* add timeseries output nodes to make OM happy

* allow flow reversal in spawn building

* relax thermal zone constraint in teaser

* properly check for chp in sys param file

* fix double appending of heating plant when no chp to package.order

* pre-commit on Jiazhen's temp files for OM testing; remove some spawn-single files

* remove requirements.txt check from pre-commit, since we don't use that

* `poetry update`

* Spawn and Teaser changes

* pre-commit formatted Jiazhens modelica files

* hardcode numberofchillers=2 as a hack because OM does not do dot access

* add `allowFlowReversal=true` to spawn load instance

* hack in the hardcoded numberofchillers to make OM happy

* update 5g sys-param file to use 5g ets params

* add district 5g timeseries test

* `poetry update`

* add `.pytest_cache` to gitignore

* update mft connect statements to work in OM

* remove commented template code

* get 5g districts of multiple buildings working

* remove test models from Jiazhen

* `poetry update`

* use newer version of poetry in ci

* remove redundant `precommit` test env from CI matrix

* wip: OM Docker code partial setup. Needs at least more Dockerfile work

* remind poetry that we only support python >=3.9 now

* `poetry update`

* use newest poetry patch in ci

* autopep8

* ignore typing error, and temporarily(?) remove method argument

* om docker-compose yml file

* change call from `spawn_docker.sh` to `om_docker.sh`

* OM Dockerfile, and remove old Dockerfile

* update modelica_runner for OM and remove spawn references

* update python and shell scripts to run OM in Docker container

* remove files no longer necessary

* more updates for switch from spawn to OM

* update test regarding switch from spawn to OM

* re-enable a third cli argument for om.py in the container

* handle a third argument to the cli inside the container

* clean up docstring, try a new path to om_docker.sh

* uncomment the file moving lines I commented. doh

* tell mypy to ignore a line in om.py

* run the same model we're testing for build success

* Enable tests to run in docker with omc (#552)

* Modify GHE params (#537)

* remove connectors from ghe params

* modify test and ghe system param file

* update ghe parameters schema

* modify ghe parameters

* modify ghe parameters

* add system parameter files for borehole test

* update example files

* update example files for model connectors

* add ets 5th gen params

* add array for ghe geometry params

* remove print statement from test

* Adds defaults and required fields for ghe_params and 5th gen ets params

---------

Co-authored-by: Nicholas Long <1907354+nllong@users.noreply.github.com>

* incremental updates, bouncingball should work

* refactor the run in docker command

* symlink mbl when running om.py

* update the signature of the run_in_docker command.

* mypy updates

* remove optimica vars and enable running simulations

* do not run simulations on windows

* update lock files

* update poetry, cleanup results to not include c code

* fix boreholefield build, run still fails--ignoring

* mark spawn and teaser models as failing. There are errors reported even though the mat file is created

* udpate create_mbl_mount bash function to get mbl path in a better way

* handle case where user downloads MBL and the Buildings path is one level higher

* update poetry lock

* dedent

* Dockerfile now builds image that works with ARM chips

* Update uo_des.py

---------

Co-authored-by: tanushree04 <47833030+tanushree04@users.noreply.github.com>
Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

---------

Co-authored-by: jiazhenling <89460432+jiazhenling@users.noreply.github.com>
Co-authored-by: Nicholas Long <1907354+nllong@users.noreply.github.com>
Co-authored-by: tanushree04 <47833030+tanushree04@users.noreply.github.com>
Co-authored-by: Nicholas Long <nicholas.long@nrel.gov>

* Enhance and expand microgrid templates and code (#549)

* capacitor template from zhanwei and code to render it

* refactor to reduce line-length

* add minimal capacitor examples to microgrid test sys-param

* new test for creating a capacitor model from template

* district battery template and code

* test for building district battery from template

* generator code and template

* update microgrid test sys-param file to include building generators

* test for building a generator model

* reformat simple_gmt_base.py to shorten line length

* clarify variables in generator code

* template and code for electrical grid

* updated micrigrid example sys-param to include electrical grid params

* add test for creating grid model

* inductive load template and code

* microgrid sys-params for ac inductive loads

* test for building inductive load model

* simplify `within` statement because the models are still simple

* fix ACLine template to work with OM

* capitalize Inductive.py (and change test call to it) to make github happy

* also capitalizing Battery.py and changing the test to match

* additional parameters for capacitors so simulations succeed on OM

---------

Co-authored-by: Nicholas Long <1907354+nllong@users.noreply.github.com>

* Prepare 0.5 release (#556)

* prep release

* add changelog

* Release 0.5.0 (#557) (#558)

* Add support for Python 3.11 (#518)

* adjust dependency versions to support python 3.11

* skip compilation and simulation tests in tox env

* update ci for python 3.11

* change asserts to if/raise statements in modelica_runner

* ugh, forgot to change the test when I changed the assertions

* update poetry version in ci

* `poetry update`

* specify ports for each time series building in instance template (#525)



* update license language (#529)

* add max_electrical_load to building sys-param data (#530)

* add max_electrical_load to building sys-param data

* alphabetize some template sys-param entries

* Modifications for GHE  (#526)

* Add GHE properties to system parameter

* add ghe parameters

* add end of file line

* Add test

* modify schema

* additional properties

* run precommit

* add description and default

* pre-commit

* add schema changes

* edit default

---------



* update dependency versions (#534)

* Removing remaining tox calls (#535)

* removing remaining tox parts

* `poetry update`

---------



* pre-commit has been running on all checks already (#538)

* Add Level 1 5G DES system (#539)

* update dependency versions

* initial files added for creating 5g system from existing load files

* fix path type, ignore for now

* fix types on methods, bump to python 3.8 (#540)

* fix types on methods, bump to python 3.8

* update ci exclude

* add in directory to the mos copying

* systemparameter needs to use the same data... favor param_template over data.

* expose nBui to set correctly

* default to openmodelica and fix space check in file name

* Set SWH peak to 1/10th of space heating or min 5000W (#542)

* set swh peak to one-tenth of space heating or min 5000W

* max/min are hard

* Update geojson_modelica_translator/modelica/GMT_Lib/DHC/DHC_5G_waste_heat_GHX.py

* Update geojson_modelica_translator/modelica/GMT_Lib/DHC/DHC_5G_waste_heat_GHX.py



* float precision is not needed. now using int instead

* test for new int value in shw instead of float

* update dependencies

---------



* Issue511 ghe templates (#533)

* Add redeclaration of allowFlowReverseSer=true

* Inital implementation of district system template with single GHE

* Add modified GroundTemperatureResponse class to overwrite MBL

* Initial implementation of OneUTube and PartialBorefield templates

* Fix bug of inconsistent template name and Modelica class name of BuildingTimeSeries

* Update system template, removed temperature sensors

* District energy test file that has multiple buildings

* Add comment and test version control with VSCode

* Add declaration of borefield data parameters

* Add template for TwoUTubes borefield

* Remove unneeded mo files

* Modify input field names based on schema

* Change within statement

* Initial implementation of borefield.py

* Conversion of shank spacing

* Modify shank spacing conversion

* Remove unneeded mo file

* Minor changes to model_name

* Add system template for testing borefield template

* Initial implementation of borefield test

* Move ghe system parameter files to right location

* Take out SingleGHE system template for now

* Change within statement

* Initial implementation of borefield coupling

* Add code to point to BorefieldSystem.mot

* Remove duplicated test script

* Rename package

* Add {%endraw%} at the end

* Add input fields needed for the test

* Debugging changes

* Add borefield_instance.mopt

* Changes for debugging, now the test passes

* Add borehole_length to example system params file

* Debug PartialBorefield.mot, it passes check

* Change coupling definitions

* Minor changes

* Remove partial template models

* Add sample g-function and path

* Reverting 3 system params files

* pre-commit now with more modelica-fmt

* Apply uniform 5G district system template

* Remove unused GHE district template

* Fix for non-ghe 5G districts

---------



* Add MOS file wrapper and size the 5G mass flow rate (#548)

* new class for reading mos file variables

* add mf sizing and expose plant mass flow variable

* fix typing warning for round

* reduce delta t to 10C

* reduce delta t to 5C

* Add OpenModelica compatibility (#516)

* updating plant components to work with OpenModelica

* add "each" to array of parameters. first pass

* remove nports count setting for OM

* bump requests version to remove RequestsDependencyWarning about charset_normalizer

* `poetry update`

* redeclare the correct building class in 5G timeseries template

* `allowFlowReversal` in timeseries_instance to make OM solver happy

* put FlowReversal only in the 5g part of TimeSeries_Instance

* lower 5G building hot water supply/return temps

* restore nports=1 for 4g timeseries buildings

* allowFlowReversal=true in heat exchanger

* add within statement at top of getPeakMassFlowRate.mo

* read getPeakMassFlowRate.mo as a template, so we can have the model name added properly

* add spaces around project_name in mft template

* add allowFlowReversal=true to all 4G timeseries buildings

* allowFlowReversal=true in network2pip_instance [skip-ci]

* set all remaining allowFlowReversal=true [ci skip]

* tell modelica formatter to ignore getPeakMassFlowRate.mo because of failures

* change getPeakMassFlowRate.mo to *.mot, reactivate modelica-fmt on it

* oops, look for new filename [ci-skip]

* remove commented code [skip ci]

* add Medium redeclaration in MFT template

* add OM files folder

* All_spawn_models

* Teaser Single worked

* add timeseries output nodes to make OM happy

* allow flow reversal in spawn building

* relax thermal zone constraint in teaser

* properly check for chp in sys param file

* fix double appending of heating plant when no chp to package.order

* pre-commit on Jiazhen's temp files for OM testing; remove some spawn-single files

* remove requirements.txt check from pre-commit, since we don't use that

* `poetry update`

* Spawn and Teaser changes

* pre-commit formatted Jiazhens modelica files

* hardcode numberofchillers=2 as a hack because OM does not do dot access

* add `allowFlowReversal=true` to spawn load instance

* hack in the hardcoded numberofchillers to make OM happy

* update 5g sys-param file to use 5g ets params

* add district 5g timeseries test

* `poetry update`

* add `.pytest_cache` to gitignore

* update mft connect statements to work in OM

* remove commented template code

* get 5g districts of multiple buildings working

* remove test models from Jiazhen

* `poetry update`

* use newer version of poetry in ci

* remove redundant `precommit` test env from CI matrix

* remind poetry that we only support python >=3.9 now

* `poetry update`

* use newest poetry patch in ci

* autopep8

---------



* Modify GHE params (#537)

* remove connectors from ghe params

* modify test and ghe system param file

* update ghe parameters schema

* modify ghe parameters

* modify ghe parameters

* add system parameter files for borehole test

* update example files

* update example files for model connectors

* add ets 5th gen params

* add array for ghe geometry params

* remove print statement from test

* Adds defaults and required fields for ghe_params and 5th gen ets params

---------



* Fixing borefield test breaks due to schema changes (#550)

* Add redeclaration of allowFlowReverseSer=true

* Inital implementation of district system template with single GHE

* Add modified GroundTemperatureResponse class to overwrite MBL

* Initial implementation of OneUTube and PartialBorefield templates

* Fix bug of inconsistent template name and Modelica class name of BuildingTimeSeries

* Update system template, removed temperature sensors

* District energy test file that has multiple buildings

* Add comment and test version control with VSCode

* Add declaration of borefield data parameters

* Add template for TwoUTubes borefield

* Remove unneeded mo files

* Modify input field names based on schema

* Change within statement

* Initial implementation of borefield.py

* Conversion of shank spacing

* Modify shank spacing conversion

* Remove unneeded mo file

* Minor changes to model_name

* Add system template for testing borefield template

* Initial implementation of borefield test

* Move ghe system parameter files to right location

* Take out SingleGHE system template for now

* Change within statement

* Initial implementation of borefield coupling

* Add code to point to BorefieldSystem.mot

* Remove duplicated test script

* Rename package

* Add {%endraw%} at the end

* Add input fields needed for the test

* Debugging changes

* Add borefield_instance.mopt

* Changes for debugging, now the test passes

* Add borehole_length to example system params file

* Debug PartialBorefield.mot, it passes check

* Change coupling definitions

* Minor changes

* Remove partial template models

* Add sample g-function and path

* Reverting 3 system params files

* pre-commit now with more modelica-fmt

* Apply uniform 5G district system template

* Remove unused GHE district template

* Fix for non-ghe 5G districts

* Delete sys_param files not needed

* Replace Gfunction input with csv file

* Point to the right sys_param file

* Updated template to reflect schema changes

* Changes for the test to run

* Fix backslashes

* Change to adapt to recent commits

* Temporary fixes to make the test pass

* Change ghe_dir to relative path

* Use pathlib to handle ghe_dir

* Add if statement to avoid breaking other 5G tests

* Change due to schema change

* Pre-commit changes

* Fix bug

---------



* Updating GHE Parameters: Modifying GHE Parameters schema and example files (#551)

* remove loads as required

* add objects for unique ghe properties

* update ghe specific schema objects

* add borehole to ghe specific properties

* update schema and example to not require autopopulated fields

* update to relative path

* update model connector examples

* Fix borefield test breaks due to the schema changes in issue #551 (#554)

* Add redeclaration of allowFlowReverseSer=true

* Inital implementation of district system template with single GHE

* Add modified GroundTemperatureResponse class to overwrite MBL

* Initial implementation of OneUTube and PartialBorefield templates

* Fix bug of inconsistent template name and Modelica class name of BuildingTimeSeries

* Update system template, removed temperature sensors

* District energy test file that has multiple buildings

* Add comment and test version control with VSCode

* Add declaration of borefield data parameters

* Add template for TwoUTubes borefield

* Remove unneeded mo files

* Modify input field names based on schema

* Change within statement

* Initial implementation of borefield.py

* Conversion of shank spacing

* Modify shank spacing conversion

* Remove unneeded mo file

* Minor changes to model_name

* Add system template for testing borefield template

* Initial implementation of borefield test

* Move ghe system parameter files to right location

* Take out SingleGHE system template for now

* Change within statement

* Initial implementation of borefield coupling

* Add code to point to BorefieldSystem.mot

* Remove duplicated test script

* Rename package

* Add {%endraw%} at the end

* Add input fields needed for the test

* Debugging changes

* Add borefield_instance.mopt

* Changes for debugging, now the test passes

* Add borehole_length to example system params file

* Debug PartialBorefield.mot, it passes check

* Change coupling definitions

* Minor changes

* Remove partial template models

* Add sample g-function and path

* Reverting 3 system params files

* pre-commit now with more modelica-fmt

* Apply uniform 5G district system template

* Remove unused GHE district template

* Fix for non-ghe 5G districts

* Delete sys_param files not needed

* Replace Gfunction input with csv file

* Point to the right sys_param file

* Updated template to reflect schema changes

* Changes for the test to run

* Fix backslashes

* Change to adapt to recent commits

* Temporary fixes to make the test pass

* Change ghe_dir to relative path

* Use pathlib to handle ghe_dir

* Add if statement to avoid breaking other 5G tests

* Change due to schema change

* Pre-commit changes

* Fix bug

* Changes due to schema change

---------



---------




* Enable compile & simulate with OpenModelica in Docker (#545)

* updating plant components to work with OpenModelica

* add "each" to array of parameters. first pass

* remove nports count setting for OM

* bump requests version to remove RequestsDependencyWarning about charset_normalizer

* `poetry update`

* redeclare the correct building class in 5G timeseries template

* `allowFlowReversal` in timeseries_instance to make OM solver happy

* put FlowReversal only in the 5g part of TimeSeries_Instance

* lower 5G building hot water supply/return temps

* restore nports=1 for 4g timeseries buildings

* allowFlowReversal=true in heat exchanger

* add within statement at top of getPeakMassFlowRate.mo

* read getPeakMassFlowRate.mo as a template, so we can have the model name added properly

* add spaces around project_name in mft template

* add allowFlowReversal=true to all 4G timeseries buildings

* allowFlowReversal=true in network2pip_instance [skip-ci]

* set all remaining allowFlowReversal=true [ci skip]

* tell modelica formatter to ignore getPeakMassFlowRate.mo because of failures

* change getPeakMassFlowRate.mo to *.mot, reactivate modelica-fmt on it

* oops, look for new filename [ci-skip]

* remove commented code [skip ci]

* add Medium redeclaration in MFT template

* add OM files folder

* All_spawn_models

* Teaser Single worked

* add timeseries output nodes to make OM happy

* allow flow reversal in spawn building

* relax thermal zone constraint in teaser

* properly check for chp in sys param file

* fix double appending of heating plant when no chp to package.order

* pre-commit on Jiazhen's temp files for OM testing; remove some spawn-single files

* remove requirements.txt check from pre-commit, since we don't use that

* `poetry update`

* Spawn and Teaser changes

* pre-commit formatted Jiazhens modelica files

* hardcode numberofchillers=2 as a hack because OM does not do dot access

* add `allowFlowReversal=true` to spawn load instance

* hack in the hardcoded numberofchillers to make OM happy

* update 5g sys-param file to use 5g ets params

* add district 5g timeseries test

* `poetry update`

* add `.pytest_cache` to gitignore

* update mft connect statements to work in OM

* remove commented template code

* get 5g districts of multiple buildings working

* remove test models from Jiazhen

* `poetry update`

* use newer version of poetry in ci

* remove redundant `precommit` test env from CI matrix

* wip: OM Docker code partial setup. Needs at least more Dockerfile work

* remind poetry that we only support python >=3.9 now

* `poetry update`

* use newest poetry patch in ci

* autopep8

* ignore typing error, and temporarily(?) remove method argument

* om docker-compose yml file

* change call from `spawn_docker.sh` to `om_docker.sh`

* OM Dockerfile, and remove old Dockerfile

* update modelica_runner for OM and remove spawn references

* update python and shell scripts to run OM in Docker container

* remove files no longer necessary

* more updates for switch from spawn to OM

* update test regarding switch from spawn to OM

* re-enable a third cli argument for om.py in the container

* handle a third argument to the cli inside the container

* clean up docstring, try a new path to om_docker.sh

* uncomment the file moving lines I commented. doh

* tell mypy to ignore a line in om.py

* run the same model we're testing for build success

* Enable tests to run in docker with omc (#552)

* Modify GHE params (#537)

* remove connectors from ghe params

* modify test and ghe system param file

* update ghe parameters schema

* modify ghe parameters

* modify ghe parameters

* add system parameter files for borehole test

* update example files

* update example files for model connectors

* add ets 5th gen params

* add array for ghe geometry params

* remove print statement from test

* Adds defaults and required fields for ghe_params and 5th gen ets params

---------



* incremental updates, bouncingball should work

* refactor the run in docker command

* symlink mbl when running om.py

* update the signature of the run_in_docker command.

* mypy updates

* remove optimica vars and enable running simulations

* do not run simulations on windows

* update lock files

* update poetry, cleanup results to not include c code

* fix boreholefield build, run still fails--ignoring

* mark spawn and teaser models as failing. There are errors reported even though the mat file is created

* udpate create_mbl_mount bash function to get mbl path in a better way

* handle case where user downloads MBL and the Buildings path is one level higher

* update poetry lock

* dedent

* Dockerfile now builds image that works with ARM chips

* Update uo_des.py

---------




---------






* Enhance and expand microgrid templates and code (#549)

* capacitor template from zhanwei and code to render it

* refactor to reduce line-length

* add minimal capacitor examples to microgrid test sys-param

* new test for creating a capacitor model from template

* district battery template and code

* test for building district battery from template

* generator code and template

* update microgrid test sys-param file to include building generators

* test for building a generator model

* reformat simple_gmt_base.py to shorten line length

* clarify variables in generator code

* template and code for electrical grid

* updated micrigrid example sys-param to include electrical grid params

* add test for creating grid model

* inductive load template and code

* microgrid sys-params for ac inductive loads

* test for building inductive load model

* simplify `within` statement because the models are still simple

* fix ACLine template to work with OM

* capitalize Inductive.py (and change test call to it) to make github happy

* also capitalizing Battery.py and changing the test to match

* additional parameters for capacitors so simulations succeed on OM

---------



* Prepare 0.5 release (#556)

* prep release

* add changelog

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>
Co-authored-by: tanushree04 <47833030+tanushree04@users.noreply.github.com>
Co-authored-by: Jing Wang <31628742+JingWang-CUB@users.noreply.github.com>
Co-authored-by: jiazhenling <89460432+jiazhenling@users.noreply.github.com>

* Add simulation flag to not remove all output files (#559)

* flag to not remove all output files

* fix typo in pytest mark

* dry code and change to pathlib where possible

* clarify variable name when deleting files

* enforce Path type to make mypy happier

* tell mypy to ignore a line

* make path windows-friendly, even though CI only uses it on linux

* move deletion of tmp folder to the container

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Read correct data from sys-param for microgrid electrical load (#560)

* read electrical load from each building for microgrid model

* add test for microgrid electrical load simulation

* add logging to generators.py, and clarify comment

* remove incorrect fields from test microgrid sys-param file

* inductive loads use kW, capacitive loads use kVAr (reactive power)

* delete commented line from inductive.py

* skip inductive load simulation because OMC chokes. Dymola runs it fine

* upgrade poetry version in ci to 1.5.1 (#564)

* upgrade poetry version in ci to 1.5.1

* surely upgrading dependencies won't help Poetry in the CI env, right?

* enable numberOfIntervals run option (#562)

* Stop and remove containers if user cancels a simulation (#563)

* catch a ctrl-c and kill the docker container

* remove bash function to catch sigint because it's not the right place for that

* more pythonic docker kill command

* use omc 1.20 (#565)

* Breakout package parser class (#566)

* move package_parser to its own file

* add cspell workspace dictionary

* add cspell workspace dictionary

* fix mypy errors

* skip 2 tests that fail using OM 1.20

* remove unnecessary python enumerate command

* refactor: swap os. for Path in package_parser.py

* refactor: transform self.path to be a Path no matter what it came in as

* Revert "refactor: transform self.path to be a Path no matter what it came in as"

This reverts commit 092e3863ee52a187233df224b034400ab99d9301.

* Revert "refactor: swap os. for Path in package_parser.py"

This reverts commit 137b8c163b38438a149728719c57b43520f8fbf7.

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Improve gfunction path (#568)

* ghe_dir now works as expected for absolute path or relative to sys-param file

* expand comment on ghe_dir in schema to explain what works

* update test ghe sys-param file with new relative path

* add error handling for incorrect relative ghe_dir path

* Add a new GHE district test with new network template models (#561)

* New network model and its coupling

* Bug fix

* Refer to load ids in relevant couplings

* New coupling definitions

* Add test script for new template

* Avoid potential fail if more buildings added

* Changes due to new g-function csv format

* Format fixing

* Modify sys_params for new test

* Avoid overriding final parameters

* Revise relative path of ghe_dir

* Pre-commit changes

* fix ghe text syntax

* update borefield pytest skip reason with more detail

* make resources_dir relative path NOT platform-aware, so it will always work in Modelica

* Revert "make resources_dir relative path NOT platform-aware, so it will always work in Modelica"

This reverts commit 845b1903548f5a9bbaa31201e842c2a131603e85.

* Change gfunction.mat path to modelica path

* pre-commit changes

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Add GHE Properties to System Parameter File (#570)

* add ghe to create system parameter function

* Add design method for borehole

* update create sys param and system_parameter.py

* update tests

* update district system type property

* reduce unnecessary indenting

* add negative sign to heat_flow to designate as cooling

* clean up test setup now that we have at least python 3.8

* update district_system_type property in system_parameters.py

* redo the un-indenting I accidentally committed

* update dependencies with poetry

* remove generated test sys-param file

* gitignore generated test sys-param file

* add sys param argument

* fix typo that prevented sys-param creation via cli

* remove nonsensical 5G district parameters

* clean up uo_des test comments a bit, and add intermediate assertions

* remove outdated spawn compilation instructions

* enable 5G models with the CLI

* add borehole length to template

* add gfunction csv file to cli test for ghe district tests

* more updates to gmt class to handle 5g districts from cli

* choose generations more explicitly in district.py

* use correct sys-param parameter name in borefield.py

* add start/stop/step times for model simulation to cli options

* add 5g cli integration test, update calls to simulate during the summer

* Quick fix to enlarge loop flow rate

* change borehole length in test sys-param files to match schema

* make pytest skip reason comment more explicit

* don't skip distribution simulation test

* clarify pytest skip reason comment

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>
Co-authored-by: Jing Wang <jwang5@nrel.gov>

* remove ground loads from system parameter (#576)

* test a new poetry gha (#573)

* test a new poetry gha

* poetry dependency caching on CI

* caching ci dependencies did not work. removing that step.

* use pretty name for poetry installation step

* delete redundant poetry command from ci

* `poetry update`

* Use `filNam` parameter for TEASER loads and add within parsing to PackageParser (#574)

* use filNam for teaser loads

* fix types

* remove unused exists method

* Add new `ModelicaProject` class (#575)

* use filNam for teaser loads

* fix types

* add modelica project class with save_as method

* fix types

* fix windows-based test

* clarify docstring a tiny bit

* `poetry update` to pick up new modelica-builder version

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Add Dymola runner (#577)

* use filNam for teaser loads

* fix types

* add modelica project class with save_as method

* fix types

* add method to run modelica models in dymola

* rename cspell dictionary

* move modelica tests to class

* Update tests/base_test_case.py

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* skip tmp folder in ModelicaProject

* fix windows-based test

* add get_model method to modelica project

* update docstring

* relative path option

* add relative path setting for system parameter generation

* precommit

* do not dymola in tests

* Update geojson_modelica_translator/modelica/modelica_project.py

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Update geojson_modelica_translator/modelica/modelica_project.py

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Update geojson_modelica_translator/modelica/modelica_project.py

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Update geojson_modelica_translator/system_parameters/system_parameters.py

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* pre-commit pep8 fix

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Prep for prerelease 0.6.0 (#578)

* prerelease

* add in changelog notes

* initialize empty variable before potential use (#579)

* Include 5G partial model in generation (#580)

* use the DHC 5g partial model

* reenable test

* Use Buildings TemperatureTwoPort

* set flow of borehole field separate from district

* Template initial microgrid subsystem example (#569)

* pvsubsystem template and code to render

* test to build pvsubsystem model from template

* transformer template and code to render

* hacking in some sample transformer data to the sys-param file

* new tests for transformer, and simulation tests for previous components

* add calculation for line power in line and pvsubsystem templates

* skip test_build_pv_subsystem because it is captured in the simulation test

* add comments to pv_subsystem.mot for future improvements

* add todo to get ditto-reader info about transformers into the sys-param file

* add code to read transformer in- and out-going voltages from uo sdk

* fix transformer template and code to use new variable names

* update test sys-param file with current variable names

* use .get() method for looking at opendss values

* use .get() method for other transformer properties as well

* formatting instance file

* remove single 5g test file - district 5g test already exists

* unskip testing district 5g system

* add start/stop/step times to dhc test setup

* re-skip the dhc simulation test

* use appropriate cable in pv subsystem model

* capacitor was confused with capacitive load. fixed capacitive load

* use pathlib instead of os.path when adding microgrid to sys-params

* tests for capacitive load model

* `poetry update`

* gix typo in transformer data for sys-param

* potential solution to poetry dependency installation failures

* fix district heating and cooling test assert path

* Fix poetry dependency installation failures (#583)

* potential solution to poetry dependency installation failures

* clean up ci comments

* another tiny commit to reassure myself poetry is happy now

* ugh, fix duplicate line I mistakenly added during conflict fix

* allow skipping of specific files when cloning a modelica project (#584)

* Microgrid heating (#586)

* add polynomial boiler template

* microgrid polynomial boiler template and code

* test for simple level 1 microgrid boiler

* add templatizing to model annotation records [skip ci]

* update boiler nominal massflow rates in test sys-param files

* use better default values for boiler massflow rates, and remove `unused` flag

* update massflow rate values in sys-param templates used by cli

* update massflow rate values in example file. Has this been deprecated?

* Cleanup helpers (#588)

* nudge users to provide dependency information when raising issues

* update sys-param file used with check_sys_params command

* don't add PRs with the  label to the automatic changelog [skip ci]

* `poetry update`

* Add a quick fix for reading gfunction.csv from ghe_id subfolder (#589)

* add ghe to create system parameter function

* Add design method for borehole

* update create sys param and system_parameter.py

* update tests

* update district system type property

* reduce unnecessary indenting

* add negative sign to heat_flow to designate as cooling

* clean up test setup now that we have at least python 3.8

* update district_system_type property in system_parameters.py

* redo the un-indenting I accidentally committed

* update dependencies with poetry

* remove generated test sys-param file

* gitignore generated test sys-param file

* add sys param argument

* fix typo that prevented sys-param creation via cli

* remove nonsensical 5G district parameters

* clean up uo_des test comments a bit, and add intermediate assertions

* remove outdated spawn compilation instructions

* enable 5G models with the CLI

* add borehole length to template

* add gfunction csv file to cli test for ghe district tests

* more updates to gmt class to handle 5g districts from cli

* choose generations more explicitly in district.py

* use correct sys-param parameter name in borefield.py

* add start/stop/step times for model simulation to cli options

* add 5g cli integration test, update calls to simulate during the summer

* Quick fix to enlarge loop flow rate

* Fix for reading gfunction from ghe_id folder

* Resolve conflict

* Discard unwanted changes

* Fix broken test_uo_des.py

* Point to a different ghe_dir

---------

Co-authored-by: Tanushree <tanushree.charan@nrel.gov>
Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Change how ModelicaPaths are built so they also work on Windows computers (#590)

* enforce modelica-style paths in ModelicaPath resources_relative_dir property

* enforce modelica-style paths in the rest of the ModelicaPath class

* fix utils test to match new ModelicaPath output

* Move modelica methods from GMT to modelica-builder (#591)

* move modelica methods to gmt

* update dependendencies

* point to latest builder release

* prep 0.6.0 rc2 release

* Add model for controlled distribution loop mass flow rate (#594)

* add model for controlled distribution loop

* note about not running in omc

* note about not running in omc

* allow user to specify name of modelica.mos file to load in System Parameter generator (#599)

* Decouple gain for distribution and ghx mass flow rates (#600)

* decouple gain for distribution and ghx mass flowrates

* set building load multiplier to 1

* Refactoring and enhancing to support multiple GHEs in a single district (#601)

* use ghe ids and data from ThermalNetwork demo 2

* refactor sys_params.get_param_by_id to take any id, not just buildings

* refactor usage of get_param_by_building_id to get_param_by_id

* fix ghe_dir path in test sys-param file

* handle non-ghe districts

* test for getting param by ghe_id

* rename gfunction dir because I changed the ghe_id in the test sys-param file

* use consistent ghe_id across tests so paths work as expected

* Closed-loop changes to existing test_single_ghe test (#597)

* Add Q_flow output

* Add function for saving the used gfunction to tmp

* Change length to length_of_boreholes

* Add temp sensors and pump controller

* Modify connections for closed loop

* Change expansion vessel port number

* Take out hard code

* Enlarge number of boreholes

* Enlarge default borehole length

* Disable use_m_flow_in for GHE test

* Pre-commit changes

* pre-commit to run modelica-formatter

---------

Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Re-enable a number of tests (#585)

* only test for 1 day so tests work and can be unskipped

* move use_m_flow_in to correct place in ambient instance template

* add container info logging and update log statements

* use OMv1.21 in container

* teeny change to log usage in om.py

* skip chp test until we figure out what OM wants in initial values

* teaser heating test step size set to 1 hour

* add pytest marker for docker tests [skip ci]

* refactor os.path to pathlib.Path in test_borefield.py

* add docstring and fix typo in ambient_water_stub.py [skip ci]

* log additional reason for simulation failure to ease debugging

* test simple cooling plant for only 1 day in the summer

* update dependencies

* `poetry update` to pick up the upgraded dependencies

* more permissive versioning of syrupy, to get additional feature releases

* update dependencies again for newer syrupy

* mark one more test as docker

* update GMT_lib snapshot because new version of syrupy

* change step_size in one test so it passes locally for me

* test that users can provide number_of_intervals instead of step_size

* add a forgotten test file to gitignore

* clean up raw/endraw tags in templates

* use local container with OMv1.22

* fix typo made when cleaning up raw/endraw tags

* set m-b dependency properly for this branch

* Revert "clean up raw/endraw tags in templates"

This reverts commit e325478846d0b038ac95c66474a0950a9dee59d7.

* update dependencies

* update OM version in dockerfile and add timestamp logging

* clean up spawn scripts when running with OM

* skip teaser heating because of simulation weirdness

* one more cleanup of dymola/spawn-specific stuff no longer necessary

* include OM version in stdout.log file when running OM

* use new docker image with OMv1.22.0

* add OM version logging to the rest of the relevant functions

* use updated BuildFMU method from OM

* slightly cleaner syntax for Path.chmod in modelica_runner.py

* add cmake to base image for OpenModelica FMU compilation

* change interval & step size so local tests are happy

* remove redundant boolean in 5G instance template

* update dependencies

---------

Co-authored-by: Nicholas Long <nicholas.long@nrel.gov>

* skip teaser test

* Replace shell script with call directly to docker (#607)

* fix(modelica_runner): Replace shell script with call directly to docker (#606)

* fix(modelica_runner): Replace shell script with call directly to docker

* fix(dockerfile): Update the base OM docker image

* use f-string for new docker command

* update dependencies

* comment to update MBL version in modelica-builder as well as Dockerfile when needed

* put exec call into list format for subprocess.Popen

* run simulations on Windows (shocked face!!)

* remove test for old om_docker_path

* remove oudated code from ModelicaRunner.init()

* remove outdated assert in modelica test file

* don't forget to remove the  dir from the model dir after simulation

* use new container that has OMv1.22.1, MBLv10, and MSLv4

* use pathlib for path component instead of os

* go back to only running simulations on Linux :(

* run_path has already been verified to be a Path. Make mypy happy.

* use GHA-style if-syntax

* use MBL tag instead of branch, and clean up call to install it

* change permissions in tmp folder to allow deletion

* temporarily run a very small CI config

* give myself even more permissions to try to delete tmp dir

* use .run method of subprocess instead of Popen

* move tmp dir deletion to the subprocess call method

* TMP: change CI to only run a single test for temporary testing

* chmod the offending dir

* move tmp deletion back to cleanup where it should be

* logging for the GHA runner

* ugh, different logging for GHA runner

* use exists() instead of is_dir(), just for grins

* grant write permissions to CI in the runner

* comment single dir permissions change

* another way of deleting tmp file/dir

* ugh, forgotten bit of text

* change permissions on tmp dir before deletion

* get more nuclear about deleting tmp dir

* clean up comments for removing tmp dir

* re-enable full test suite in CI

* clean up ci file a teeny bit more

* test simulations on Windows again

* Revert "test simulations on Windows again"

This reverts commit e25a5c3fccc4b9c5ac6c23c1f93d10d401a0427d.

* Revert "clean up ci file a teeny bit more"

This reverts commit e3f00e2abc9bfad530918e0e9da28566e98194de.

---------

Co-authored-by: Chris Mackey <chris@mackeyarchitecture.com>

* Implement a PyPI release workflow (#603)

* GHA to automatically publish to pypi when making release in github

* rename pypi release config yml file to avoid confusion with changelog config file

* new alpha version of gmt for testing automatic pypi release workflow

* Update documentation for version 0.6.0 (#592)

* getting_started and developer_resources updated for GMTv0.5.0 [skip ci]

* minor docs changes as I think about it more [skip ci]

* docs to show we now support Windows!

* update copyright

* spelling

* eg with commas

---------

Co-authored-by: Nicholas Long <nicholas.long@nrel.gov>

* Support Python 3.12 (#593)

* update pre-commit hooks with `pre-commit autoupdate`

* support python 3.12

* update dependencies

* run tests on python 3.12

* tell pypi we support python 3.12

* autopep8

* don't reformat a long line because it makes the quotes weird

* don't reformat another long line because it makes the quotes weird

* point to develop branch of modelica-builder now that 3.12 support has been merged

* update dependencies

* use new release of geojson that supportys python 3.12

* update dependencies with `poetry update`

* update dependencies

* update dependencies

* use newly released version of modelica-builder

* update dependencies

* use a branch of modelica-builder

* update dependencies

* bump versions of actions in pypi_release workflow. inconsequential.

* use new patch version of modelica-builder so models build properly

---------

Co-authored-by: Nicholas Long <nicholas.long@nrel.gov>

* Mblv10 (#581)

* add mypy cache to gitignore

* fix typo in cli usage instructions

* update cli error message to match current simulations results path

* more log output, cleaner comments, remove abandoned code

* clean up log output in modelica_runner

* correct filepath for CLI success confirmation message

* add log output for users when starting docker container

* rename `...OBC.CDL.Continuous` to `...OBC.CDL.Reals`

* use MBLv10 in CI

* use new preconfigured fan model, which extends the 9.1 one

* remove deprecated (incorrect) mbl path in 5g load template

* use MBLv10 in mofile and package template files

* use branch of modelica-builder that uses mblv10

* remove TRooHea_nominal and replace QRooHea_flow_nominal with QEnv_flow_nominal

* NEW CONFIG: set mbl_version in utils.py

* pass mbl_version to PackageParser when generating top-level package.mo

* `poetry update` to read modelica-builder from git branch during development

* add note in developer docs to check mbl_version() when releasing the gmt [skip ci]

* remove `extends` that is no longer used in mblv10

* OM can't handle more than 1 dot-level deep, so 'temporarily' hardcode this

* properly define QEnv_flow_nominal

* update dependencies

* update dependencies, mainly to use the correct m-b branch

* use OMv1.22 in dockerfile

* adjust 5G building template to always have_hotWat to work with mblv10

* reduce pressure drop in 5G pipes for mblv10

* one more hav_hotWat that was missed earlier

* remove unnecessary portion of if-statement in model_base

* remove outdated line from load_base docstring

* `poetry update`

* give SHW a load in the test mos file

* another little tweak to help 5G work with MBLv10

* add fake SHW load to work around MBL... "issue"

* update instance templates for MBLv10 compatibility

* use more realistic initial values for GHE system

* fix regular 5G model to work with MBLv10

* include forgotten ghe borehole sys-param data

* add dhDis & dhCon to gmt_lib templates too

* add fake SHW load to more test load .mos files

* another place where MBL path changed

* update readme for building and releasing the gmt-om-runner

* add fake SHW data to cli test data

* use OM-versioned docker image

* update dependencies

* update cooling plant instance and partial plant parallel for MBLv10

* new mblv10 classes for central boilers

* hard-code some heating pump parameters so OM can handle it

* update dependencies

* change signals & connections for MBLv10

* skip test because it only works with qss solver, not dassl

* merge `unskip-tests` branch into this one

* skip teaser tests for now

* update dependencies

* use MBLv10 in CI

* use MBLv10 in Dockerfile

* update dependencies

* don't set  in chp file when it's already done in MBL

* skip gmt_lib_des OM simulations until we get help from LBNL

* more useful skip reason for CHP test

* om.py was somehow incorrectly kept when merging from develop. Remove it again

* point to a Docker container with MBLv10.0

* make Dockerfile comment a little more permissive to match the code

* fix typo in skip reason text

* update versioning of gmt runner image

* precommit

* handle arbitrary number of buildings in 5G districts

* use 100 for pressure drop. only breaks district_single_ghe

* revert ghe flow rate to 0.2 as originally intended

* use 250 for nominal pressure drop as is appropriate

* hard-code the district pump head pressure. Fix later

* use newly released version of modelica-builder

* remove commented code

---------

Co-authored-by: Nicholas Long <nicholas.long@nrel.gov>

* Add district nominal pump head to system parameters file (#610)

* Add nominal pump head to parameter file

* Read district pump head from parameter file

* Add to more test parameter files

* update central pump parameters

* adds central pump parameter

* use new required district param in more test files

---------

Co-authored-by: Tanushree <tanushree.charan@nrel.gov>
Co-authored-by: Nathan Moore <nathan.moore@nrel.gov>

* Use Ubuntu 20 and fix CHP model (#611)

* fix CHP model for MBLv10

* re-enable CHP test for a short simulation duration

* remove unnecessary dhCon & dhDis from templates

* use Ubuntu 20 in Dockerfile

* bump version of dockerfile

* use new docker image

* re-enable gmt_lib tests now that we are using ubuntu 20

* bump to real version 0.6.0

* break out cert download to be a file and update readme

---------

Co-authored-by: Nicholas Long <nicholas.long@nrel.gov>

* Update CHANGELOG.rst for v0.6.0

---------

Co-authored-by: Nicholas Long <1907354+nllong@users.noreply.github.com>
Co-authored-by: tanushree04 <47833030+tanushree04@users.noreply.github.com>
Co-authored-by: Jing Wang <31628742+Jin…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants