Skip to content

Commit

Permalink
Merge branch 'develop' into add-measure-base-class
Browse files Browse the repository at this point in the history
  • Loading branch information
nllong committed Jan 5, 2024
2 parents 2b6069e + 3265f5b commit 351f1d5
Show file tree
Hide file tree
Showing 28 changed files with 178 additions and 274 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.11"]
python-version: ["3.9", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
Changelog
=========

Version 0.5.0
=============

## What's Changed
* Support py312 by @vtnate in https://github.com/urbanopt/modelica-builder/pull/73
* Add method to scale loads in an MOS file by @nllong in https://github.com/urbanopt/modelica-builder/pull/74
* Bump version of antlr runtime to 4.13.1 by @nllong in https://github.com/urbanopt/modelica-builder/pull/75
* Add `.mpignore` to skip loading files in ModelicaProject by @nllong in https://github.com/urbanopt/modelica-builder/pull/77
* Upgrade to MBLv10 by @vtnate in https://github.com/urbanopt/modelica-builder/pull/72
* Update copyright dates by @nllong in https://github.com/urbanopt/modelica-builder/pull/80

**Full Changelog**: https://github.com/urbanopt/modelica-builder/compare/v0.4.0...v0.5.0

Version 0.4.0
=============

Expand Down
39 changes: 18 additions & 21 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
Copyright (c) 2020-2023, Alliance for Sustainable Energy, LLC.
Copyright (c) 2020, 2024, Alliance for Sustainable Energy, LLC.
All rights reserved.

BSD 3-Clause License

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
(1) Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.

2. 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.
(2) 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.

3. 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.
(3) 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.

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.
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.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

# General information about the project.
project = u'modelica-builder'
copyright = u'2023, Nicholas Long'
copyright = u'2024, 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
Expand Down
9 changes: 2 additions & 7 deletions modelica_builder/builder.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
"""
****************************************************************************************************
:copyright (c) 2020-2023, Alliance for Sustainable Energy, LLC.
All rights reserved.
****************************************************************************************************
"""

# :copyright (c) URBANopt, Alliance for Sustainable Energy, LLC, and other contributors.
# See also https://github.com/urbanopt/geojson-modelica-translator/blob/develop/LICENSE.md

from modelica_builder import config
from modelica_builder.edit import Edit
Expand Down
8 changes: 2 additions & 6 deletions modelica_builder/config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
"""
****************************************************************************************************
:copyright (c) 2020-2023, Alliance for Sustainable Energy, LLC.
All rights reserved.
****************************************************************************************************
"""
# :copyright (c) URBANopt, Alliance for Sustainable Energy, LLC, and other contributors.
# See also https://github.com/urbanopt/geojson-modelica-translator/blob/develop/LICENSE.md

# global config variables
# If true, then each inserted component/annotation argument will be indented on a new line
Expand Down
9 changes: 2 additions & 7 deletions modelica_builder/edit.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
"""
****************************************************************************************************
:copyright (c) 2020-2023, Alliance for Sustainable Energy, LLC.
All rights reserved.
****************************************************************************************************
"""

# :copyright (c) URBANopt, Alliance for Sustainable Energy, LLC, and other contributors.
# See also https://github.com/urbanopt/geojson-modelica-translator/blob/develop/LICENSE.md

from modelica_builder import modelica_parser

Expand Down
8 changes: 2 additions & 6 deletions modelica_builder/model.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
"""
****************************************************************************************************
:copyright (c) 2020-2023, Alliance for Sustainable Energy, LLC.
All rights reserved.
****************************************************************************************************
"""
# :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
import os
Expand Down
9 changes: 3 additions & 6 deletions modelica_builder/modelica_parser/utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
"""
****************************************************************************************************
:copyright (c) 2020-2023, Alliance for Sustainable Energy, LLC.
All rights reserved.
****************************************************************************************************
"""
# :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 sys

Expand Down
9 changes: 3 additions & 6 deletions modelica_builder/modelica_project.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
"""
****************************************************************************************************
:copyright (c) 2020-2023, Alliance for Sustainable Energy, LLC.
All rights reserved.
****************************************************************************************************
"""
# :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
import os
import pathspec
Expand Down
18 changes: 13 additions & 5 deletions modelica_builder/package_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,34 @@ def parse_within_statement(self) -> Optional[List[str]]:
return self.within

@classmethod
def new_from_template(cls, path: Union[str, Path], name: str, order: list[str], within: Union[str, None] = None) -> "PackageParser":
"""Create new package data based on the package.mo template. If within is not specified, then it is
def new_from_template(cls,
path: Union[str, Path],
name: str,
order: list[str],
mbl_version: Union[str, None] = None,
within: Union[str, None] = None
) -> "PackageParser":
"""Create new package data based on the package.mo template. If 'within' is not specified, then it is
assumed that this is a top level package and will load from the package_base template.
Args:
path (str): the path where the resulting package file and order will be saved to.
name (str): the name of the model
order (list[str]): ordered list of which models will be loaded (saved to package.order)
within (str, optional): name where this package is within.. Defaults to None.
mbl_version (str, optional): the version of the model buildings library (only used in package_base.mot)
within (str, optional): name where this package is within. Defaults to None.
Returns:
PackageParser: object of the package parser
"""
klass = PackageParser(path)
if within:
if not mbl_version:
template = klass.template_env.get_template("package.mot")
else:
template = klass.template_env.get_template("package_base.mot")

klass.package_data = template.render(within=within, name=name, order=order)
klass.package_data = template.render(within=within, name=name, order=order, mbl_version=mbl_version)
klass.order_data = "\n".join(order)
klass.package_name = name
klass.parse_within_statement()
Expand Down
8 changes: 2 additions & 6 deletions modelica_builder/selector.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
"""
****************************************************************************************************
:copyright (c) 2020-2023, Alliance for Sustainable Energy, LLC.
All rights reserved.
****************************************************************************************************
"""
# :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 re
Expand Down
2 changes: 1 addition & 1 deletion modelica_builder/templates/package_base.mot
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package {{name}}
extends Modelica.Icons.Package;

annotation (uses(
Modelica(version="4.0.0"), Buildings(version="9.1.0")), version="1");
Modelica(version="4.0.0"), Buildings(version="{{mbl_version}}")), version="1");
end {{name}};
9 changes: 2 additions & 7 deletions modelica_builder/transformation.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
"""
****************************************************************************************************
:copyright (c) 2020-2023, Alliance for Sustainable Energy, LLC.
All rights reserved.
****************************************************************************************************
"""

# :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 antlr4.xpath import XPath
Expand Down
8 changes: 2 additions & 6 deletions modelica_builder/transformer.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
"""
****************************************************************************************************
:copyright (c) 2020-2023, Alliance for Sustainable Energy, LLC.
All rights reserved.
****************************************************************************************************
"""
# :copyright (c) URBANopt, Alliance for Sustainable Energy, LLC, and other contributors.
# See also https://github.com/urbanopt/geojson-modelica-translator/blob/develop/LICENSE.md


from modelica_builder.edit import Edit
Expand Down
Loading

0 comments on commit 351f1d5

Please sign in to comment.