Topic
  • 5 replies
  • Latest Post - ‏2013-12-30T14:22:29Z by PR2F_Olivier_CASSE
PR2F_Olivier_CASSE
PR2F_Olivier_CASSE
8 Posts

Pinned topic Action Language / SysML - Rhapsody 8.05

‏2013-12-20T06:53:54Z |

Hello,

 

I'm trying to achieve a basic example where 2 blocks own a STM, each one receiving/sending signals for communicating

HELP does mention:

===============================================

Special statechart operations

The action language provides a number of special statechart-related operations that you can call.

Event-related operations

To generate a specific event, use the event name followed by parentheses, for example:


doorOpened()
alarmSounded()

======================================================================

in the action field of a transition, using CTRL+SPACE lists my events, selecting one will give the following error:

The syntax appears to be incomplete. Check if any characters are missing.

I tried to enter the event go() or go(); or GEN(go()), nothing Ok so far...

I put a picture below, hope it's readable

thank you for any hint!

Olivier

Attachments

  • AE91_SHINJI_KANAI
    AE91_SHINJI_KANAI
    198 Posts
    ACCEPTED ANSWER

    Re: Action Language / SysML - Rhapsody 8.05

    ‏2013-12-24T04:41:01Z  

    Hello,

    HELP can be written better... Anyway, what's missing in your code is "target" (e.g. itsSub1.go(); )

    Purpose Rhapsody Action Language C++
    Check if "MyClass" is in state "S" MyClass.isln(S) MyClass->IS_IN(S)
    Send an Event "ev" with argument "x" to "target" target.ev(x) target->GEN(ev(x))
    Send an Event "ev" with argument "x" via port "p" p.ev(x) OUT_PORT(p)->GEN(ev(x))
    Access "x" on the "current Event" currentEvent.x params->x
    Check if current event was accepted via port "p" currentEvent.acceptedThroughPort(p) IS_PORT(p)
    Check if current Event is of type "ev" currentEvent.isTypeOf(ev) currentEvent.IS_EVENT_TYPE_OF(ev_id)
    start the behavior of an instance "x" x.startBehavior() x->startBehavior()


    Additional Information:
    (1) Check out "Leveraging new OMG Action Language for Foundational UML" video from here
    (2) Check out samples under ..\Samples\SystemSamples\ActionLanguage, hopefully it will clarify a lot.
    (3) ALF spec from OMG (http://www.omg.org/spec/ALF/)

    Hope it will be of any help.

    Best Regards,

    --Shinji

  • AE91_SHINJI_KANAI
    AE91_SHINJI_KANAI
    198 Posts
    ACCEPTED ANSWER

    Re: Action Language / SysML - Rhapsody 8.05

    ‏2013-12-30T05:25:49Z  

    Hello,

    after further checking this doesn't work...

    code generation is succesfull but execution crashes

    I put the model there in case somebody could help in fixing the issue

    thanks,

    Olivier

    Hello,

    Your application is crashing with null reference because itsSystem to which you're trying to send "start" event is in fact not instantiated. A quick solution is to add changes indicated by the red-circles in the attached image. Alternatively, simply add the following code in the initialization code of your configuration:

    p_System->getItsSub1()->setItsSystem(p_System);

    From the view point of Sub1, only way to access System block is through association reference named "itsSystem"; direct composition doesn't allow bi-directional referencing. Unlike (direct) composite relationship, associations require you to manually establish a link between two entities by calling set methods properly, which was missing in your original model, thus crashing. The image's approach forces your application to reference its System block via composite relationship named "dummy" as it seems initially designed. In the bottom line, use of Direct Composition and Bi-directional association between two blocks doesn't sound right to me.

    Hope it can be of any help. Best Regards,

    --Shinji
     

    Attachments

  • AE91_SHINJI_KANAI
    AE91_SHINJI_KANAI
    198 Posts

    Re: Action Language / SysML - Rhapsody 8.05

    ‏2013-12-24T04:41:01Z  

    Hello,

    HELP can be written better... Anyway, what's missing in your code is "target" (e.g. itsSub1.go(); )

    Purpose Rhapsody Action Language C++
    Check if "MyClass" is in state "S" MyClass.isln(S) MyClass->IS_IN(S)
    Send an Event "ev" with argument "x" to "target" target.ev(x) target->GEN(ev(x))
    Send an Event "ev" with argument "x" via port "p" p.ev(x) OUT_PORT(p)->GEN(ev(x))
    Access "x" on the "current Event" currentEvent.x params->x
    Check if current event was accepted via port "p" currentEvent.acceptedThroughPort(p) IS_PORT(p)
    Check if current Event is of type "ev" currentEvent.isTypeOf(ev) currentEvent.IS_EVENT_TYPE_OF(ev_id)
    start the behavior of an instance "x" x.startBehavior() x->startBehavior()


    Additional Information:
    (1) Check out "Leveraging new OMG Action Language for Foundational UML" video from here
    (2) Check out samples under ..\Samples\SystemSamples\ActionLanguage, hopefully it will clarify a lot.
    (3) ALF spec from OMG (http://www.omg.org/spec/ALF/)

    Hope it will be of any help.

    Best Regards,

    --Shinji

  • PR2F_Olivier_CASSE
    PR2F_Olivier_CASSE
    8 Posts

    Re: Action Language / SysML - Rhapsody 8.05

    ‏2013-12-24T07:45:50Z  

    Hello,

    HELP can be written better... Anyway, what's missing in your code is "target" (e.g. itsSub1.go(); )

    Purpose Rhapsody Action Language C++
    Check if "MyClass" is in state "S" MyClass.isln(S) MyClass->IS_IN(S)
    Send an Event "ev" with argument "x" to "target" target.ev(x) target->GEN(ev(x))
    Send an Event "ev" with argument "x" via port "p" p.ev(x) OUT_PORT(p)->GEN(ev(x))
    Access "x" on the "current Event" currentEvent.x params->x
    Check if current event was accepted via port "p" currentEvent.acceptedThroughPort(p) IS_PORT(p)
    Check if current Event is of type "ev" currentEvent.isTypeOf(ev) currentEvent.IS_EVENT_TYPE_OF(ev_id)
    start the behavior of an instance "x" x.startBehavior() x->startBehavior()


    Additional Information:
    (1) Check out "Leveraging new OMG Action Language for Foundational UML" video from here
    (2) Check out samples under ..\Samples\SystemSamples\ActionLanguage, hopefully it will clarify a lot.
    (3) ALF spec from OMG (http://www.omg.org/spec/ALF/)

    Hope it will be of any help.

    Best Regards,

    --Shinji

    Hello Shinji,

     

    many thanks for your relevant reply !!

    really a pity the summary table you show here is not included in the help...

    anyway, I can now carry on with my model, and I saw a lot of names in your video link with former colleagues from I-Logix :) (a looong time ago)

    seasons's greetings;

    Olivier

     

  • PR2F_Olivier_CASSE
    PR2F_Olivier_CASSE
    8 Posts

    Re: Action Language / SysML - Rhapsody 8.05

    ‏2013-12-28T07:51:45Z  

    Hello Shinji,

     

    many thanks for your relevant reply !!

    really a pity the summary table you show here is not included in the help...

    anyway, I can now carry on with my model, and I saw a lot of names in your video link with former colleagues from I-Logix :) (a looong time ago)

    seasons's greetings;

    Olivier

     

    Hello,

    after further checking this doesn't work...

    code generation is succesfull but execution crashes

    I put the model there in case somebody could help in fixing the issue

    thanks,

    Olivier

    Attachments

  • AE91_SHINJI_KANAI
    AE91_SHINJI_KANAI
    198 Posts

    Re: Action Language / SysML - Rhapsody 8.05

    ‏2013-12-30T05:25:49Z  

    Hello,

    after further checking this doesn't work...

    code generation is succesfull but execution crashes

    I put the model there in case somebody could help in fixing the issue

    thanks,

    Olivier

    Hello,

    Your application is crashing with null reference because itsSystem to which you're trying to send "start" event is in fact not instantiated. A quick solution is to add changes indicated by the red-circles in the attached image. Alternatively, simply add the following code in the initialization code of your configuration:

    p_System->getItsSub1()->setItsSystem(p_System);

    From the view point of Sub1, only way to access System block is through association reference named "itsSystem"; direct composition doesn't allow bi-directional referencing. Unlike (direct) composite relationship, associations require you to manually establish a link between two entities by calling set methods properly, which was missing in your original model, thus crashing. The image's approach forces your application to reference its System block via composite relationship named "dummy" as it seems initially designed. In the bottom line, use of Direct Composition and Bi-directional association between two blocks doesn't sound right to me.

    Hope it can be of any help. Best Regards,

    --Shinji
     

    Attachments

  • PR2F_Olivier_CASSE
    PR2F_Olivier_CASSE
    8 Posts

    Re: Action Language / SysML - Rhapsody 8.05

    ‏2013-12-30T14:22:29Z  

    Hello,

    Your application is crashing with null reference because itsSystem to which you're trying to send "start" event is in fact not instantiated. A quick solution is to add changes indicated by the red-circles in the attached image. Alternatively, simply add the following code in the initialization code of your configuration:

    p_System->getItsSub1()->setItsSystem(p_System);

    From the view point of Sub1, only way to access System block is through association reference named "itsSystem"; direct composition doesn't allow bi-directional referencing. Unlike (direct) composite relationship, associations require you to manually establish a link between two entities by calling set methods properly, which was missing in your original model, thus crashing. The image's approach forces your application to reference its System block via composite relationship named "dummy" as it seems initially designed. In the bottom line, use of Direct Composition and Bi-directional association between two blocks doesn't sound right to me.

    Hope it can be of any help. Best Regards,

    --Shinji
     

    Hello,

    excellent !

    many thanks, this is clear,

    regards,

    Olivier