Book a Demo

Author Topic: Is it possible to generate code from communication/colloboration diagram?  (Read 7567 times)

Rishith

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Hello,

I knew that it is possible to generate code from State machine, activity and sequence diagrams. But, is there any possibility to generate code from communication diagram?

Thank you

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Is it possible to generate code from communication/colloboration diagram?
« Reply #1 on: November 11, 2016, 07:20:57 am »
What kind of code should that be? Are you really trying to program graphically? We dreamed of that in the early 90s. Nobody is seriously after that. Code is up to now simply the best choice.

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Is it possible to generate code from communication/colloboration diagram?
« Reply #2 on: November 11, 2016, 08:44:16 am »
No, a communication diagram doesn't provide sufficient information to generate meaningful code.

Rishith

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Is it possible to generate code from communication/colloboration diagram?
« Reply #3 on: November 11, 2016, 08:21:20 pm »
Thaks for your answers,

If i want to communicate between 5 controllers using Control area network (CAN) communication, What diagrams i have to use? Is it better to model
CAN communication using state diagrams or Sequence diagrams? If there are any materials for CAN communication using uml or sysml models, please provide me. It will help me a lot.

Thank you

PeterHeintz

  • EA Practitioner
  • ***
  • Posts: 1001
  • Karma: +59/-18
    • View Profile
Re: Is it possible to generate code from communication/colloboration diagram?
« Reply #4 on: November 11, 2016, 08:42:10 pm »
To relativize the statement of querty a bit, yes graphical programming is state of the art and sometimes very useful, but only when focusing on data flows typically used when controlling some kind of processes. There are several IEC 61131 tools available, other tools are Matlab/Simulink, Ascet,.. (can all be regarded as domain specific graphical languages).

For general purpose stuff using UML tools for requirements, architecture and not so much detailed design, works fine for me. UML is a set of specification languages, is not and presumably will never be a graphical programming language.

Yes you can generate some code fragments from UML and I know there are people still trying to use UML as a programming language. However in my opinion this is just nonsense and I know several people which came to the same conclusion after trying for a while.

Regarding you CAN controller question, what modelling language to use, depends on what behavior you are focusing on. If you want to focus on CAN messages using the sequence diagram sounds reasonable. If you want to focus on something else state machines or activities might be useful.
Best regards,

Peter Heintz

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Is it possible to generate code from communication/colloboration diagram?
« Reply #5 on: November 11, 2016, 09:28:27 pm »
I go with Peter. When you are in real time programming, you should likely focus in state machines. I guess this one of the few niches, where meaningful code can be created from a graphical model. Synching code and model is still a challenge, though!

q.

Rishith

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Is it possible to generate code from communication/colloboration diagram?
« Reply #6 on: November 15, 2016, 07:29:12 pm »
Hello,

I want to simulate an Elevator system. It consists of 5 control units(hall control, motor control, Drive control and 2 Car controls). So, i have modeled this 5 control units using UML(State charts). Now my job is to establish communication between this 5 control units using CAN communication and make controlls send and receive commands with each other. And later generate code from the diagram and use this code for simulation in MATLAB/Simulink. So for this purpose i want to model a diagram (state chart or sequence ) and later generate code. If there is any way to do this please let me know.

Thank you

Note: I have posted this because it will give you a clear understanding of why i want to use CAN communication and code generation and also helps you to answer me if there is any possibilty. But, its not my intention to repeat the question.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile

Rishith

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Is it possible to generate code from communication/colloboration diagram?
« Reply #8 on: November 15, 2016, 10:12:02 pm »
Hello,

Yes i have visited and tried to generate the code using examples. But, in my case i am not sure wheather it is possible to model the CAN communication for the controllers using state or sequence diagrams. I didnt found any example or papers which define the CAN communication between controllers.  As the previous posts and some other OMG manuals says (The UML, a visual modeling language, is not intended to be a visual programming language, in the sense of having all the necessary visual and semantic support to replace programming languages. The UML is a language for visualizing, specifying, constructing, and documenting the artifacts of a software-intensive system, but it does draw the line as you move toward code). So, i am trying to find a way to model the CAN communication between controllers if possible or to do the same using simulink if not possible. So, I want to know for sure

is it possible to model a diagram for CAN communication between controllers using UML diagrams? If so How?

Thank you


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Is it possible to generate code from communication/colloboration diagram?
« Reply #9 on: November 16, 2016, 12:19:42 am »
Sure you can model CAN communication with UML. I'd use SysML to model the CAN bus and how information is interchanged. It's unlikely that you can get a receipt here how to do this.

q.

Rishith

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Is it possible to generate code from communication/colloboration diagram?
« Reply #10 on: November 16, 2016, 12:59:28 am »
Thanks for information. Now i will try to model CAN communication with SysML.

Thank you,