Skip to main content

Python implementation of the Common Information Model.

Project description

PyCIM is a Python implementation of the IEC Common Information Model. Current features include:

  • Support for IEC 61970 14v15 and IEC 61968 10v31.

  • Class and attribute documentation integrated as Python docstrings.

  • Transparent bi-directional reference handling using Python properties.

  • CIM RDF/XML parsing and serialisation according to IEC 61970-552.

Installation

PyCIM has no dependencies beyond Python 2.5 or later. It can be easy_installed using setuptools:

$ easy_install PyCIM

Alternatively, download and unpack the tarball and install:

$ tar zxf PyCIM-14.15.tar.gz
$ python setup.py install

On UNIX systems, use sudo for the latter command if you need to install the scripts to a directory that requires root privileges:

$ sudo python setup.py install

The development Git repository can be cloned from GitHub:

$ git clone https://github.com/rwl/PyCIM.git

Using PyCIM

To use PyCIM with the Python interpreter, iPython is recommended. For example, to instantiate a ConnecticityNode:

In [1]: from CIM14.IEC61970.Core import ConnectivityNode

In [2]: node = ConnectivityNode(name='Node 1')

To associate the node with a Terminal:

In [3]: from CIM14.IEC61970.Core import Terminal

In [4]: t = Terminal(name='T1', ConnectivityNode=node)

In [5]: node.Terminals[0].name
Out[5]: 'T1'

To add a Terminal to a ConnectivityNode:

In [6]: t2 = Terminal()

In [7]: node.addTerminals(t2)

In [8]: t2.ConnectivityNode.name
Out[8]: 'Node 1'

To view the docstring for an attribute:

In [9]: t.connected?
Type:     bool
Base Class: <type 'bool'>
String Form:    False
Namespace:  Interactive
Docstring:
    bool(x) -> bool

    Returns True when the argument x is true, False otherwise.
    The builtins True and False are the only two instances of the class bool.
    The class bool is a subclass of the class int, and cannot be subclassed.

To parse a CIM RDF/XML file:

In[1]: import logging

In[2]: logging.basicConfig(level=logging.INFO)

In[3]: from PyCIM import cimread

In[4]: d = cimread('path/to/input_file.xml')
INFO:PyCIM.RDFXMLReader:Created 5660 CIM objects in 1.04s.

The cimread function returns a Python dictionary that maps UUIDs to CIM objects. To serialise the dictionary of objects:

In[5]: from PyCIM import cimwrite

In[6]: cimwrite(d, 'path/to/output_file.xml')
INFO:PyCIM.RDFXMLWriter:5660 CIM objects serialised in 1.14s.

For further information refer to the API documentation.

License

PyCIM is licensed under the GNU Lesser General Public License version 2.1 to allow commercial use while ensuring it remains free and open source.

Credits

PyCIM is developed by Richard Lincoln (r.w.lincoln@gmail.com).

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

PyCIM-14.15.2.tar.gz (573.7 kB view details)

Uploaded Source

Built Distributions

PyCIM-14.15.2.win32.exe (893.1 kB view details)

Uploaded Source

PyCIM-14.15.2.win32-py2.6.msi (557.1 kB view details)

Uploaded Source

PyCIM-14.15.2-py2.6.egg (1.4 MB view details)

Uploaded Source

PyCIM-14.15.2-py2.5.egg (1.4 MB view details)

Uploaded Source

File details

Details for the file PyCIM-14.15.2.tar.gz.

File metadata

  • Download URL: PyCIM-14.15.2.tar.gz
  • Upload date:
  • Size: 573.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyCIM-14.15.2.tar.gz
Algorithm Hash digest
SHA256 4cd7caaa90ea48f0ea07952454cd005a23e9513c073d34c5ee24081455bbe525
MD5 50103c173d4411b050220fad9ed3c3ba
BLAKE2b-256 865fa4e1724f5a1423cf05bd16d0947260e6f2f2379b7d758735a116be327429

See more details on using hashes here.

File details

Details for the file PyCIM-14.15.2.win32.exe.

File metadata

  • Download URL: PyCIM-14.15.2.win32.exe
  • Upload date:
  • Size: 893.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyCIM-14.15.2.win32.exe
Algorithm Hash digest
SHA256 46ceb17be62f8620eea1deaf32980515dc73ed788e7d32a008c6d1b60173572a
MD5 28297e89c924890e212c698b70496cec
BLAKE2b-256 f0fa1025a643ebc3d40b2b1901253a6e6ab9b0c06988d6787fcb0d6db77fb80b

See more details on using hashes here.

File details

Details for the file PyCIM-14.15.2.win32-py2.6.msi.

File metadata

File hashes

Hashes for PyCIM-14.15.2.win32-py2.6.msi
Algorithm Hash digest
SHA256 8e17b1ae206840f2d35e541bb9fd9d2363a7d5be936d3d98978a944ce3eba039
MD5 826c6ec32172b56a70fe550ffef2bf3f
BLAKE2b-256 f077a434ca88afb91de7850b895b131c0835179ad6147192350a4289524502e0

See more details on using hashes here.

File details

Details for the file PyCIM-14.15.2-py2.6.egg.

File metadata

  • Download URL: PyCIM-14.15.2-py2.6.egg
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyCIM-14.15.2-py2.6.egg
Algorithm Hash digest
SHA256 dc1f1cf7059f896a5eeefb9517416d3e9cbd57055b1e476e49ea19fbf968a056
MD5 62d2222fb8014cd6e343c38e0d415269
BLAKE2b-256 909216e69f02e7c80027923addef6cf22149786f912ec7bff704f52467e922f2

See more details on using hashes here.

File details

Details for the file PyCIM-14.15.2-py2.5.egg.

File metadata

  • Download URL: PyCIM-14.15.2-py2.5.egg
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyCIM-14.15.2-py2.5.egg
Algorithm Hash digest
SHA256 b4cb1bb7834c60f14ceff668d384545bda60ea01d1817aa44c5cc9c3d49507af
MD5 fa1309330a8325244c0f74e16c975483
BLAKE2b-256 cd9a4d7fccef92273ec374eb2c1917c32fd883da222e977f332ef80db11588ce

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page