From 990b5dea1b9b2be161c326f81ea50f9c43fa75db Mon Sep 17 00:00:00 2001 From: Latif Date: Fri, 22 Mar 2024 16:37:19 -0600 Subject: [PATCH 1/7] minor edit --- src/pydss/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pydss/__init__.py b/src/pydss/__init__.py index f2da49af..8d50e756 100644 --- a/src/pydss/__init__.py +++ b/src/pydss/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.0.1" +__version__ = "3.1.2" from pydss.utils.timing_utils import timer_stats_collector from . import * From ae25e10cf68b12b8846e0de0f220b9d5f267ec36 Mon Sep 17 00:00:00 2001 From: Latif Date: Fri, 22 Mar 2024 16:48:37 -0600 Subject: [PATCH 2/7] done --- src/pydss/pyPlotReader.py | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 src/pydss/pyPlotReader.py diff --git a/src/pydss/pyPlotReader.py b/src/pydss/pyPlotReader.py deleted file mode 100644 index f57c4d6f..00000000 --- a/src/pydss/pyPlotReader.py +++ /dev/null @@ -1,34 +0,0 @@ -import os -import pandas as pd - -from pydss.config_data import convert_config_data_to_toml -from pydss.utils.utils import load_data -from pydss.exceptions import InvalidParameter - -class pyPlotReader: - def __init__(self, Path): - self.pyPlots = {} - filenames = os.listdir(Path) - found_config_file = False - found_excel_file = False - for filename in filenames: - pyPlotType, ext = os.path.splitext(filename) - if filename.startswith('~$'): - continue - elif ext == '.xlsx': - filename = convert_config_data_to_toml(filename) - elif ext != ".toml": - continue - if pyPlotType not in self.pyPlots: - self.pyPlots[pyPlotType] = {} - filepath = os.path.join(Path, filename) - assert (os.path.exists(filepath)), 'path: "{}" does not exist!'.format(filepath) - - assert (os.path.exists(filepath)), 'path: "{}" does not exist!'.format(filepath) - for name, plot in load_data(filepath).items(): - if name in self.pyPlots[pyPlotType]: - raise InvalidParameter( - f"Multiple pydss dynamic plot definitions of the same type with the same name not allowed: " - f"{name} already exists for plot type {pyPlotType}" - ) - self.pyPlots[pyPlotType][name] = plot From 37b62a3ea77bb9baefb15fa169902a56e4328467 Mon Sep 17 00:00:00 2001 From: Latif Date: Mon, 25 Mar 2024 10:08:53 -0600 Subject: [PATCH 3/7] dependency cleanup --- pyproject.toml | 8 ++++---- src/pydss/cli/pydss.py | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index aab09bde..492658d8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,14 +23,10 @@ classifiers = [ "Programming Language :: Python :: 3", ] dependencies = [ - "aiohttp_swagger3>=0.4.3", - "aiohttp", - "bokeh", "click", "h5py", "helics", "loguru", - "matplotlib", "networkx", "numpy", "OpenDSSDirect.py==0.8.4", @@ -56,6 +52,10 @@ dev = [ "sphinx", "sphinx-rtd-theme", ] +server = [ + "aiohttp_swagger3>=0.4.3", + "aiohttp", +] [project.scripts] pydss = "pydss.cli.pydss:cli" diff --git a/src/pydss/cli/pydss.py b/src/pydss/cli/pydss.py index feb791d3..4a4e8f25 100644 --- a/src/pydss/cli/pydss.py +++ b/src/pydss/cli/pydss.py @@ -1,5 +1,6 @@ """Main CLI command for pydss.""" +from loguru import logger import click from pydss.cli.create_project import create_project @@ -10,10 +11,20 @@ from pydss.cli.extract import extract, extract_element_files from pydss.cli.run import run from pydss.cli.edit_scenario import edit_scenario -from pydss.cli.run_server import serve + from pydss.cli.reports import reports from pydss.cli.add_scenario import add_scenario +server_dependencies_installed = True + +try: + from pydss.cli.run_server import serve +except ImportError: + server_dependencies_installed = False + logger.warning( + "Server dependencies not installed. Use 'pip install NREL-pydss[server]' to install additional dependencies" + ) + @click.group() def cli(): """PyDSS commands""" @@ -28,5 +39,6 @@ def cli(): cli.add_command(edit_scenario) cli.add_command(convert) cli.add_command(controllers) -cli.add_command(serve) -cli.add_command(reports) \ No newline at end of file +cli.add_command(reports) +if server_dependencies_installed: + cli.add_command(serve) \ No newline at end of file From 9d7cf2ebfa817316e895d0d905d524041b698ca5 Mon Sep 17 00:00:00 2001 From: Latif Date: Mon, 25 Mar 2024 13:34:48 -0600 Subject: [PATCH 4/7] minor workflow bug fix --- .github/workflows/pull_request_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request_tests.yml b/.github/workflows/pull_request_tests.yml index beb5db91..7a02b206 100644 --- a/.github/workflows/pull_request_tests.yml +++ b/.github/workflows/pull_request_tests.yml @@ -20,7 +20,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install '.[dev]' + python -m pip install -e '.[dev]' - name: Run pytests run: | python -m pytest -v --disable-warnings From e4838a184a560684fafff54a9b79b07ce6cb60f7 Mon Sep 17 00:00:00 2001 From: Latif Date: Mon, 25 Mar 2024 13:48:46 -0600 Subject: [PATCH 5/7] code cleanup --- docs/source/Respository documentaion.rst | 2 +- .../_autosummary/PyDSS.api.src.app.pydss.rst | 12 +----- docs/source/_autosummary/PyDSS.rst | 4 +- docs/source/co-simulation_support.rst | 2 +- docs/source/conf.py | 7 ---- docs/source/hdf-data-format.rst | 2 +- docs/source/index.rst | 2 +- docs/source/interfaces.rst | 2 +- docs/source/project_layout.rst | 2 +- docs/source/quickstart.rst | 4 +- docs/source/reports.rst | 2 +- docs/source/spec/swagger.yml | 12 +++--- docs/source/tutorial.rst | 6 +-- examples/custom_contols/ProfileManager.toml | 6 +-- .../Python_example/run_pyDSS.py | 2 +- src/pydss/api/schema/PyDSS.v1.json | 42 +++++++++---------- src/pydss/api/server.py | 2 +- src/pydss/api/src/app/pydss.py | 10 ++--- src/pydss/api/src/web/handler.py | 22 +++++----- src/pydss/apps/data_viewer.py | 2 +- src/pydss/cli/pydss.py | 2 +- src/pydss/cli/reports.py | 4 +- src/pydss/dssInstance.py | 2 +- src/pydss/exceptions.py | 2 +- src/pydss/modes/Dynamic.py | 2 +- src/pydss/naerm.py | 4 +- src/pydss/pyControllers/pyController.py | 2 +- .../pyPostprocessor/pyPostprocessAbstract.py | 4 +- src/pydss/registry.py | 2 +- src/pydss/simulation_input_models.py | 4 +- 30 files changed, 78 insertions(+), 95 deletions(-) diff --git a/docs/source/Respository documentaion.rst b/docs/source/Respository documentaion.rst index 8cf61bfe..d5a2850b 100644 --- a/docs/source/Respository documentaion.rst +++ b/docs/source/Respository documentaion.rst @@ -6,5 +6,5 @@ Python API interface :toctree: _autosummary :recursive: - PyDSS + pydss diff --git a/docs/source/_autosummary/PyDSS.api.src.app.pydss.rst b/docs/source/_autosummary/PyDSS.api.src.app.pydss.rst index 5bac05d5..37e8a935 100644 --- a/docs/source/_autosummary/PyDSS.api.src.app.pydss.rst +++ b/docs/source/_autosummary/PyDSS.api.src.app.pydss.rst @@ -3,21 +3,11 @@ pydss.api.src.app.pydss .. automodule:: pydss.api.src.app.pydss - - - - - - - - - - .. rubric:: Classes .. autosummary:: - PyDSS + pydss diff --git a/docs/source/_autosummary/PyDSS.rst b/docs/source/_autosummary/PyDSS.rst index 75c3c7e5..d43b2c45 100644 --- a/docs/source/_autosummary/PyDSS.rst +++ b/docs/source/_autosummary/PyDSS.rst @@ -1,7 +1,7 @@ -PyDSS +Pydss ===== -.. automodule:: PyDSS +.. automodule:: pydss diff --git a/docs/source/co-simulation_support.rst b/docs/source/co-simulation_support.rst index 675a35af..01bcb91c 100644 --- a/docs/source/co-simulation_support.rst +++ b/docs/source/co-simulation_support.rst @@ -1,7 +1,7 @@ Co-simulation interfaces ========================= -PyDSS provides two pathways for configuring pydss for a co-simulation with external simulators. +Pydss provides two pathways for configuring pydss for a co-simulation with external simulators. These interface help researchers cut lead time in setting up and configuring co-simulation setups to simulate cyber phsical interactions by coupling multiple domain scepific tools. Each interface has certain pros and cons detailed in the documentation pages. diff --git a/docs/source/conf.py b/docs/source/conf.py index 29248040..2fe31fcf 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -16,15 +16,8 @@ import re # import sys -# my_path = os.path.abspath('../PyDSS') -# print(f"{my_path=}") -# sys.path.insert(0, os.path.abspath('../PyDSS')) import sphinx_rtd_theme -# import pydss -# import pydss -# import pydss.simulation_input_models -#from pydss.simulation_input_models import SimulationSettingsModel, ProjectModel # -- Project information ----------------------------------------------------- diff --git a/docs/source/hdf-data-format.rst b/docs/source/hdf-data-format.rst index 6a94eb8a..92dcccfb 100755 --- a/docs/source/hdf-data-format.rst +++ b/docs/source/hdf-data-format.rst @@ -1,7 +1,7 @@ ############### HDF Data Format ############### -This page describes the format pydss uses to export data in an HDF file. PyDSS +This page describes the format pydss uses to export data in an HDF file. Pydss contains code to convert the raw data to pandas.DataFrame objects or Python dictionaries, so normal users should not need to write their own tools to interpret the data. diff --git a/docs/source/index.rst b/docs/source/index.rst index 3da794d0..a1501ff6 100755 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -7,7 +7,7 @@ :align: center ##### -PyDSS +Pydss ##### *********** diff --git a/docs/source/interfaces.rst b/docs/source/interfaces.rst index 0389ce1e..dcdd7ec0 100644 --- a/docs/source/interfaces.rst +++ b/docs/source/interfaces.rst @@ -1,7 +1,7 @@ Interfaces ========================= -PyDSS provides three easy to configure external interfaces. These interface help researchers cut lead time in setting up and configuring co-simulation setups to simulate cyber phsical interactions by coupling multiple domain scpific tools. The 'External_interfacing_example' project in the examples folder provides examples on how to set up and use each of these interfaces. +Pydss provides three easy to configure external interfaces. These interface help researchers cut lead time in setting up and configuring co-simulation setups to simulate cyber phsical interactions by coupling multiple domain scpific tools. The 'External_interfacing_example' project in the examples folder provides examples on how to set up and use each of these interfaces. .. toctree:: :maxdepth: 3 diff --git a/docs/source/project_layout.rst b/docs/source/project_layout.rst index d73ce5e6..f84a9f15 100644 --- a/docs/source/project_layout.rst +++ b/docs/source/project_layout.rst @@ -1,7 +1,7 @@ .. _pydss_project_layout: ******************** -PyDSS Project Layout +Pydss Project Layout ******************** A pydss project is made up of one or more scenarios that run simulations on a shared OpenDSS model. The purpose of scenarios is to allow users to customize inputs, outputs, or controls. diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst index a4ba9029..932e584a 100644 --- a/docs/source/quickstart.rst +++ b/docs/source/quickstart.rst @@ -5,14 +5,14 @@ Quick Start Guide ***************** This page provides a short example to get pydss up and running. If you have not already installed -PyDSS, please follow the instructions at :ref:`installation_label`. +pydss, please follow the instructions at :ref:`installation_label`. The basic steps are to create an empty project, copy your OpenDSS model files into that project, customize the simuation settings, and then run the simulation. Create an empty project ======================= -PyDSS requires a specific directory structure with configuration files that specify how to run a +Pydss requires a specific directory structure with configuration files that specify how to run a simulation. Run this command to create an empty project. .. code-block:: bash diff --git a/docs/source/reports.rst b/docs/source/reports.rst index 5ed2b746..92c16bc2 100755 --- a/docs/source/reports.rst +++ b/docs/source/reports.rst @@ -69,7 +69,7 @@ This can be useful for debugging purposes when you develop your own reports. *********** Output Data *********** -PyDSS stores generated reports in ``/Reports``. +Pydss stores generated reports in ``/Reports``. ****************** Adding New Reports diff --git a/docs/source/spec/swagger.yml b/docs/source/spec/swagger.yml index c358c743..b7d04442 100644 --- a/docs/source/spec/swagger.yml +++ b/docs/source/spec/swagger.yml @@ -160,7 +160,7 @@ paths: required: true schema: type: string - example: C:/Users/alatif/Desktop/PyDSS_2.0/pydss/examples + example: C:/Users/alatif/Desktop/pydss_2.0/pydss/examples style: form explode: true responses: @@ -205,7 +205,7 @@ paths: required: true schema: type: string - example: C:/Users/alatif/Desktop/PyDSS_2.0/pydss/examples + example: C:/Users/alatif/Desktop/pydss_2.0/pydss/examples style: form explode: true responses: @@ -241,7 +241,7 @@ paths: UUID: None "/simulators/pydss": put: - summary: Run a command on an active instance of PyDSS + summary: Run a command on an active instance of pydss tags: - Simulation requestBody: @@ -330,7 +330,7 @@ paths: Error tolerance: 0.001 Control mode: Static Simulation Type: QSTS - Project Path: C:/Users/alatif/Desktop/PyDSS_2.0/pydss/examples + Project Path: C:/Users/alatif/Desktop/pydss_2.0/pydss/examples Active Project: custom_contols Active Scenario: base_case DSS File: Master_Spohn_existing_VV.dss @@ -338,7 +338,7 @@ paths: Log Results: false Export Data Tables: true Export Data In Memory: true - Federate name: PyDSS_x + Federate name: pydss_x required: false responses: '200': @@ -366,7 +366,7 @@ paths: Message: Failed to create a pydss instance UUID: None delete: - summary: Deletes an active instance of PyDSS + summary: Deletes an active instance of pydss tags: - Simulation parameters: diff --git a/docs/source/tutorial.rst b/docs/source/tutorial.rst index 0e5b7063..459ab83a 100755 --- a/docs/source/tutorial.rst +++ b/docs/source/tutorial.rst @@ -3,12 +3,12 @@ ******** Tutorial ******** -This page describes how to run simulations with pydss. If you have not already installed PyDSS, +This page describes how to run simulations with pydss. If you have not already installed pydss, please follow the instructions at :ref:`installation_label`. Create a project ================ -PyDSS requires a specific directory structure with configuration files that specify how to run a +Pydss requires a specific directory structure with configuration files that specify how to run a simulation. Run this command to create an empty project. .. code-block:: bash @@ -120,7 +120,7 @@ column represents. This can vary by element. Data Viewer ----------- -PyDSS includes a simple Jupyter notebook UI that allows you to plot element results. +Pydss includes a simple Jupyter notebook UI that allows you to plot element results. Here's how to start it. Note that you must be in the directory where you ran ``pydss run `` when you start the notebook. diff --git a/examples/custom_contols/ProfileManager.toml b/examples/custom_contols/ProfileManager.toml index bf29fd54..cc1dced3 100644 --- a/examples/custom_contols/ProfileManager.toml +++ b/examples/custom_contols/ProfileManager.toml @@ -11,7 +11,7 @@ "Control mode" = "Static" "Disable pydss controllers" = false "Simulation Type" = "QSTS" -"Project Path" = "C:\\Users\\alatif\\Desktop\\PyDSS_2.0\\PyDSS_src\\examples" +"Project Path" = "C:\\Users\\alatif\\Desktop\\pydss_2.0\\pydss_src\\examples" "Active Project" = "custom_contols" "Active Scenario" = "" "DSS File" = "Master_Spohn_existing_VV.dss" @@ -78,6 +78,6 @@ Uninterruptible = true [Profiles] "Use profile manager" = false -"Profile store path" = "C:\\Users\\alatif\\Desktop\\PyDSS_2.0\\PyDSS_src\\examples\\custom_contols\\Profiles\\profiles.hdf5" -"Profile mapping" = "C:\\Users\\alatif\\Desktop\\PyDSS_2.0\\PyDSS_src\\examples\\custom_contols\\Profiles\\mapping.toml" +"Profile store path" = "C:\\Users\\alatif\\Desktop\\pydss_2.0\\pydss_src\\examples\\custom_contols\\Profiles\\profiles.hdf5" +"Profile mapping" = "C:\\Users\\alatif\\Desktop\\pydss_2.0\\pydss_src\\examples\\custom_contols\\Profiles\\mapping.toml" diff --git a/examples/external_interfaces/Python_example/run_pyDSS.py b/examples/external_interfaces/Python_example/run_pyDSS.py index 5944dcae..161474ac 100644 --- a/examples/external_interfaces/Python_example/run_pyDSS.py +++ b/examples/external_interfaces/Python_example/run_pyDSS.py @@ -12,7 +12,7 @@ default=r'simulation.toml') def run_pyDSS(pydss_path, sim_path, sim_file): sys.path.append(pydss_path) - sys.path.append(os.path.join(pydss_path, 'PyDSS')) + sys.path.append(os.path.join(pydss_path, 'pydss')) file1 = open(os.path.join(sim_path, sim_file),"r") text = file1.read() sim_args = toml.loads(text) diff --git a/src/pydss/api/schema/PyDSS.v1.json b/src/pydss/api/schema/PyDSS.v1.json index 6753ca98..319f7253 100644 --- a/src/pydss/api/schema/PyDSS.v1.json +++ b/src/pydss/api/schema/PyDSS.v1.json @@ -1,7 +1,7 @@ { "info": { "description": "The API enables creating pydss instances, running simulations and creation of new projects.", - "title": "PyDSS RESTful API documentation", + "title": "Pydss RESTful API documentation", "version": "2.0.0" }, "openapi": "3.0.0", @@ -62,7 +62,7 @@ "description": "Provided path does not exist" } }, - "summary": "Deletes an active instance of PyDSS", + "summary": "Deletes an active instance of pydss", "tags": [ "Simulation" ] @@ -86,10 +86,10 @@ "Error tolerance": 0.001, "Export Data In Memory": true, "Export Data Tables": true, - "Federate name": "PyDSS_x", + "Federate name": "Pydss_x", "Log Results": false, "Max Control Iterations": 50, - "Project Path": "C:/Users/alatif/Desktop/PyDSS_2.0/pydss/examples", + "Project Path": "C:/Users/alatif/Desktop/Pydss_2.0/pydss/examples", "Simulation Type": "QSTS", "Start Day": 1, "Start Time (min)": 0, @@ -249,7 +249,7 @@ "description": "Provided path does not exist" } }, - "summary": "Run a command on an active instance of PyDSS", + "summary": "Run a command on an active instance of pydss", "tags": [ "Simulation" ] @@ -299,7 +299,7 @@ "examples": { "get_instance_status": { "value": { - "Message": "PyDSS project created", + "Message": "Pydss project created", "Status": 200, "UUID": "None" } @@ -334,7 +334,7 @@ }, "summary": "Creates a new project for pydss (User uploads a zipped OpenDSS model)", "tags": [ - "PyDSS project" + "Pydss project" ] } }, @@ -347,7 +347,7 @@ "name": "path", "required": true, "schema": { - "example": "C:/Users/alatif/Desktop/PyDSS_2.0/pydss/examples", + "example": "C:/Users/alatif/Desktop/pydss_2.0/pydss/examples", "type": "string" }, "style": "form" @@ -369,7 +369,7 @@ "Scenario1": null } }, - "Message": "PyDSS instance with the provided UUID is currently running", + "Message": "Pydss instance with the provided UUID is currently running", "Status": 200, "UUID": "96c21e00-cd3c-4943-a914-14451f5f7ab6" } @@ -404,7 +404,7 @@ }, "summary": "Returns a dictionary of valid project and scenarios in the provided path", "tags": [ - "PyDSS project" + "Pydss project" ] }, "head": { @@ -415,7 +415,7 @@ "name": "path", "required": true, "schema": { - "example": "C:/Users/alatif/Desktop/PyDSS_2.0/pydss/examples", + "example": "C:/Users/alatif/Desktop/pydss_2.0/pydss/examples", "type": "string" }, "style": "form" @@ -437,7 +437,7 @@ "Scenario1": null } }, - "Message": "PyDSS instance with the provided UUID is currently running", + "Message": "Pydss instance with the provided UUID is currently running", "Status": 200, "UUID": "96c21e00-cd3c-4943-a914-14451f5f7ab6" } @@ -472,7 +472,7 @@ }, "summary": "Returns a dictionary of valid project and scenarios in the provided path", "tags": [ - "PyDSS project" + "Pydss project" ] } }, @@ -599,7 +599,7 @@ "examples": { "get_instance_status": { "value": { - "Message": "PyDSS instance with the provided UUID is currently running", + "Message": "Pydss instance with the provided UUID is currently running", "Status": 200, "UUID": "96c21e00-cd3c-4943-a914-14451f5f7ab6" } @@ -610,7 +610,7 @@ } } }, - "description": "PyDSS instance with the provided UUID is currently running" + "description": "Pydss instance with the provided UUID is currently running" }, "204": { "content": { @@ -618,7 +618,7 @@ "examples": { "get_instance_status": { "value": { - "Message": "PyDSS instance with the provided UUID does not exist", + "Message": "Pydss instance with the provided UUID does not exist", "Status": 204, "UUID": "None" } @@ -629,7 +629,7 @@ } } }, - "description": "PyDSS instance with the provided UUID does not exist" + "description": "Pydss instance with the provided UUID does not exist" } }, "summary": "Returns states of process of with UUID matching the passed UUID", @@ -659,7 +659,7 @@ "examples": { "get_instance_status": { "value": { - "Message": "PyDSS instance with the provided UUID is currently running", + "Message": "Pydss instance with the provided UUID is currently running", "Status": 200, "UUID": "96c21e00-cd3c-4943-a914-14451f5f7ab6" } @@ -670,7 +670,7 @@ } } }, - "description": "PyDSS instance with the provided UUID is currently running" + "description": "Pydss instance with the provided UUID is currently running" }, "204": { "content": { @@ -678,7 +678,7 @@ "examples": { "get_instance_status": { "value": { - "Message": "PyDSS instance with the provided UUID does not exist", + "Message": "Pydss instance with the provided UUID does not exist", "Status": 204, "UUID": "None" } @@ -689,7 +689,7 @@ } } }, - "description": "PyDSS instance with the provided UUID does not exist" + "description": "Pydss instance with the provided UUID does not exist" } }, "summary": "Returns states of process of with UUID matching the passed UUID", diff --git a/src/pydss/api/server.py b/src/pydss/api/server.py index 5e46f49a..7e1fca5c 100644 --- a/src/pydss/api/server.py +++ b/src/pydss/api/server.py @@ -49,7 +49,7 @@ def __init__(self, host, port): self.app = web.Application() self.swagger = SwaggerDocs( self.app, - title="PyDSS RESTful API documentation", + title="Pydss RESTful API documentation", version=find_version("__init__.py"), description = "The API enables creating pydss instances, running simulations and creation of new projects.", swagger_ui_settings=SwaggerUiSettings(path="/docs/"), diff --git a/src/pydss/api/src/app/pydss.py b/src/pydss/api/src/app/pydss.py index ce17ee80..1141b1f7 100644 --- a/src/pydss/api/src/app/pydss.py +++ b/src/pydss/api/src/app/pydss.py @@ -21,7 +21,7 @@ def __init__(self, event=None, queue=None, parameters=None): ''' TODO: work on logging.yaml file''' - logging.info("{} - initialized ".format({self.uuid})) + logger.info("{} - initialized ".format({self.uuid})) self.shutdownevent = event self.queue = queue @@ -43,7 +43,7 @@ def __init__(self, event=None, queue=None, parameters=None): result = { "Status": 200, - "Message": "PyDSS {} successfully initialized.".format(self.uuid), + "Message": "Pydss {} successfully initialized.".format(self.uuid), "UUID": self.uuid } @@ -52,7 +52,7 @@ def __init__(self, event=None, queue=None, parameters=None): self.run_process() def run_process(self): - logger.info("PyDSS simulation starting") + logger.info("Pydss simulation starting") while not self.shutdownevent.is_set(): try: task = self.queue.get() @@ -80,11 +80,11 @@ def run_process(self): except (KeyboardInterrupt, SystemExit): break - logger.info(f"PyDSS subprocess {self.uuid} has ended") + logger.info(f"Pydss subprocess {self.uuid} has ended") def close_instance(self): del self.pydss_obj - logger.info(f'PyDSS case {self.uuid} closed.') + logger.info(f'Pydss case {self.uuid} closed.') def run(self, params): if self.initalized: diff --git a/src/pydss/api/src/web/handler.py b/src/pydss/api/src/web/handler.py index 34240c48..15d5df4b 100644 --- a/src/pydss/api/src/web/handler.py +++ b/src/pydss/api/src/web/handler.py @@ -10,7 +10,7 @@ from pydss.pydss_project import PyDssProject, PyDssScenario, ControllerType from pydss.api.src.web.parser import bytestream_decode -from pydss.api.src.app.pydss import pydss +from pydss.api.src.app.pydss import PyDSS class Handler: @@ -42,7 +42,7 @@ async def get_pydss_project_info(self, request, path): required: true schema: type: string - example: C:/Users/alatif/Desktop/PyDSS_2.0/pydss/examples + example: C:/Users/alatif/Desktop/Pydss_2.0/pydss/examples responses: '200': description: Successfully retrieved project information @@ -156,7 +156,7 @@ async def post_pydss_create(self, request): """ from zipfile import ZipFile - examples_path = os.path.join("C:/Users/alatif/Desktop/PyDSS_2.0/pydss/", 'examples') + examples_path = os.path.join("C:/Users/alatif/Desktop/Pydss_2.0/pydss/", 'examples') unzip_path = os.path.join(examples_path, "uploaded_opendss_project") zip_path = os.path.join(examples_path, "uploaded_opendss_project.zip") @@ -202,7 +202,7 @@ async def post_pydss_create(self, request): }) result = {'Status': 200, - 'Message': 'PyDSS project created', + 'Message': 'Pydss project created', 'UUID': None} # name, scenarios, simulation_config = None, options = None, @@ -246,7 +246,7 @@ async def post_pydss(self, request): Error tolerance: 0.001 Control mode: Static Simulation Type: QSTS - Project Path: "C:/Users/alatif/Desktop/PyDSS_2.0/pydss/examples" + Project Path: "C:/Users/alatif/Desktop/Pydss_2.0/pydss/examples" Active Project: custom_contols Active Scenario: base_case DSS File: Master_Spohn_existing_VV.dss @@ -254,7 +254,7 @@ async def post_pydss(self, request): Log Results: false Export Data Tables: true Export Data In Memory: true - Federate name: PyDSS_x + Federate name: Pydss_x responses: '200': description: Successfully retrieved project information @@ -308,7 +308,7 @@ async def put_pydss(self, request): """ Running pydss app"""""" --- - summary: Run a command on an active instance of PyDSS + summary: Run a command on an active instance of Pydss tags: - Simulation @@ -408,7 +408,7 @@ async def put_pydss(self, request): async def delete_pydss(self, request): """ --- - summary: Deletes an active instance of PyDSS + summary: Deletes an active instance of Pydss tags: - Simulation parameters: @@ -566,10 +566,10 @@ async def get_instance_status(self, request, uuid: str): if uuid not in self.pydss_instances: status = "204" - msg = "PyDSS instance with the provided UUID does not exist" + msg = "Pydss instance with the provided UUID does not exist" else: status = "200" - msg = "PyDSS instance with the provided UUID is currently running" + msg = "Pydss instance with the provided UUID is currently running" return web.json_response({ "Status": status, @@ -606,7 +606,7 @@ def _delete_background_task(self, pydss_uuid): return { "Status": "Success", - "Message": "PyDSS instance closed", + "Message": "Pydss instance closed", "UUID": pydss_uuid } diff --git a/src/pydss/apps/data_viewer.py b/src/pydss/apps/data_viewer.py index bd85d211..c02e63a7 100644 --- a/src/pydss/apps/data_viewer.py +++ b/src/pydss/apps/data_viewer.py @@ -61,7 +61,7 @@ def df(self): return self._df def _make_widgets(self): - self._main_label = widgets.HTML("PyDSS Data Viewer") + self._main_label = widgets.HTML("Pydss Data Viewer") text_layout_long = widgets.Layout(width="400px") text_layout_med = widgets.Layout(width="200px") text_layout_short = widgets.Layout(width="100px") diff --git a/src/pydss/cli/pydss.py b/src/pydss/cli/pydss.py index 4a4e8f25..48a5fa6d 100644 --- a/src/pydss/cli/pydss.py +++ b/src/pydss/cli/pydss.py @@ -27,7 +27,7 @@ @click.group() def cli(): - """PyDSS commands""" + """Pydss commands""" cli.add_command(create_project) cli.add_command(add_post_process) diff --git a/src/pydss/cli/reports.py b/src/pydss/cli/reports.py index bd9e1fcb..82ac4275 100644 --- a/src/pydss/cli/reports.py +++ b/src/pydss/cli/reports.py @@ -31,13 +31,13 @@ @click.option( "-s", "--scenario", required=False, - help="PyDSS scenario name.", + help="Pydss scenario name.", ) @click.option( "-r", "--report", required=False, - help="PyDSS report name.", + help="Pydss report name.", ) @click.command() diff --git a/src/pydss/dssInstance.py b/src/pydss/dssInstance.py index 319f1d4a..3a08d6c5 100644 --- a/src/pydss/dssInstance.py +++ b/src/pydss/dssInstance.py @@ -241,7 +241,7 @@ def _get_relavent_object_dict(self, key): def RunStep(self, step, updateObjects=None): # updating parameters before simulation run if self._settings.logging.log_time_step_updates: - logger.info(f'PyDSS datetime - {self._dssSolver.GetDateTime()}') + logger.info(f'Pydss datetime - {self._dssSolver.GetDateTime()}') logger.info(f'OpenDSS time [h] - {self._dssSolver.GetOpenDSSTime()}') if self._settings.profiles.use_profile_manager: self.profileStore.update() diff --git a/src/pydss/exceptions.py b/src/pydss/exceptions.py index 2be49280..a3390c76 100644 --- a/src/pydss/exceptions.py +++ b/src/pydss/exceptions.py @@ -1,4 +1,4 @@ -"""Exceptions used in PyDSS""" +"""Exceptions used in Pydss""" class InvalidConfiguration(Exception): diff --git a/src/pydss/modes/Dynamic.py b/src/pydss/modes/Dynamic.py index 68e100a0..8a4a4e36 100644 --- a/src/pydss/modes/Dynamic.py +++ b/src/pydss/modes/Dynamic.py @@ -57,7 +57,7 @@ def IncStep(self): self._Hour = int(self._dssSolution.DblHour() // 1) self._Second = (self._dssSolution.DblHour() % 1) * 60 * 60 logger.debug('OpenDSS time [h] - ' + str(self._dssSolution.DblHour())) - logger.debug('PyDSS datetime - ' + str(self._Time)) + logger.debug('Pydss datetime - ' + str(self._Time)) return self._dssSolution.Converged() def reSolve(self): diff --git a/src/pydss/naerm.py b/src/pydss/naerm.py index a8d951ea..a727a9dd 100644 --- a/src/pydss/naerm.py +++ b/src/pydss/naerm.py @@ -126,5 +126,5 @@ def naerm_to_pydss(naerm_name): if __name__ == '__main__': - name = 'PyDSS_x/circuit/heco19021/power_real/double' - #print(get_naerm_value([34,45],'PyDSS_x/circuit/heco19021/power_imag/double' )) \ No newline at end of file + name = 'pydss_x/circuit/heco19021/power_real/double' + #print(get_naerm_value([34,45],'pydss_x/circuit/heco19021/power_imag/double' )) \ No newline at end of file diff --git a/src/pydss/pyControllers/pyController.py b/src/pydss/pyControllers/pyController.py index 87e4f800..21d22351 100644 --- a/src/pydss/pyControllers/pyController.py +++ b/src/pydss/pyControllers/pyController.py @@ -16,7 +16,7 @@ def Create(ElmName, ControllerType, Settings, ElmObjectList, dssInstance, dssSolver): assert (ControllerType in ControllerTypes), "Definition for '{}' controller not found. \n " \ - "Please define the controller in ~PyDSS\pyControllers\Controllers".format( + "Please define the controller in ~pydss\pyControllers\Controllers".format( ControllerType ) diff --git a/src/pydss/pyPostprocessor/pyPostprocessAbstract.py b/src/pydss/pyPostprocessor/pyPostprocessAbstract.py index 2034925f..2220573c 100644 --- a/src/pydss/pyPostprocessor/pyPostprocessAbstract.py +++ b/src/pydss/pyPostprocessor/pyPostprocessAbstract.py @@ -17,9 +17,9 @@ class AbstractPostprocess(abc.ABC): :type inputs: dict :param dssInstance: A :class:`pydss.dssElement.dssElement` object that wraps around an OpenDSS 'Fault' element :type dssInstance: dict - :param dssBuses: Dictionary of all :class:`pydss.dssBus.dssBus` objects in PyDSS + :param dssBuses: Dictionary of all :class:`pydss.dssBus.dssBus` objects in pydss :type dssBuses: dict of :class:`pydss.dssBus.dssBus` objects - :param dssObjects: Dictionary of all :class:`pydss.dssElement.dssElement` objects in PyDSS + :param dssObjects: Dictionary of all :class:`pydss.dssElement.dssElement` objects in pydss :type dssObjects: dict of :class:`pydss.dssElement.dssElement` objects :param dssObjectsByClass: Dictionary of all :class:`pydss.dssElement.dssElement` objects in pydss sorted by class :type dssObjectsByClass: dict of :class:`pydss.dssElement.dssElement` objects diff --git a/src/pydss/registry.py b/src/pydss/registry.py index e1d2522d..7cf0a4bf 100644 --- a/src/pydss/registry.py +++ b/src/pydss/registry.py @@ -209,7 +209,7 @@ def reset_defaults(self, controllers_only=False): def show_controllers(self): """Show the registered controllers.""" - print("PyDSS Controllers:") + print("Pydss Controllers:") for controller_type in self._controllers: print(f"Controller Type: {controller_type}") controllers = list(self._controllers[controller_type].values()) diff --git a/src/pydss/simulation_input_models.py b/src/pydss/simulation_input_models.py index 4c7f7ab9..8b2911ce 100644 --- a/src/pydss/simulation_input_models.py +++ b/src/pydss/simulation_input_models.py @@ -702,7 +702,7 @@ class LoggingModel(InputsBaseModel): Optional[LoggingLevel], Field( title="logging_level", - description="PyDSS minimum logging level", + description="Pydss minimum logging level", default=LoggingLevel.INFO, alias="Logging Level", )] @@ -1170,7 +1170,7 @@ class ControllerMap(InputsBaseModel): ControllerType, Field( title="controller_types", - description="Should be a valid controller type registered with PyDSS", + description="Should be a valid controller type registered with pydss", default=ControllerType.PV_CONTROLLER, )] From 2e8b40cfe3109b40e13f92da796fafe826337309 Mon Sep 17 00:00:00 2001 From: Latif Date: Mon, 25 Mar 2024 13:59:29 -0600 Subject: [PATCH 6/7] code cleanup --- src/pydss/pyDSS.py | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/src/pydss/pyDSS.py b/src/pydss/pyDSS.py index 3e5c31ae..9108de24 100644 --- a/src/pydss/pyDSS.py +++ b/src/pydss/pyDSS.py @@ -9,36 +9,6 @@ from pydss.simulation_input_models import SimulationSettingsModel, dump_settings from pydss.utils.utils import dump_data, load_data - -__author__ = "Aadil Latif" -__copyright__ = """ - 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." -""" -__license__ = "BSD 3-Clause License" -__version__ = "2.0.4" -__maintainer__ = "Aadil Latif" -__email__ = "aadil.latif@nrel.gov, aadil.latif@gmail.com" -__status__ = "Production" - PYDSS_BASE_DIR = os.path.join(os.path.dirname(getattr(pydss, "__path__")[0]), "pydss") class instance(object): From f2ec2776fa18d611da380883e82abda0b54f1fac Mon Sep 17 00:00:00 2001 From: Kapil Duwadi Date: Mon, 25 Mar 2024 16:38:05 -0500 Subject: [PATCH 7/7] renamed PyDSS to pydss in DEFAULT_REGISTRY --- src/pydss/registry.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/pydss/registry.py b/src/pydss/registry.py index 0e8fb9ef..522d35ad 100644 --- a/src/pydss/registry.py +++ b/src/pydss/registry.py @@ -21,26 +21,25 @@ "name": "NO_VRT", "filename": os.path.join( os.path.dirname(getattr(pydss, "__path__")[0]), - "PyDSS/pyControllers/Controllers/Settings/PvControllers.toml" + "pydss/pyControllers/Controllers/Settings/PvControllers.toml", ), }, { "name": "cpf", "filename": os.path.join( os.path.dirname(getattr(pydss, "__path__")[0]), - "PyDSS/pyControllers/Controllers/Settings/PvControllers.toml" + "pydss/pyControllers/Controllers/Settings/PvControllers.toml", ), }, { "name": "volt-var", "filename": os.path.join( os.path.dirname(getattr(pydss, "__path__")[0]), - "PyDSS/pyControllers/Controllers/Settings/PvControllers.toml" + "pydss/pyControllers/Controllers/Settings/PvControllers.toml", ), }, - ], - ControllerType.PV_VOLTAGE_RIDETHROUGH.value: [ ], + ControllerType.PV_VOLTAGE_RIDETHROUGH.value: [], ControllerType.SOCKET_CONTROLLER.value: [], ControllerType.STORAGE_CONTROLLER.value: [], ControllerType.XMFR_CONTROLLER.value: [], @@ -52,8 +51,10 @@ REQUIRED_CONTROLLER_FIELDS = ("name", "filename") + class Registry: """Manages controllers registered with pydss.""" + _REGISTRY_FILENAME = ".pydss-registry.json" def __init__(self, registry_filename=None): @@ -61,7 +62,7 @@ def __init__(self, registry_filename=None): self._registry_filename = Path.home() / self._REGISTRY_FILENAME else: self._registry_filename = Path(registry_filename) - + self._controllers = {x: {} for x in CONTROLLER_TYPES} data = copy.deepcopy(DEFAULT_REGISTRY) for controller_type, controllers in DEFAULT_REGISTRY["Controllers"].items(): @@ -69,7 +70,7 @@ def __init__(self, registry_filename=None): path = Path(controller["filename"]) if not path.exists(): raise InvalidConfiguration(f"Default controller file={path} does not exist") - + # This is written to work with legacy versions where default controllers were # written to the registry. if self._registry_filename.exists(): @@ -80,15 +81,20 @@ def __init__(self, registry_filename=None): path = Path(controller["filename"]) if not path.exists(): name = controller["name"] - msg = f"The registry contains a controller with an invalid file. " \ - f"Type={controller_type} name={name} file={path}.\nWould you like to " \ - "delete it? (y/n) -> " + msg = ( + f"The registry contains a controller with an invalid file. " + f"Type={controller_type} name={name} file={path}.\nWould you like to " + "delete it? (y/n) -> " + ) response = input(msg).lower() if response == "y": to_delete.append((controller_type, i)) continue else: - logger.error("Exiting because the registry %s is invalid", self._registry_filename) + logger.error( + "Exiting because the registry %s is invalid", + self._registry_filename, + ) sys.exit(1) if not self._is_default_controller(controller_type, controller["name"]): data["Controllers"][controller_type].append(controller) @@ -231,9 +237,7 @@ def unregister_controller(self, controller_type, name): """ if not self.is_controller_registered(controller_type, name): - raise InvalidParameter( - f"{controller_type} / {name} isn't registered" - ) + raise InvalidParameter(f"{controller_type} / {name} isn't registered") if self._is_default_controller(controller_type, name): raise InvalidParameter(f"Cannot unregister a default controller")