Skip to content

Commit

Permalink
Prep 0.4.1 (#523)
Browse files Browse the repository at this point in the history
* Don't crash if missing reopt data, just warn and move on

* poetry update

* update microgrid sys-params with modern opendss output

* wip compile & run with spawn & optimica

* flesh out spawn.py

* tiny typo fix of web link in docstring

* add a little to spawn.py docstring

* clarify comments in compile_fmu function

* shell function to kill container if process is interrupted

* enable simulating pre-built fmu with spawn

* wip spawn_docker.sh, still missing docker run command

* create spawn image

* update comment. maybe a line of code is not needed?

* one tiny update from os.path to pathlib

* itty bitty formatting & comment cleanup

* clean up dockerfile

* start docker-compose file

* [skip ci] wip: clean up call to spawn_docker & spawn.py

* small step forward with docker-compose file

* clean up subprocess call and add compiler parameter

* clean up dockerfile even more

* add docker run command, and modelon license env var stuff

* tiny comment change

* questions when building the spawn image

* questions when starting the spawn container

* questions about calling the image in docker-compose

* ensure valid compiler is passed to spawn.py

* new path to spawn.py inside conatiner

* functional docker-compose file

* trying to install spawn into docker image

* make the create-sys-param command slightly less brittle

* cli build-sys-param command now does not break at residential buildings

* [skip ci] replace os with pathlib in base_test_case

* fix bug where district microgrid features were not processed

* include assertion for pv on a building, not just district

* uncomment simulation commands now covered with "not simulation"

* map from ditto-reader wires to mbl wires for templates

* use appropriate mbl wires in template

* add python to spawn container, default debugging, fix path passing

* use mbl line names in the cables; add todo regarding wire mapping

* Mingzhe fixed my template

* move pytest marker definition to pyproject.toml

* delete commented code that was moved to pyproject.toml

* poetry update

* run with optimica, only works for bouncing ball right now

* old version of spawn

* update issue template

* add pyfmi

* enable successful type hinting in 3.8 & 3.9

* make some spawn.py arguments specifically not required. Add some type hints

* poetry update

* remove redundant Action trigger

* Revert "enable successful type hinting in 3.8 & 3.9"

This reverts commit a69cbb6.

* type hint for list only wants one instance of dict apparently

* positional arguments need a different way of being optional

* replace named arguments in spawn_docker.sh

* wip: clean up paths transferred to spawn.py

* crazy way of including paths in the container, but it works

* autopep8

* remove reference to arg_list which is no longer used

* add in optimica-based compilation

* rename docker hub user to nrel

* use bash when piping file

* restructure weather file download

* update lock file

* update lock file

* fix i/o error

* reenable downloading both mos and epw

* reenable downloading both mos and epw

* upgrade ci to mbl master/9.1.0

* dump stdout log to logger

* Update license secret

* remove debug logs

* Add 5g to sysparams (#469)

* fix error in schema

* small refactor before 5G addition

* add choice for 4G and 5G systems

* fix oneOf condition in json schema

* update sys-params.py to work with explicitly labeled 4gdhc systems

* update some test sys param files to explicitly label 4gdhc systems

* remove "custom" title, require "ets_model" in building_def

* remove default path elements in sys_param call

* update test sys param file

* improve schema validation failure reporting

* updating schema hierarchy and types in a few places

* more updates to test sys-param file to work with choice of system generation

* json keys are not allowed to start with a number

* loop differently now that "buildings" object itself is a list

* change expanded_path test to work when called from anywhere

* fix another test now that "buildings" is a list

* update another test sys-param file to work with new schema

* WIP: fix most sys-param tests

* Revert "improve schema validation failure reporting"

This reverts commit c212750.

* fix xpath path to parse lists correctly

* fix xpath path in test so list gets parsed correctly

* update test sys param files to work with 5g schema

* simplify get_param_by_building_id now that the param default section is not a thing

* remove duplicate spawn sys param file

* update cooling plant xpath paths to district system in sys params file

* remove newly unnecessary function parameter

* remove unnecessary if-statement level

* update jsonpath parsing now that "buildings" itself is an array

* update jsonpath in model_base for new jsonpath in district_systems

* update jsonpath in load_base for indirect params

* Revert "remove unnecessary if-statement level"

This reverts commit 47b44d7.

* update sys-param tests with new jsonpaths and new exception types

* Revert "change expanded_path test to work when called from anywhere"

This reverts commit 9bd7d70.

* change more jsonpaths away from "default"

* skip geojson validation for features with "detailed_model_filename"

* remove another instace of "custom" in hardcoded jsonpath

* change jsonpath key to indirect ets params in their py files

* remove "custom" from jsonpath in load_base

* fix jsonpaths in teaser.py

* update jsonpaths in chp.py to explicitly look at 4th gen

* update jsonpaths, make filechecks more detailed in sysparams.py

* remove default values in function call, and the test for those default values

* update dict indexing in test to get to correct value now that sys-param hierarchy has changed

* fix test json path that came in from microgrid PR

* set model_base log level to info

* autopep8

* change fourthGDHC to fourth_generation and same for fifth

* remove test that only tested default sys-param values, which no longer exist

* remove sys-param file from tests that was not being used

* require ets params for each building

* implement ets requirement in each load_connector type

* fix jsonpath for new schema hierarchy

* Revert "require ets params for each building"

This reverts commit f5cf3bc.

* Revert "implement ets requirement in each load_connector type"

This reverts commit ec36396.

* remove unused variables from spawn building template

* remove unused ets variable from teaser building template

* remove ets sys-param code that is not needed, variables removed from templates

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

* Bump mako from 1.2.1 to 1.2.2

Bumps [mako](https://github.com/sqlalchemy/mako) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/sqlalchemy/mako/releases)
- [Changelog](https://github.com/sqlalchemy/mako/blob/main/CHANGES)
- [Commits](https://github.com/sqlalchemy/mako/commits)

---
updated-dependencies:
- dependency-name: mako
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Weather file at top level (#497)

* move weather to top-level in sys-param files

* update sys-param schema to put weather at top-level

* handle new weather file location in sys-params

* update sys-param tests for new weather file location

* Update schema.json

* test with 3.10

* bump supported python version

* update lock file

* change max python version to be <3.11

* poetry update

* update poetry version used for ci

* trying not supporting 3.7 in ci

* ensure "poetry update" is run in CI

(cherry picked from commit 26bb2d5)

* only support python 3.10

* only support python 3.10 in ci

* poetry update again

* simplifying tox call in ci

* bump pre-commit isort version

* quotes around 3 in pre-commit isort command

* use officially sanctioned isort for pre-commit

* set isort configs in pyproject.toml

* poetry update

* pre-commit ran with new isort version

* another attempt at passing message to pytest in tox env

* update Actions checkout and setup-python versions

* still trying to pass messages to pytest in tox

* what are the chances this works?

* surely this does not matter, right?

* back to nearly original tox call

* what if we didn't use tox in the CI tests?

* add some commands formerly supplied by the tox env

* re-enable GMT supporting python 3.7.1

* run CI tests with python 3.7 as well as 3.10

* one more poetry update

* set min python version to 3.8

* poetry update

* Revert "poetry update"

This reverts commit e882140.

* Revert "set min python version to 3.8"

This reverts commit 2093bfb.

* add python 3.10 to list of supported versions

* only support python 3.10

* revert name of test step to Tox alone, not Test/Tox

* update dependencies with poetry

* different way of running pre-commit and building docs

* ugh, case sensitivity

* comment bits about modelon in ci for now

* maybe hacky way of selecting docs env in ci

* oops, need to be in docs folder to make docs

* support python 3.7.1

* apparently we need quotes

* undelete metadata confirming this works in python 3.7.1-3.10

* 4G or 5G timeseries in Dymola (#489)

* fix error in schema

* small refactor before 5G addition

* add choice for 4G and 5G systems

* duplicate mofile from mbl, modelica-fmt ran automatically

* use dynamic model name

* ugh, ensure model name matches file name. and a few other tweaks

* beginning to update template to match mbl9.1

* enable running multiple timeseries templates in a row for ets-buildings

* pre-commit checks

* put templates in dict instead of list

* clean up redeclare statement, consider eliminating duplicate call for filNam

* update timeseriesbuilding template to match mbl9.1

* update template annotations to work with MBLv9

* autopep8 fixing blankspaces

* remove "final" label from intermediate model

* comment out variables that are no longer hardcoded in the instance

* declare filNam in this model, not the other. Set have_hotWat = true

* add missing parameters, uncomment others, alter how filNam is called

* uncomment 2 variables, remove dangling comma

* re-map some timeseries couplings to the "old" building model

* fix oneOf condition in json schema

* undo silly change to cooling mass flow rate parameter

* WIP - specify district generation in test sys params file

* WIP - enabling time series to determine which generation model to build

* update sys-params.py to work with explicitly labeled 4gdhc systems

* update some test sys param files to explicitly label 4gdhc systems

* Revert "WIP - specify district generation in test sys params file"

This reverts commit 1c4830d.

* remove "custom" title, require "ets_model" in building_def

* remove default path elements in sys_param call

* update test sys param file

* improve schema validation failure reporting

* updating schema hierarchy and types in a few places

* more updates to test sys-param file to work with choice of system generation

* json keys are not allowed to start with a number

* loop differently now that "buildings" object itself is a list

* change expanded_path test to work when called from anywhere

* fix another test now that "buildings" is a list

* update another test sys-param file to work with new schema

* WIP: fix most sys-param tests

* Revert "improve schema validation failure reporting"

This reverts commit c212750.

* fix xpath path to parse lists correctly

* fix xpath path in test so list gets parsed correctly

* update test sys param files to work with 5g schema

* simplify get_param_by_building_id now that the param default section is not a thing

* remove duplicate spawn sys param file

* update cooling plant xpath paths to district system in sys params file

* remove newly unnecessary function parameter

* remove unnecessary if-statement level

* update jsonpath parsing now that "buildings" itself is an array

* update jsonpath in model_base for new jsonpath in district_systems

* update jsonpath in load_base for indirect params

* Revert "remove unnecessary if-statement level"

This reverts commit 47b44d7.

* update sys-param tests with new jsonpaths and new exception types

* Revert "change expanded_path test to work when called from anywhere"

This reverts commit 9bd7d70.

* change more jsonpaths away from "default"

* skip geojson validation for features with "detailed_model_filename"

* remove another instace of "custom" in hardcoded jsonpath

* change jsonpath key to indirect ets params in their py files

* remove "custom" from jsonpath in load_base

* fix jsonpaths in teaser.py

* update jsonpaths in chp.py to explicitly look at 4th gen

* update jsonpaths, make filechecks more detailed in sysparams.py

* remove default values in function call, and the test for those default values

* update dict indexing in test to get to correct value now that sys-param hierarchy has changed

* fix test json path that came in from microgrid PR

* set model_base log level to info

* autopep8

* change fourthGDHC to fourth_generation and same for fifth

* remove test that only tested default sys-param values, which no longer exist

* remove sys-param file from tests that was not being used

* require ets params for each building

* implement ets requirement in each load_connector type

* fix jsonpath for new schema hierarchy

* Revert "require ets params for each building"

This reverts commit f5cf3bc.

* Revert "implement ets requirement in each load_connector type"

This reverts commit ec36396.

* remove unused variables from spawn building template

* remove unused ets variable from teaser building template

* remove ets sys-param code that is not needed, variables removed from templates

* read proper template depending on district generation in sys-param file

* autopep8

* make test_time_series pass, only works for 4G models currently

* slightly different way of handling fith and fourth gen districts

* fixing whatever was broken in my brain last time

* test file and sys-params for 5g time-series

* hack in some variables to enable user to choose between 4g & 5g models

* another hack to get time-series to generate both 4g and 5g models

* handling 4g & 5g formatting of timeseries_instance file

* ugly handling of district template data in model_base

* update 5g sys-params with new weather file location

* restore timeseries load data to 4g model after I mistakenly removed it

* add displayUnit tags to a few district template lines

* improve 5g building model descriptive text

* default 5g building to not have district service water

* add missing connect statements

* add minimum value to delTAirHea and delTAirCoo so they are never zero

* jinja logic in a few instance templates

* add 5G district template to skipped list in modelica formatter

* update one sys-param value in 5G test file

* wip: starting to modify district.py to handle 5G district templates

* 5G district template

* pretty sure that semicolon does not belong there

* remove datDes annotation, move comment characters

* fix comment on coupling templates to refer to correct model

* new 5g coupling templates

* fix comment in wind turbines code

* add line to handle 5G couplings

* update call to coupling class in 5G test with district type

* new dir for 5G couplings

* update coupling code to look for 5G couplings

* remove coupling from the wrong dir

* update test_5G file to look for 5G coupling templates

* update dependencies with poetry

* removing a few more ets references in 5G templates

* remove outdated way of looking up 5G templates

* update 5G heated water stub definition template

* oof. isort has opinions and it makes pre-commit sad

* only use ambient netwoork coupling template

* create new ambient water network stub

* minor formatting of 5G district template

* update 5g test to work with ambient network stub

* new ambient temp network stub instance

* couplings are looking better!

* templatizing 5g connection diagram lines

* clean up some leftover code from earlier exploration

* slightly less amateur way of looking in a dict

* more amateurish dict lookups removed

* remove unnecessary 5G code from 4G network stub templates, and templatize cooling temp

* remove comment about 5G test that has been addressed

* change initial values in model so heat pump does not spaz out

* slightly more realistic value for cooling water temp in 5G system

* increase temp of 5G cooling supply water

* remove comments, clean up formatting in AmbientStub definition

* increase cold water temp by 1 degree for 5G loop

* update coupling to connect cool to cool instead of hot to cool

* warm up 5G cool water temp to something more like ambient

* finish coupling cool to cool. oops.

* update lock file

* remove abandoned code for 5G district choice

* change BuildingTimeSeries model name to TimeSeriesBuilding to match filename

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

* Prep 0.4.0 release (#505)

* bump version to 0.4.0

* initial commit for automated release note config file

* add dependabot to list of authors excluded from automated release notes

* add `dependencies` to list of excluded release labels

* update changelog with copy of GH automated output

* update test geojson file to match sdk

* `poetry update`

* remove explicit float transformation, and add a log message

* make mos weatherfile explicit in code

* fix typo in microgrid commercial cable comment

* different way of rounding

* in ci: add github token, and use maint_9.1.x branch of mbl

* pin ubuntu to 20.04 to maintain use of python 3.7

* gah, missed one spot of hard-coded os version

* even the commented line, to be complete

* update developer docs with pytest message command

* use formal path to MBL, not github link

* `poetry update` again

* Detailed models (#517)

* time-series test file that only works on Nate's computer

* put geojson detailed model check in the right place

* wip: handling detailed models without geojson area

* handle cases when building_area is not provided

* doh, remove the file that only works on my machine

* add sphinx extension to make section links work easily

* move docs for cloning MBL to dev resources

* specify that GMT version 0.2.3 can use JModelica to simulate models

* `poetry update`

* bugfix of the bugfix, yay (#519)

* force casting to float when mfrt heating load is 0

* cast with float() instead of multiplying by 1.000

* update precommit and licenses on files

* add and cleanup license

* use python 3.8, update dev dependencies

* add a forgotten test output to gitignore

* bump version to 0.4.1

* update changelog

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Nicholas Long <nicholas.long@nrel.gov>
Co-authored-by: Nicholas Long <1907354+nllong@users.noreply.github.com>
Co-authored-by: amyeallen1 <amy.allen@colorado.edu>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
5 people authored Jan 6, 2023
1 parent e92c7a0 commit bc73908
Showing 100 changed files with 1,414 additions and 3,958 deletions.
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ source =
omit =
.tox/*
management/update_schemas.py
management/update_licenses.py
management/check_sys_params.py
geojson_modelica_translator/model_connectors/load_connectors/templates/RunSpawnCouplingBuilding.most
geojson_modelica_translator/modelica/lib/runner/__init__.py
17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -21,14 +21,14 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.7.1", "3.10"]
os: [ubuntu-20.04, windows-latest]
python-version: ["3.8", "3.10"]
test_env: [python, precommit, docs]
mbl_branch: [master]
mbl_branch: [maint_9.1.x]
include:
- os: ubuntu-latest
- os: ubuntu-20.04
test_env: python
mbl_branch: master
mbl_branch: maint_9.1.x
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
@@ -56,7 +56,7 @@ jobs:
poetry update
# -
# name: Save Optimica license to file
# if: matrix.os == 'ubuntu-latest'
# if: matrix.os == 'ubuntu-20.04'
# shell: bash
# run: |
# mkdir -p /home/runner/modelon
@@ -80,7 +80,7 @@ jobs:
MATRIX_OS: ${{ matrix.os }}
MBL_BRANCH: ${{ matrix.mbl_branch }}
run: |
if [[ "${MATRIX_OS}" == 'ubuntu-latest' ]]; then
if [[ "${MATRIX_OS}" == 'ubuntu-20.04' ]]; then
MODELICAPATH='/home/runner/work/modelica-buildings'
else
echo $GITHUB_WORKSPACE
@@ -123,7 +123,8 @@ jobs:
name: Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
if: ${{ matrix.os == 'ubuntu-latest' && matrix.test_env == 'python' && matrix.mbl_branch == 'master' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.test_env == 'python' && matrix.mbl_branch == 'maint_9.1.x' }}
run: |
poetry run coveralls
-
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -105,5 +105,6 @@ tests/*/microgrid_output
tests/output_ets
tests/*/output
/geojson_modelica_translator/modelica/buildingslibrary/
not/a/real/**
# TODO: this file shoud not be writtent out, but it is... fix this eventually
/geojson_modelica_translator/modelica/ets_cooling_indirect_templated.mo
42 changes: 35 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ exclude: |
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
@@ -20,17 +20,45 @@ repos:
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
# - id: requirements-txt-fixer
- id: flake8
args: ['--max-line-length=140'] # default of Black
- id: requirements-txt-fixer
- id: mixed-line-ending
- id: pretty-format-json
args: ['--autofix', '--no-sort-keys']
- repo: https://github.com/pycqa/isort
rev: 5.10.1
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.1
hooks:
- id: autopep8
args:
[
"--in-place",
"--aggressive",
"--aggressive",
"--recursive",
"--max-line-length=100",
"--ignore=E501,E402,W503,W504,E731"
]
- repo: https://github.com/PyCQA/autoflake
rev: v2.0.0
hooks:
- id: autoflake
args:
[
"--in-place",
"--recursive",
"--remove-all-unused-imports",
"--remove-unused-variable",
"--ignore-init-module-imports"
]
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
args: ["--ignore=E501,E402,W503,W504,E731,F401"]
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
name: isort (python)
args: ["-m=VERTICAL_HANGING_INDENT"] # vertical hanging
- repo: local
hooks:
- id: modelica-fmt
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Change Log
==========

Version 0.4.1
-------------
## What's Changed
* Cli bugfixing
* Detailed models
* End-of-year updates to GMT docs
* Remove support for 3.7 in development, update development dependencies
* Update copyrights to 2023

Version 0.4.0
-------------
As of version 0.4.0 changes will be published using Github automated formatting at the release itself. Those changes are copied here.
2 changes: 1 addition & 1 deletion LICENSE → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
URBANopt, Copyright (c) 2019-2022, Alliance for Sustainable Energy, LLC, and other contributors.
URBANopt, Copyright (c) 2019, 2023 Alliance for Sustainable Energy, LLC, and other contributors.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include LICENSE
include LICENSE.md
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -2,4 +2,4 @@ init:
pip install -r requirements.txt

test:
py.test
pytest
5 changes: 3 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -29,9 +29,10 @@
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosectionlabel',
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.napoleon',
'sphinx.ext.autosummary',
'sphinx-jsonschema',
]

@@ -51,7 +52,7 @@

# General information about the project.
project = u"GeoJSON Modelica Translator"
copyright = u"2019-2022, Alliance for Sustainable Energy, LLC"
copyright = u"2019,2023 - Alliance for Sustainable Energy, LLC"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
25 changes: 13 additions & 12 deletions docs/developer_resources.rst
Original file line number Diff line number Diff line change
@@ -54,15 +54,24 @@ Getting Started as a Developer
------------------------------

There are a few steps that are imperative to complete when starting as a developer of the GMT. First, make sure
to follow the detailed instructions for setting up MBL and Docker in the `getting started <getting_started>`_ guide.
to follow the detailed instructions for :ref:`Docker Installation` in the Getting Started guide.

Follow the instructions below in order to configure your local environment:

* Clone this repo into a working directory
* If you need a custom Modelica Buildings Library:
* Clone the `MBL <https://github.com/lbl-srg/modelica-buildings>`_ into a working directory outside of the GMT directory
* Ensure your MODELICAPATH env var is set to the MBL you want to use! See the documentation at :ref:`MBL Installation`
* Change to the directory inside the modelica-buildings repo you just checked out. (:code:`cd modelica-buildings`)
* Install git-lfs
* Mac: :code:`brew install git-lfs; git lfs install`
* Ubuntu: :code:`sudo apt install git-lfs; git lfs install`
* The current GMT code works with the :code:`maint_9.1.x` branch of the MBL. GMT version :code:`0.2.3`, which uses JModelica, requires the :code:`issue2204_gmt_mbl` branch of the MBL.

* Clone `the GMT repo <https://github.com/urbanopt/geojson-modelica-translator>`_ into a working directory
* (optional/as-needed) Add Python 3 to the environment variables
* For developers, dependency management is through `Poetry`_. Installation is accomplished by running :code:`pip install poetry`.
* Return to the GMT root directory and run :code:`poetry install`
* Test if everything is installed correctly by running :code:`poetry run pytest`. This will run all the unit and integration tests.
* Test if everything is installed correctly by running :code:`poetry run pytest -m 'not compilation and not simulation'`. This will run all the unit and integration tests.
* Follow the instructions below to install pre-commit.
* To test pre-commit and building the documentation, you can run :code:`poetry run tox`

@@ -102,14 +111,6 @@ project. A developer can run this command by calling
The developer should run the test suite after updating the schemas to ensure that nothing appears to have broken. Note that the tests do not cover all of the properties and should not be used as proof that everything works with the updated schemas.

Updating Licenses
^^^^^^^^^^^^^^^^^

To apply the copyright/license to all the files, run the following managed task

.. code-block:: bash
poetry run update_licenses

Adding New Models
-----------------
@@ -217,7 +218,7 @@ desired, a user can run the simulations manually using JModelica (via Docker). F
the runner to work locally.

* Make sure jm_ipython.sh is in your local path.
* After running the :code:`py.test`, go into the :code:`geojson_modelica_translator/modelica/lib/runner/` directory.
* After running the :code:`pytest`, go into the :code:`geojson_modelica_translator/modelica/lib/runner/` directory.
* Copy :code:`jmodelica.py` to the :code:`tests/model_connectors/output` directory.
* From the :code:`tests/model_connectors/output` directory, run examples using either of the the following:
* :code:`jm_ipython.sh jmodelica.py spawn_single.Loads.B5a6b99ec37f4de7f94020090.coupling`
9 changes: 2 additions & 7 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
@@ -45,12 +45,7 @@ MBL Installation

The Modelica Buildings Library contains many models that are needed to assemble the district systems. Installation of the MBL is done through Git and GitHub. Follow the instructions below to install the MBL needed for the GMT:

* Clone the `MBL`_ into a working directory outside of the GMT directory
* Change to the directory inside the modelica-buildings repo you just checked out. (:code:`cd modelica-buildings`)
* Install git-lfs
* Mac: :code:`brew install git-lfs; git lfs install`
* Ubuntu: :code:`sudo apt install git-lfs; git lfs install`
* The GMT code works with the :code:`master` branch of the MBL, which is currently version 9.0.0. If the :code:`master` branch has been updated, then use the tag :code:`v9.0.0` to install the MBL.
* Download and extract the newest 9.1 version of the MBL from `<https://simulationresearch.lbl.gov/modelica/downloads/archive/modelica-buildings.html>`_
* Add the Modelica Buildings Library path to your MODELICAPATH environment variable (e.g., export MODELICAPATH=${MODELICAPATH}:$HOME/path/to/modelica-buildings). Restart your terminal to ensure that the MBL library is exported correctly.

Once the MBL is installed, then the CLI can be used to create the model with the following command:
@@ -75,7 +70,7 @@ Docker Installation
-------------------

The preferred method of running the simulations would be within Dymola; however, that is not a
practical solution for many based on the license requirement. The GMT enables the running of the
practical solution for many based on the license requirement. Version 0.2.3 of the GMT enables the running of the
models using JModelica which requires the installation of `Docker`_. To configure Docker, do the
following:

2 changes: 1 addition & 1 deletion docs/license.rst
Original file line number Diff line number Diff line change
@@ -3,4 +3,4 @@
License
=======

.. include:: ../LICENSE
.. include:: ../LICENSE.md
39 changes: 2 additions & 37 deletions geojson_modelica_translator/geojson/schemas.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,5 @@
"""
****************************************************************************************************
:copyright (c) 2019-2022, Alliance for Sustainable Energy, LLC, and other contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
Neither the name of the copyright holder nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior written permission.
Redistribution of this software, without modification, must refer to the software by the same
designation. Redistribution of a modified version of this software (i) may not refer to the
modified version by the same designation, or by any confusingly similar designation, and
(ii) must refer to the underlying software originally provided by Alliance as “URBANopt”. Except
to comply with the foregoing, the term “URBANopt”, or any confusingly similar designation may
not be used to refer to any modified version of this software or any modified version of the
underlying software originally provided by Alliance without the prior written consent of Alliance.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
****************************************************************************************************
"""
# :copyright (c) URBANopt, Alliance for Sustainable Energy, LLC, and other contributors.
# See also https://github.com/urbanopt/geojson-modelica-translator/blob/develop/LICENSE.md

import json
import os
59 changes: 11 additions & 48 deletions geojson_modelica_translator/geojson/urbanopt_geojson.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,5 @@
"""
****************************************************************************************************
:copyright (c) 2019-2022, Alliance for Sustainable Energy, LLC, and other contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the
distribution.
Neither the name of the copyright holder nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior written permission.
Redistribution of this software, without modification, must refer to the software by the same
designation. Redistribution of a modified version of this software (i) may not refer to the
modified version by the same designation, or by any confusingly similar designation, and
(ii) must refer to the underlying software originally provided by Alliance as “URBANopt”. Except
to comply with the foregoing, the term “URBANopt”, or any confusingly similar designation may
not be used to refer to any modified version of this software or any modified version of the
underlying software originally provided by Alliance without the prior written consent of Alliance.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
****************************************************************************************************
"""
# :copyright (c) URBANopt, Alliance for Sustainable Energy, LLC, and other contributors.
# See also https://github.com/urbanopt/geojson-modelica-translator/blob/develop/LICENSE.md

import logging
from pathlib import Path
@@ -94,18 +59,16 @@ def __init__(self, filename, building_ids=None):
self.buildings = []
for feature in self.data.features:
if feature["properties"]["type"] == "Building":
# Don't validate features with 'detailed_model_filename' in the building properties
# Buildings defined by an osm don't have all keys in geojson, they'll always fail validation
if "detailed_model_filename" in feature["properties"]:
continue
else:
building = UrbanOptLoad(feature)
if not building_ids or building.id in building_ids:
building = UrbanOptLoad(feature)
if not building_ids or building.id in building_ids:
# Don't care about validation failures for features with 'detailed_model_filename' in the building properties
# Buildings defined by an osm don't have all keys in geojson, they'll always fail validation
if "detailed_model_filename" not in feature["properties"]:
errors = self.schemas.validate("building", building.feature.properties)
if errors:
building_errors[building.id] = errors
else:
self.buildings.append(building)
if errors:
building_errors[building.id] = errors
else:
self.buildings.append(building)

if building_errors:
formatted_errors = ''
Loading

0 comments on commit bc73908

Please sign in to comment.