Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic Rhapsody (steve huntington)
Decrease font size
Increase font size
Topic Title: Creating reuseable state charts
Topic Summary:
Created On: 7-Dec-2007 12:26
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 7-Dec-2007 12:26
User is offline View Users Profile Print this message


mike t

Posts: 14
Joined: 7-Dec-2007

In my current project I tried to build a statechart which consists of several substatecharts - some of them reoccur in different locations in the system. As I don't want to draw these substatecharts twice, I am searching for a possiblity to reuse the substatechart I built like a function.

I already tried to put the state chart into a new class but this is a problem because of my event mechanism. (when outsourcing substatecharts to own classes, the events to those state charts would have to be redirected, which is not too easy...)

Maybe there is an easier way of sending the events to different objects without adjusting the receiver manually.


Do you have any suggestions of how i can accomplish that goal?
thanx in advance mike
Report this to a Moderator Report this to a Moderator
 7-Dec-2007 13:28
User is offline View Users Profile Print this message


Kai Dombrowski

Posts: 5
Joined: 15-Aug-2006

Hi!
You should use state hierarchy. Excelent book is "Practical Statecharts in C/C++" of Miro Samek.
Please, go to www.quantum-leaps.com.
Sincerely
Zoltan Gobor
zoltan.gobor@tesbv.com
Report this to a Moderator Report this to a Moderator
 7-Dec-2007 18:28
User is offline View Users Profile Print this message


mike t

Posts: 14
Joined: 7-Dec-2007

Thanx for your fast response.
It would be nice though if you could explain your idea a little bit further. Does Rhapsody support this approach or could you give me maybe a little rhapsody example of your idea.

State hierarchy alone does not the trick for me, because i want to reuse a substatechart in different locations of the project. even in different classes. As i said, i would like to use it like a function.

If i explained myself not clearly please tell me.

thanx,
Mike

Edited: 9-Dec-2007 at 17:06 by mike t
Report this to a Moderator Report this to a Moderator
 11-Dec-2007 11:57
User is offline View Users Profile Print this message


Charlie Lane

Posts: 86
Joined: 16-Sep-2005

Hi Mike,

My understanding is that re-using sub-state-charts in several state machines is not possible in Rhapsody at present, but is a candidate for potential inclusion in the late-2008 release. Because Telelogic may raise its priority if many users want it, I suggest that you submit an enhancement request to ssmdsupport@telelogic.com.

But that won't solve your immediate problem, I realise, though the guys on support may be able to suggest a work-around. Doing a neat equivalent using parts, for example, is difficult because of the semantics of event handling (events handled at the lowest state that can receive them, ISTR). I suspect that you are left with the non-neat option of redirecting events.

Some short-cuts may be possible, depending on your state structure and what states your events need to go to. We have managed some adequate (but still a bit messy) equivalents of re-used sub-state-charts by inherited state charts -- you might like to consider having a base class from which classes inherit the common state machine. (I guess you could put the common parts in an And state in the base class to make it clear what is re-used.)

If you'd like further comments, a simple indication of your state structure, the bits you need to re-use and the events handled would be useful -- if you have an example that you are happy to post here.

Regards, Charlie
Report this to a Moderator Report this to a Moderator
 8-Jan-2008 14:58
User is offline View Users Profile Print this message


mike t

Posts: 14
Joined: 7-Dec-2007

Sorry for my late feedback and thanx for your remarks.
I tried a workaround for my project but its not a very good solution.

I encountered another problem though as i tried to create an activity diagram for an operation. It works fine when i create an activity diagram for a class, but if i call the operation with the activity diagram it is not processed.
Rhapsody does not generate code for the activity diagram in the operation.

Maybe somebody can look at the attached project an tell me where the problem is.
In the project you can see 2 activity diagrams. The one for the class is processed properly the one for the operation is not processed at all!

The project is created with RiC 7.0.

greets and thanx in advance




Edited: 8-Jan-2008 at 22:05 by mike t
Report this to a Moderator Report this to a Moderator
 15-Jan-2008 08:24
User is offline View Users Profile Print this message


Charlie Lane

Posts: 86
Joined: 16-Sep-2005

Hi Mike, I see you have had no responses in a week, and this one isn't very helpful, I'm afraid.
I don't have a utility for opening rar files, so couldn't load your project.
However, I note that in the user manual, under activity diagrams / code generation, it includes the words
In previous releases, Rhapsody supported code generation only from activity diagrams associated with classes, not from activity diagrams associated with operations or use cases.
Rhapsody in C++ generates functor-based code for activity diagrams associated with operations. ...

This might imply that for Rhapsody in C it still doesn't generate code for activity diagrams in operations -- I suggest that you consult the helpdesk about this.
Regards, Charlie
Report this to a Moderator Report this to a Moderator
 15-Jan-2008 18:59
User is offline View Users Profile Print this message


mike t

Posts: 14
Joined: 7-Dec-2007

Thanx for your response. I already contacted the support desk and they told me to use flow charts.

If you're using RiC then you need to use Flow charts instead of Activity diagrams. You will see the contents of flowcharts generated in the implementation file. With Flow charts you do not have to set any properties to generate implementation code.


however it does not work with flow charts either.
I attached the RiC projct as a .zip file this time. Would be nice if you have the time and see if you find any mistake on my side. If not, lets hope they integrate this feature in a new version of rhapsody.
regards, mike




Edited: 15-Jan-2008 at 19:00 by mike t
Report this to a Moderator Report this to a Moderator
 16-Jan-2008 15:36
User is offline View Users Profile Print this message


Charlie Lane

Posts: 86
Joined: 16-Sep-2005

Hi Mike,
I did as per the suggestion from support, i.e. changed the activity diagrams into flowcharts, then regenerated. It seems to show the actions in the flowchart OK. Model attached. What wasn't working for you?
Regards, Charlie


Report this to a Moderator Report this to a Moderator
 16-Jan-2008 21:55
User is offline View Users Profile Print this message


mike t

Posts: 14
Joined: 7-Dec-2007

Well.. perfect
Your answer was 100% helpful. My problem was/is, that i am using Rhapsody7.0 and in this version the flow chart approach does not work.

If i use the current version of RiC it works just fine.

Thanx for your help. You saved me a lot of time

thanx good bye Mike
Report this to a Moderator Report this to a Moderator
 16-Jan-2008 22:09
User is offline View Users Profile Print this message


Michael Lettner

Posts: 16
Joined: 7-Dec-2007

Hm...just out of curiousity:

"Flowcharts" are not an official part of UML, are they? I thought they were more or less replaced by ActivityDiagrams. Therefore I think this solution might work, but is probably not the cleanest one!?

So if my conclusions are right - are Flowcharts the only way to model operations in RiC - or can anybody think of other ways (ideally, it should support modeling events inside operations, same as if statecharts could be used to model operations).

Thanks,
Michael
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic Rhapsody forum.
There are currently 0 users logged in.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.