Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code generation flow #26

Open
stv0g opened this issue Aug 7, 2017 · 2 comments
Open

Code generation flow #26

stv0g opened this issue Aug 7, 2017 · 2 comments

Comments

@stv0g
Copy link

stv0g commented Aug 7, 2017

Dear Mr. Lincoln,

We are currently considering to use your PyCIM project to perform load flow analysis with PYPOWER / PyPSA of CIM models.

However, we face a little problem. Our CIM models are based on the latest version 16 of the CIM standard.

In section 6.2.6 of the book “The Common Information Model CIM” by Mathiuas Uslar, the code generation flow used for PyCIM is described.

Could you provide us some details about this flow? In particular, the JET templates for Enerate are missing?

Thank you very much

@stv0g stv0g mentioned this issue Aug 7, 2017
@stv0g
Copy link
Author

stv0g commented Aug 7, 2017

My current understanding of the workflow looks like this:

+------------+           +---------+            +---------+            +--------+
| EA+Project |\  +---->  | CIMTool |  +---->    | Enerate |  +----->  /| Python |
| CIM16 UML  |/          +---------+            +---------+           \|  Code  |
+------------+    XMI                  Ecore                   Code    +--------+
                 Export               Export         ^      Generation
                                                     |
                                                     |
                                                     |
                         +-----------------+         |
                         |  Java Emitter   |\   +----+
                         | Templates (JET) |/
                         +-----------------+     

@rwl
Copy link
Owner

rwl commented Aug 7, 2017

The ECore models are generated using a modified version of CIMTool:

https://github.com/rwl/CIMTool

The IEC61968 and IEC62325 packages would be deleted in Enterprise Architect and the remaining packages exported according to the instructions here:

http://wiki.cimtool.org/Using_CIMTool_with_Enterprise_Architect.html

ea_export

The code is then generated using a project called Enerate:

http://rwl.github.io/enerate/
https://github.com/rwl/enerate

It takes an ECore model and generates code using JET templates:

www.eclipse.org/emft/projects/jet/

You have to add an annotation to the base package in the ECore model so the code generator knows where to start. Here are some of my old projects that include ECore models that once worked

enerate.zip

I am thinking of marking PyCIM as deprecated. It is simpler to just read the RDF/XML into a DOM tree and use XPath to extract the data as required. Here is a Python 3 script that demonstrates how to extract the lat/lng coordinates from a snippet of a GeographicalLocation model:

https://gist.github.com/rwl/396e35aa41919714b0a1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants