diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ed13423 --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +BSD-3-Clause License + +Copyright (c) 2018, Alliance for Sustainable Energy LLC, 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. + +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. \ No newline at end of file diff --git a/README.md b/README.md index d625d84..f920f7a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![PyPI version](https://badge.fury.io/py/NREL-ditto.svg)](https://pypi.org/project/NREL-ditto/) [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/) -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![License: BSD-3-Clause](https://img.shields.io/badge/License-BSD--3--Clause-yellow.svg)](https://opensource.org/license/bsd-3-clause/) [![codecov](https://codecov.io/gh/NLR-Distribution-Suite/ditto/graph/badge.svg?token=1TSI2L9HNR)](https://codecov.io/gh/NLR-Distribution-Suite/ditto) • [![Documentation](https://github.com/NLR-Distribution-Suite/ditto/actions/workflows/gh-pages.yml/badge.svg?branch=main)](https://github.com/NLR-Distribution-Suite/ditto/actions/workflows/gh-pages.yml) . [![pages-build-deployment](https://github.com/NLR-Distribution-Suite/ditto/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/NLR-Distribution-Suite/ditto/actions/workflows/pages/pages-build-deployment) . [![Pytest](https://github.com/NLR-Distribution-Suite/ditto/actions/workflows/pull_request_tests.yml/badge.svg)](https://github.com/NLR-Distribution-Suite/ditto/actions/workflows/pull_request_tests.yml) . [![Upload to PyPi](https://github.com/NLR-Distribution-Suite/ditto/actions/workflows/publish_to_pypi.yaml/badge.svg)](https://github.com/NLR-Distribution-Suite/ditto/actions/workflows/publish_to_pypi.yaml) • [![CodeFactor](https://www.codefactor.io/repository/github/nlr-distribution-suite/ditto/badge)](https://www.codefactor.io/repository/github/nlr-distribution-suite/ditto) • ![MCP Server](https://img.shields.io/badge/MCP_Server-enabled-brightgreen) • ![MCP Tools](https://img.shields.io/badge/MCP_Tools-12-blue) • [![PyPI Downloads](https://static.pepy.tech/personalized-badge/nrel-ditto?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/nrel-ditto) # DiTTo @@ -134,7 +134,9 @@ system = DistributionSystem.from_json(Path("IEEE13NODE.json")) |--------|--------|-------------| | OpenDSS | ✅ Complete | Full support for OpenDSS models | | CIM/IEC 61968-13 | ✅ Complete | Common Information Model support | -| CYME | 🚧 In Progress | CYME network models | +| CYME | ✅ Complete | CYME network models | +| Synergi | 🚧 In Progress | Synergi network models | + ### Writers (Output) @@ -142,6 +144,7 @@ system = DistributionSystem.from_json(Path("IEEE13NODE.json")) |--------|--------|-------------| | OpenDSS | ✅ Complete | Full DSS file generation | | JSON/GDM | ✅ Complete | Serialized GDM format | +| CIM/IEC 61968-13 | ✅ Complete | Common Information Model support | ## Supported Components diff --git a/pyproject.toml b/pyproject.toml index f8d1815..9f27de7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ classifiers = [ ] dependencies = [ "opendssdirect.py", - "grid-data-models==2.3.3", + "grid-data-models==2.3.4", "rdflib", "NREL-altdss-schema==0.0.3", "typer", diff --git a/src/ditto/__init__.py b/src/ditto/__init__.py index 485f44a..d49ba1b 100644 --- a/src/ditto/__init__.py +++ b/src/ditto/__init__.py @@ -1 +1,2 @@ -__version__ = "0.1.1" +__version__ = "0.1.2" + diff --git a/src/ditto/writers/opendss/controllers/distribution_regulator_controller.py b/src/ditto/writers/opendss/controllers/distribution_regulator_controller.py index b88365c..98043e8 100644 --- a/src/ditto/writers/opendss/controllers/distribution_regulator_controller.py +++ b/src/ditto/writers/opendss/controllers/distribution_regulator_controller.py @@ -16,6 +16,10 @@ def __init__(self, model: RegulatorController, xfmr_name: str, system: Distribut self.model: RegulatorController = model self.xfmr_name = xfmr_name + def map_tapped_winding(self): + # self.system.get_component(component=, name=self.xfmr_name) + self.opendss_dict["Winding"] = self.model.tapped_winding + def map_name(self): self.opendss_dict["Name"] = self.get_opendss_safe_name(self.model.name) self.opendss_dict["Transformer"] = self.get_opendss_safe_name(self.xfmr_name) diff --git a/src/ditto/writers/opendss/write.py b/src/ditto/writers/opendss/write.py index 1cc032b..e7bf75c 100644 --- a/src/ditto/writers/opendss/write.py +++ b/src/ditto/writers/opendss/write.py @@ -85,10 +85,9 @@ def _should_expand_two_phase_transformer(self, model_map: Any) -> bool: if model_map.altdss_composition_name != "Transformer": return False - phases = model_map.opendss_dict.get("Phases") buses = model_map.opendss_dict.get("Bus", []) - if phases != 2 or not buses: - return False + # if phases != 2 or not buses: + # return False phase_tokens = self._get_bus_phase_tokens(buses[0]) phase_tokens = [token for token in phase_tokens if token != "0"] @@ -302,6 +301,7 @@ def write( # noqa controller_map.populate_opendss_dictionary() controller_dss_string = self._get_dss_string(controller_map) controller_outputs.append((controller_map, controller_dss_string)) + break output_folder = output_path output_folder, output_redirect = self._build_directory_structure( @@ -340,6 +340,7 @@ def write( # noqa for model_map_to_write in model_maps_to_write: dss_string = self._get_dss_string(model_map_to_write) + if dss_string.startswith("new Vsource"): dss_string = dss_string.replace("new Vsource", "Clear\n\nNew Circuit") diff --git a/tests/.DS_Store b/tests/.DS_Store deleted file mode 100644 index 07b092c..0000000 Binary files a/tests/.DS_Store and /dev/null differ diff --git a/tests/data/cim_iec_61968_13/IEEE13Nodeckt_CIM100x.XML.zip b/tests/data/cim_iec_61968_13/IEEE13Nodeckt_CIM100x.XML.zip new file mode 100644 index 0000000..a3e7f81 Binary files /dev/null and b/tests/data/cim_iec_61968_13/IEEE13Nodeckt_CIM100x.XML.zip differ diff --git a/tests/test_opendss/test_roundtrip_conversion.py b/tests/test_opendss/test_roundtrip_conversion.py index de55435..68911a0 100644 --- a/tests/test_opendss/test_roundtrip_conversion.py +++ b/tests/test_opendss/test_roundtrip_conversion.py @@ -34,4 +34,4 @@ def test_opendss_roundtrip_converion(DSS_MODEL, tmp_path): post_converion_metrics = get_metrics(dss_master_file) assert np.allclose( pre_converion_metrics, post_converion_metrics, rtol=0.01, atol=0.01 - ), "Round trip coversion exceeds error tolerance" + ), f"Round trip coversion exceeds error tolerance, \npre: {pre_converion_metrics}, \npost: {post_converion_metrics}"