gridappsd-cim-lab


Namegridappsd-cim-lab JSON
Version 0.11.230210 PyPI version JSON
download
home_page
SummaryCIM models used within gridappsd.
upload_time2023-02-10 19:35:54
maintainer
docs_urlNone
authorC. Allwardt
requires_python>=3.7.9,<4.0
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # GridAPPS-D CIM-Lab Library
Python library for parsing CIM power system models in distributed ADMS applications. It creates Python object instances in memory using a data profile exported from a specified CIM profile (e.g. GridAPPS-D CIM100 RC4_2021 profile).

The library is being expanded to cover centralized applications, transmission models, and real-time editing of CIM XML models natively.

## Requirements
The gridappsd-cim-lab requires a python version >=3.8 and <4. No testing has been done with other versions.

It also requires a connection to a Blazegraph TripleStore Database or the GridAPPS-D Platform. Support for other databases may be added in future releases.

The DistributedModel class also requires the output for GridAPPS-D Topology Processor, which may be obtained by importing the topology processor library or passing an API call to the `goss.gridappsd.request.data.topology` queue in the GridAPPS-D platform.

## Installation
The CIM-Lab library should be installed in same virtual environment as the ADMS application. 
```
pip install gridappsd-cim-lab
```
It is also included in the gridappsd-python library, which can be installed using
```
pip install gridappsd-python
```

## Specifying the CIM Profile
The CIM-Lab library supports multiple CIM profiles, which can be exported using CIMtool or Enterprise Architect Schema Composer as a .xsd data profile. The data profiles are ingested using the xsdata python library and saved in the cimlab/data_profile directory.

When importing the library, the CIM profile must be specified using the gridappsd-python constructor or directly as
```
import cimlab.data_profile.rc4_2021 as cim
```
or by using `importlib`:
```
import importlib
cim_profile = 'rc4_2021'
cim = importlib.import_module('cimlab.data_profile.' + cim_profile)
```


## Model Initialization

The CIM-Lab library creates object instances populated with the attributes of `name` and `mRID` for all addressable and unaddressable equipment in each distributed area. All other attributes are `None` or `[]` by default.

### Usage with GridAPPS-D Context Manager
If an application is built using the GridAPPS-D Context Manager and Field Interface in gridappsd-python, initialization of the `DistributedModel`, `SwitchArea`, and `SecondaryArea` classes is performed automatically.

### Standalone Usage
Initialization of the `DistributedModel`, `SwitchArea`, and `SecondaryArea` classes requires the distributed topology message from GridAPPS-D Topology Processor, which may be called through the GridAPPS-D API or by import the topology library:
```
topic = "goss.gridappsd.request.data.topology"

message = {
   "requestType": "GET_SWITCH_AREAS",
   "modelID":  "_FEEDER_MRID_1234_ABCD,
   "resultFormat": "JSON"
}

topology_response = gapps.get_response(topic, message, timeout=30)
```
```
from topology_processor import DistributedTopology
gapps = GridappsdConnection(feeder_mrid)
Topology = DistributedTopology(gapps, feeder_mrid)
topology_response = Topology.create_switch_areas(feeder_mrid)
topology_response = json.loads(topology_response)
```
The distributed network model can then be initialized using
```
feeder = cim.Feeder(mRID=feeder_mrid)
network = DistributedModel(connection=bg, feeder=feeder, topology=topology_response['feeders'])
```

## Core Library Methods
The CIM power system model can then be parsed by invoking the `.get_all_attributes(cim.ClassName)` method. The method populates all available attributes of the given attribute and creates default instances of all associated class object instances that are one association away in the CIM UML. Associated default instances are only populated with `mRID` attribute. The `.get_all_attributes` method must be invoked in sequential order following the inheritance hierarchy in the CIM UML, starting with the particular equiment class (e.g. ACLineSegment) and then each child class inheriting from the previous class. 

The Python object instances can be accessed using the `typed_catalog` dictionary of each distributed area class instance. The typed catalog is organized by the class type and then mRID of each object. The attributes of each class can be accessed directly or through any associated class. These two call are equivalent:
```
bus_name = switch_area.typed_catalog[cim.ConnectivityNode][node_mrid].name
```
```
bus_name = switch_area.typed_catalog[cim.ACLineSegment][line_mrid].Terminals[0].ConnectivityNode.name
```

Note that all classes and attributes are case sensitive and follow the CIM UML conventions for each class.

All instances of all given CIM class can also be exported as JSON text using the `.__dumps__(cim.ClassName)` method of the distributed area classes:
```
Lines = switch_area.__dumps__(cim.ACLineSegment)
```

Additional examples of usage for specified CIM classes are inlcuded in model_example.py

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "gridappsd-cim-lab",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7.9,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "C. Allwardt",
    "author_email": "3979063+craig8@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/33/ea/62ecf888a648ab0a486bd1b11f8191b946da69ffdc72db6215517e9081b6/gridappsd_cim_lab-0.11.230210.tar.gz",
    "platform": null,
    "description": "# GridAPPS-D CIM-Lab Library\nPython library for parsing CIM power system models in distributed ADMS applications. It creates Python object instances in memory using a data profile exported from a specified CIM profile (e.g. GridAPPS-D CIM100 RC4_2021 profile).\n\nThe library is being expanded to cover centralized applications, transmission models, and real-time editing of CIM XML models natively.\n\n## Requirements\nThe gridappsd-cim-lab requires a python version >=3.8 and <4. No testing has been done with other versions.\n\nIt also requires a connection to a Blazegraph TripleStore Database or the GridAPPS-D Platform. Support for other databases may be added in future releases.\n\nThe DistributedModel class also requires the output for GridAPPS-D Topology Processor, which may be obtained by importing the topology processor library or passing an API call to the `goss.gridappsd.request.data.topology` queue in the GridAPPS-D platform.\n\n## Installation\nThe CIM-Lab library should be installed in same virtual environment as the ADMS application. \n```\npip install gridappsd-cim-lab\n```\nIt is also included in the gridappsd-python library, which can be installed using\n```\npip install gridappsd-python\n```\n\n## Specifying the CIM Profile\nThe CIM-Lab library supports multiple CIM profiles, which can be exported using CIMtool or Enterprise Architect Schema Composer as a .xsd data profile. The data profiles are ingested using the xsdata python library and saved in the cimlab/data_profile directory.\n\nWhen importing the library, the CIM profile must be specified using the gridappsd-python constructor or directly as\n```\nimport cimlab.data_profile.rc4_2021 as cim\n```\nor by using `importlib`:\n```\nimport importlib\ncim_profile = 'rc4_2021'\ncim = importlib.import_module('cimlab.data_profile.' + cim_profile)\n```\n\n\n## Model Initialization\n\nThe CIM-Lab library creates object instances populated with the attributes of `name` and `mRID` for all addressable and unaddressable equipment in each distributed area. All other attributes are `None` or `[]` by default.\n\n### Usage with GridAPPS-D Context Manager\nIf an application is built using the GridAPPS-D Context Manager and Field Interface in gridappsd-python, initialization of the `DistributedModel`, `SwitchArea`, and `SecondaryArea` classes is performed automatically.\n\n### Standalone Usage\nInitialization of the `DistributedModel`, `SwitchArea`, and `SecondaryArea` classes requires the distributed topology message from GridAPPS-D Topology Processor, which may be called through the GridAPPS-D API or by import the topology library:\n```\ntopic = \"goss.gridappsd.request.data.topology\"\n\nmessage = {\n   \"requestType\": \"GET_SWITCH_AREAS\",\n   \"modelID\":  \"_FEEDER_MRID_1234_ABCD,\n   \"resultFormat\": \"JSON\"\n}\n\ntopology_response = gapps.get_response(topic, message, timeout=30)\n```\n```\nfrom topology_processor import DistributedTopology\ngapps = GridappsdConnection(feeder_mrid)\nTopology = DistributedTopology(gapps, feeder_mrid)\ntopology_response = Topology.create_switch_areas(feeder_mrid)\ntopology_response = json.loads(topology_response)\n```\nThe distributed network model can then be initialized using\n```\nfeeder = cim.Feeder(mRID=feeder_mrid)\nnetwork = DistributedModel(connection=bg, feeder=feeder, topology=topology_response['feeders'])\n```\n\n## Core Library Methods\nThe CIM power system model can then be parsed by invoking the `.get_all_attributes(cim.ClassName)` method. The method populates all available attributes of the given attribute and creates default instances of all associated class object instances that are one association away in the CIM UML. Associated default instances are only populated with `mRID` attribute. The `.get_all_attributes` method must be invoked in sequential order following the inheritance hierarchy in the CIM UML, starting with the particular equiment class (e.g. ACLineSegment) and then each child class inheriting from the previous class. \n\nThe Python object instances can be accessed using the `typed_catalog` dictionary of each distributed area class instance. The typed catalog is organized by the class type and then mRID of each object. The attributes of each class can be accessed directly or through any associated class. These two call are equivalent:\n```\nbus_name = switch_area.typed_catalog[cim.ConnectivityNode][node_mrid].name\n```\n```\nbus_name = switch_area.typed_catalog[cim.ACLineSegment][line_mrid].Terminals[0].ConnectivityNode.name\n```\n\nNote that all classes and attributes are case sensitive and follow the CIM UML conventions for each class.\n\nAll instances of all given CIM class can also be exported as JSON text using the `.__dumps__(cim.ClassName)` method of the distributed area classes:\n```\nLines = switch_area.__dumps__(cim.ACLineSegment)\n```\n\nAdditional examples of usage for specified CIM classes are inlcuded in model_example.py\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "CIM models used within gridappsd.",
    "version": "0.11.230210",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "93897a7b3e2d6c842cf6bf309dc94935c74cbf558c9cf3caa5d1bbe4ac9102b0",
                "md5": "ff222fa06b1387bc417fb8a44836ab41",
                "sha256": "ee9450f9873ccdbcdc0c7f870666f47b7272e345b7b2347ad5a1ce4582a18b44"
            },
            "downloads": -1,
            "filename": "gridappsd_cim_lab-0.11.230210-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ff222fa06b1387bc417fb8a44836ab41",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7.9,<4.0",
            "size": 280438,
            "upload_time": "2023-02-10T19:35:51",
            "upload_time_iso_8601": "2023-02-10T19:35:51.983130Z",
            "url": "https://files.pythonhosted.org/packages/93/89/7a7b3e2d6c842cf6bf309dc94935c74cbf558c9cf3caa5d1bbe4ac9102b0/gridappsd_cim_lab-0.11.230210-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "33ea62ecf888a648ab0a486bd1b11f8191b946da69ffdc72db6215517e9081b6",
                "md5": "7c7c2b3c68226334042d491267988198",
                "sha256": "801ff17006298a061ce74779bab3e298c8ab65878ce5af33be27a6380d902132"
            },
            "downloads": -1,
            "filename": "gridappsd_cim_lab-0.11.230210.tar.gz",
            "has_sig": false,
            "md5_digest": "7c7c2b3c68226334042d491267988198",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.9,<4.0",
            "size": 227675,
            "upload_time": "2023-02-10T19:35:54",
            "upload_time_iso_8601": "2023-02-10T19:35:54.142634Z",
            "url": "https://files.pythonhosted.org/packages/33/ea/62ecf888a648ab0a486bd1b11f8191b946da69ffdc72db6215517e9081b6/gridappsd_cim_lab-0.11.230210.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-10 19:35:54",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "gridappsd-cim-lab"
}
        
Elapsed time: 0.09013s