{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# GridAPPS-D Platform Connection" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "GridAPPS-D™ is an open-source platform that accelerates development and deployment of portable applications for advanced distribution management and operations. It is built in a linux environment using Docker, which allows large software packages to be distributed as containers. Its purpose is to reduce the time and cost to integrate advanced functionality into distribution operations, to create a more reliable and resilient grid.\n", "\n", "The GridAPPS-D source code is publically available from the [GridAPPS-D GitHub](https://github.com/GRIDAPPSD). The GridAPPS-D™ project is sponsored by the U.S. Department of Energy Office of Electricity and receives ongoing updates from a team of core developers at PNNL. Documentation for the platform and API is available on the [GridAPPS-D Training ReadTheDocs](https://gridappsd-training.readthedocs.io/)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Connection Parameters\n", "\n", "GridAPPS-D uses Java Token Authentication for user authentication based on a combination of IP address, port, username, and password. The set of default username and passwords are available in the [GOSS Security Config File](https://github.com/GRIDAPPSD/GOSS-GridAPPS-D/blob/master/gov.pnnl.goss.gridappsd/conf/pnnl.goss.core.security.userfile.cfg)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The CIM-Graph `ConnectionParameters` class is used to specify the configuration used to connect to the platform and access the data contained in the platform, with the following default values:\n", "\n", "* `cim_profile`: Use `cimhub_2023` for GridAPPS-D releases v2025.01.0 and later. Use `rc4_2021` for releases v2024.09.0 and earlier.\n", "\n", "* `iec61970_301`: CIM serialization format. Use `8` for GridAPPS-D releases v2025.01.0 and later. Use `7` for releases v2024.09.0 and earlier.\n", "\n", "* `host`: IP address for the platform, default is `localhost`. Remote servers should use the IP address of the server.\n", "\n", "* `port`: IP port for the platform message bus, default is `61613`.\n", "\n", "* `username`: Username from GOSS security config, default is `app_user`.\n", "\n", "* `password`: Password from GOSS security config, default is `1234App`.\n", "\n", "* `database`: GridAPPS-D API to be used. Currently only `powergridmodel` API is supported.\n", "\n", "* `url`: URL of the internal database. If running inside a docker container, this needs to be updated\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To connect with the default parameters, only the `cim_profile` and `iec61970_301` versions need to be specified: " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "ename": "NameError", "evalue": "name 'ConnectionParameters' is not defined", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", "Cell \u001b[0;32mIn[3], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m params \u001b[38;5;241m=\u001b[39m \u001b[43mConnectionParameters\u001b[49m(host\u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlocalhost\u001b[39m\u001b[38;5;124m\"\u001b[39m, port\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m61613\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 2\u001b[0m username\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mapp_user\u001b[39m\u001b[38;5;124m\"\u001b[39m, password\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m1234App\u001b[39m\u001b[38;5;124m\"\u001b[39m, \n\u001b[1;32m 3\u001b[0m cim_profile\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mrc4_2021\u001b[39m\u001b[38;5;124m'\u001b[39m, namespace\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhttp://iec.ch/TC57/CIM100#\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", "\u001b[0;31mNameError\u001b[0m: name 'ConnectionParameters' is not defined" ] } ], "source": [ "from cimgraph.databases import ConnectionParameters\n", "params = ConnectionParameters(host= \"localhost\", port=\"61613\",\n", " username=\"app_user\", password=\"1234App\", \n", " cim_profile='rc4_2021', namespace=\"http://iec.ch/TC57/CIM100#\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "ename": "ImportError", "evalue": "cannot import name 'GridAPPSDConnection' from 'cimgraph.databases' (/home/ande188/CIM-Graph/cimgraph/databases/__init__.py)", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)", "Cell \u001b[0;32mIn[2], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# Import class from cimgraph databases module\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21;01mcimgraph\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mdatabases\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m GridAPPSDConnection\n\u001b[1;32m 3\u001b[0m \u001b[38;5;66;03m# Create connection parameters\u001b[39;00m\n\u001b[1;32m 4\u001b[0m params \u001b[38;5;241m=\u001b[39m ConnectionParameters(host\u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlocalhost\u001b[39m\u001b[38;5;124m\"\u001b[39m, port\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m61613\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 5\u001b[0m username\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mapp_user\u001b[39m\u001b[38;5;124m\"\u001b[39m, password\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m1234App\u001b[39m\u001b[38;5;124m\"\u001b[39m, \n\u001b[1;32m 6\u001b[0m cim_profile\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mrc4_2021\u001b[39m\u001b[38;5;124m'\u001b[39m, namespace\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhttp://iec.ch/TC57/CIM100#\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", "\u001b[0;31mImportError\u001b[0m: cannot import name 'GridAPPSDConnection' from 'cimgraph.databases' (/home/ande188/CIM-Graph/cimgraph/databases/__init__.py)" ] } ], "source": [ "# Import class from cimgraph databases module\n", "from cimgraph.databases import GridappsdConnection\n", "# Create connection parameters\n", "\n", "# Create platform connection object\n", "gapps = GridAPPSDConnection(params)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.12" } }, "nbformat": 4, "nbformat_minor": 2 }