Generate Python data structures from CIM RDF profiles, parse and serialize CIM-compliant information objects, according to IEC 61970-501 standard
Project description
cimrdf.py
Generate Python data structures from CIM RDF profiles, parse and serialize CIM-compliant information objects, according to IEC 61970-501 standard.
Installing
$ git clone https://github.com/bressanmarcos/cimrdf.py.git
$ cd cimrdf.py
$ python setup.py install
Using
- Create your RDF artifact with you preferred utils
- Convert it into Python data structures with:
cimrdfpy input_filename.xml output.py
Creating CIM RDF instances
3a. Use the generated classes from output.py to create your instances
from output import *
ei = EquivalentInjection()
ei.IdentifiedObject_mRID = 'EquivalentNW243'
t = Terminal()
t.Terminal_sequenceNumber = 1
t.Terminal_ConductingEquipment = ei
s = Switch()
s.Switch_normalOpen = True
s.IdentifiedObject_mRID = 'SW12'
t1 = Terminal()
t1.Terminal_sequenceNumber = 1
t1.Terminal_ConductingEquipment = s
t2 = Terminal()
t2.Terminal_sequenceNumber = 2
t2.Terminal_ConductingEquipment = s
cn = ConnectivityNode()
cn.IdentifiedObject_mRID = 'Node23'
cn.ConnectivityNode_Terminals = [t1, t]
// This associates reciprocally Terminals t and t1 to ConnectivityNode cn, and vice versa
4a. Create a new document instance with all objects
new = DocumentCIMRDF([ei, t, s, t1, t2, cn])
The available functions are:
- new.dump(): Pretty-Print the document to stdout
- new.pack(): Get the document's ElementTree (xml.etree.ElementTree) instance
- new.tostring(): Get the XML stringified version of the document
- new.add_elements( ... ): Add new elements (one or a list) to the document
Parsing CIM RDF instances
3b. Use proper functions to parse file or string.
instances = fromstring(xmlstring)
print(instances)
// [list of instances]
The available functions are:
- fromstring(xmlstring): Get list of instances from CIM RDF string
- fromfile(filename): Get list of instances from CIM RDF file
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file cimrdf.py-1.8.tar.gz
.
File metadata
- Download URL: cimrdf.py-1.8.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 812a5d9287f355999931dae035c9b1773a2e5b98a4112c27705790e0751ec5be |
|
MD5 | ee968a4ee3de4468d264614e131b3ab7 |
|
BLAKE2b-256 | 369358eef84d1ccd9881f445cf58dd966d06632ae052ab2b1acb7bf5c82daa44 |
File details
Details for the file cimrdf.py-1.8-py3.7.egg
.
File metadata
- Download URL: cimrdf.py-1.8-py3.7.egg
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e0bc9f8f279349c5129d13320e0fa7ea9fefa3d3d50318310696eff56892a50 |
|
MD5 | 6d2c764256adb660cde00ad15807185d |
|
BLAKE2b-256 | aae136782f7dce10ded9b7e2ecf919ecf85aa0099d9540ded2d161761c5a0bca |
File details
Details for the file cimrdf.py-1.8-py3-none-any.whl
.
File metadata
- Download URL: cimrdf.py-1.8-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b9dd337fb4754a4847cdbfac1c9875e7a10b424920450a1bf889649798ed4a9 |
|
MD5 | da7249fa8ced9ee065ea6b21036fd3f3 |
|
BLAKE2b-256 | 0e31ac433e51e474d44baea54f5a4c11df0361655e8d2ae376120976d3ef5db8 |