Engineering System Design

Engineering System Design

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  Defining abstract blocks

    Posted yesterday

    Hello all, 

    does anybody know how I can define an abstract block in Rhapsody? According to SysML specification (1.6, 1.5) this should be possible with an <<abstract>> stereotype that sets the classifier isAbstract to one (internally). This should have some consequence like I cannot instantiate a block e.g. 

    Anyhow I can't find a corresponding checkbox in Rhapsody neither in sysML nor in UML project. If I remember right in former times it was available as "Is Abstract", but not sure.

    Is this renamed now to the "Instantiation" checkbox in the features dialog? Also could not really find much information about the meanings of those checkboxes. IBM documentation is not that exhaustive on such topics (or I did not search careful enough). 

    Best regards

    Robert



    ------------------------------
    Robert Fromm
    ------------------------------


  • 2.  RE: Defining abstract blocks

    Posted 4 hours ago

    I remember I looked into this issue a while ago, I think the only "solution" I found to make the text in the class/block in italics per the UML spec:

    Was the use a generalization in add an operation to the abstract class like this,  and even then I only got it to work for an interface class:

    Then you can hide the operation afterwards and then your interface class looks like an abstract class.



    ------------------------------
    Markus Nordstrand
    ------------------------------



  • 3.  RE: Defining abstract blocks

    Posted 4 hours ago

    Hello Markus,

    I got today the confirmation from IBM (a ticket was opened) that Rhapsody does not really support abstract classes in SysML. (It depends on the language that is chosen.)

    In C++ it's almost ok. You can define in a block two virtual operations, which is OK for C++, as they do the same. Indeed, as Rpy seems to not set the isAbstract flag (as defined in SysML/UML), it cannot be prevented, that the class is instantiated directly. I would expect this leads then to a compiler error for the generated code.

    In Java abstract classes are known, so here we would need an abstract class in SysML.

    What I did is, I created an abstract stereotype, use it in the block and define only virtual function.

    Indeed Rhapsody allows to directly create e.g. parts of such classes, which I don't like.



    ------------------------------
    Robert Fromm
    ------------------------------



  • 4.  RE: Defining abstract blocks

    Posted 4 hours ago

    Hi Robert - Rhapsody uses C++ to generate the code for systems models. A class becomes abstract in C++ when it contains at least one pure virtual function.

    So if the Block contains an Operation which has been marked as Abstract (on the General tab) then theat Block is automatically abstract. You can add a stereotype/formatting to make it more visually clear.



    ------------------------------
    Andy Lapping
    Technical Fellow
    Sodius Willert
    Cwmbran
    ------------------------------