Book a Demo

Author Topic: Code Generation for SPS  (Read 9175 times)

Mr. Sanders

  • EA User
  • **
  • Posts: 187
  • Karma: +0/-0
  • Dilbert for president
    • View Profile
Code Generation for SPS
« on: February 22, 2013, 01:13:20 am »
Hello,

has some of you ever had the problem to generate code for Siemens Automation SPS controls?

Are there Add-ins available?
Have you adapted the code Generation process for those Automation scripts?



Thank you and regards
« Last Edit: February 22, 2013, 02:25:27 am by mizd »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Code Generation for SPS
« Reply #1 on: February 22, 2013, 01:28:41 am »
You mean that Siemens S7 stuff? AFAIK this is in no way object oriented. Though there are procedures to model functions in UML (I once googled that).

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Code Generation for SPS
« Reply #2 on: February 22, 2013, 01:32:52 am »
According to Wikipedia there are about 15 to 20 possible meanings for the  abbreviation "SPS".
You might want to be more specific.

Geert

Mr. Sanders

  • EA User
  • **
  • Posts: 187
  • Karma: +0/-0
  • Dilbert for president
    • View Profile
Re: Code Generation for SPS
« Reply #3 on: February 22, 2013, 02:23:27 am »
Hello
and thank you for your answers.

Yes, I am talking about Siemens Automation stuff like S7.
And yes, it is not object oriented, but EA is not restricted to OOD.

The idea is to model state machines and to generate SPS code out of it.
Do you know about existing UML profiles or code Generator adaptations or similiar stuff?

Thank you.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Code Generation for SPS
« Reply #4 on: February 22, 2013, 02:42:56 am »
I once used this resource: http://www.functionblocks.org/Papers/fba2.pdf It's not specific for EA, but a good basis. However, we did not go much into details as the S7-group were "the other guys" which our group had to interface. Actually it was not our job to do their work ;)

q.

Mr. Sanders

  • EA User
  • **
  • Posts: 187
  • Karma: +0/-0
  • Dilbert for president
    • View Profile
Re: Code Generation for SPS
« Reply #5 on: February 22, 2013, 03:19:13 am »
Hello querty and thank's for your answer.

I am not looking for concepts.

I am looking for existing Commercial or non Commercial solutions.
We would be able to generate our own UML profiles and define such new stereotype meta classes. That is not the point. The point is if somebodey already knows an existing product or if not, has already done some state machine code Generator Adaptation, so we can generate such "function block"-similiar code snippets.

Thank you

« Last Edit: February 22, 2013, 03:30:27 am by mizd »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Code Generation for SPS
« Reply #6 on: February 22, 2013, 03:34:49 am »
Never read anything about this here on the board. I doubt that something exists as from my experience the S7 guys were always a bit conservative. However, let's wait for replies.

q.

Mr. Sanders

  • EA User
  • **
  • Posts: 187
  • Karma: +0/-0
  • Dilbert for president
    • View Profile
Re: Code Generation for SPS
« Reply #7 on: February 22, 2013, 03:58:23 am »
OK, thank you.

Has somebody to the  description of the code Generator and how to adapt it?

Thank you

Mr. Sanders

  • EA User
  • **
  • Posts: 187
  • Karma: +0/-0
  • Dilbert for president
    • View Profile
Re: Code Generation for SPS
« Reply #8 on: February 22, 2013, 04:15:15 am »
Hello,

OK, I found some hints here about custom code Generation:

http://blog.lieberlieber.com/2012/11/05/a-custom-uml-state-machine-c-code-generator-in-600-lines/

This is a good starting Point.

Nevertheless, if someone has some ready to use solution, we would be interested.

Thank  you

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Code Generation for SPS
« Reply #9 on: February 22, 2013, 06:53:49 am »
Quote
OK, I found some hints here about custom code Generation:

http://blog.lieberlieber.com/2012/11/05/a-custom-uml-state-machine-c-code-generator-in-600-lines/

This is a good starting Point.

You can also have a look at Geert Bellekens' Enterprise-Architect-Add-in-Framework, which is freely available from GitHub.

I have put some extensions there for (behavioral) state-machines and also a utility class 'TransformationILWriter', you can use to generate a transformation template for a state machine diagram directly (unfortunately I didn't find out, how to set the 'Language' property of package/class elements using the transformation IL, so you'll need to set your custom language as default with the code engineering settings).

Note that state-machines need to be part of (embedded into) a class element for transformable EA UML domain models, and can't just be used from a 'free form' state-machine diagram. Thus you'll need to have a 'master' domain model class that contains your state-machine.

To use this, you'll need to create an EA AddIn based on the framework
in C# (which is easy) and provide a method that can be used with a
Code: [Select]
%EXEC_ADD_IN("MyAddIn","MyTransformMethod")%call, which is the only one executed at top level ('File' template).

Next step is to generate code from the transformed model as you need for the SPS syntax. Probably a good starting point for this is to start from the code generation templates for C-Language (or another non intrinsic OOD enabled language).

You might consider reverse engineering/synchronization support for your new language using the new NBNF syntax declaration feature for custom defined languages available with EA 10 (you might find some hints about this feature here).

IMHO tracking down this path is the most promising way to get a working solution with least efforts (state-machine generation is not standards and depends on your EA edition license for the raw code generation templates).

HTH
Günther
« Last Edit: February 22, 2013, 07:16:21 am by g.makulik »
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

Konrad Wieland

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: Code Generation for SPS
« Reply #10 on: February 23, 2013, 01:38:08 am »
Mr. Sanders,

at LieberLieber we do a lot of stuff with generating code out of state-mashines and activity diagrams - especially with customized solutions. We have recently developed an own Embedded C-Code Generator for Enterprise Architect, which also produces no object-oriented code.

If you are intereseted in support for SPS generation or for an own solution please contact me under [email protected]
« Last Edit: February 23, 2013, 01:40:20 am by konradw »