Topic
  • 3 replies
  • Latest Post - ‏2013-08-20T09:36:45Z by myrmidon
Manjetzger
Manjetzger
2 Posts

Pinned topic Console Application

‏2013-07-29T11:10:16Z |

Hey Guys,

i want to create a simple statemachine in Rhapsody. The statemachine shall output a simple text in the console.

My project has a statechart and every state shall output a text.

I can compile the project (c++ language) and get an executable. When i start this executable no output text appears in the console window.

What's wrong with this project and which things are missing.

The picture shows my statechart with the different output syntax i tried.

 

Manjetzger

Attachments

Updated on 2013-07-29T11:45:10Z at 2013-07-29T11:45:10Z by Manjetzger
  • shanz9903
    shanz9903
    306 Posts

    Re: Console Application

    ‏2013-07-29T13:42:20Z  

    My guess is that the statechart isn't even running.

    Can you prove it is running using animation?

    NB: The most likely problem is a lack of a call to startBehavior().

    Updated on 2013-07-29T13:53:45Z at 2013-07-29T13:53:45Z by shanz9903
  • Manjetzger
    Manjetzger
    2 Posts

    Re: Console Application

    ‏2013-07-30T07:45:16Z  
    • shanz9903
    • ‏2013-07-29T13:42:20Z

    My guess is that the statechart isn't even running.

    Can you prove it is running using animation?

    NB: The most likely problem is a lack of a call to startBehavior().

    When i press the generate/make/run button, i get no errors and the console opens for a moment.

    No animation bar appears in Rhapsody.

    The call startBehavior() isn't missing in the MainDefaultComponent.cpp

    That's my MainDefaultDomponent.cpp

    #include "MainDefaultComponent.h"
    //## auto_generated
    #include "Lauflicht.h"
    int main(int argc, char* argv[]) {
        int status = 0;
        if(OXF::initialize(argc, argv, 6423))
            {
                Lauflicht * p_Lauflicht;
                p_Lauflicht = new Lauflicht;
                p_Lauflicht->startBehavior();
                //#[ configuration DefaultComponent::DefaultConfig
                //#]
                OXF::start();
                delete p_Lauflicht;
                status = 0;
            }
        else
            {
                status = 1;
            }
        return status;
    }

     

  • myrmidon
    myrmidon
    23 Posts

    Re: Console Application

    ‏2013-08-20T09:36:45Z  

    When i press the generate/make/run button, i get no errors and the console opens for a moment.

    No animation bar appears in Rhapsody.

    The call startBehavior() isn't missing in the MainDefaultComponent.cpp

    That's my MainDefaultDomponent.cpp

    #include "MainDefaultComponent.h"
    //## auto_generated
    #include "Lauflicht.h"
    int main(int argc, char* argv[]) {
        int status = 0;
        if(OXF::initialize(argc, argv, 6423))
            {
                Lauflicht * p_Lauflicht;
                p_Lauflicht = new Lauflicht;
                p_Lauflicht->startBehavior();
                //#[ configuration DefaultComponent::DefaultConfig
                //#]
                OXF::start();
                delete p_Lauflicht;
                status = 0;
            }
        else
            {
                status = 1;
            }
        return status;
    }

     

    Hello

     Normally if you run it it executes and closes immediately so you cannot see something.. I do not know exactly what you do to animate the statechart.

    Normally after you Generate/Make/Run you should

    1.click the GoIdle button (it is next to Go) then

    2.go to Tools> Animate Statechart and choose your statechart

    3.the animated statechart will open you can set a breakpoint for example on a state (right click add breakpot)

    4. then click Go ad normall it should execurte...

    If you have done all thes ignore my reply :)

    Cheers