Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -134,14 +134,17 @@ 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)

| Format | Status | Description |
|--------|--------|-------------|
| OpenDSS | ✅ Complete | Full DSS file generation |
| JSON/GDM | ✅ Complete | Serialized GDM format |
| CIM/IEC 61968-13 | ✅ Complete | Common Information Model support |

## Supported Components

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/ditto/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__version__ = "0.1.1"
__version__ = "0.1.2"

Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions src/ditto/writers/opendss/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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")

Expand Down
Binary file removed tests/.DS_Store
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/test_opendss/test_roundtrip_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Loading