Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - YannM

Pages: [1] 2
1
General Board / C++ generated code for executable STM
« on: April 02, 2021, 02:59:42 am »
Hi all,

I'm currently successfully generating C++ code for a state machine designed in EA 15.2.
However this state machine so far steps from state to state without doing much.

I would like that each state calls a function defined in an interface.

So far I designed in EA:

[Class A] --Dependency--> [Class B : realizing the interface] --Realization--> Interface

with Class A calling function from the class B, and class A being the parent of the state machine diagram.

Automatic generation fails when compiling because classB is not instanciated.

I must explicitly instantiate manually the object in class A in order to make it work. What is not the aim of the experiment, where I want to generate, compile, and simulate the generated code without manual intervention.

Any idea if this can be achieved and how shall I declare the different objects to make it work ?

Thanks a lot for your time reading this point.

2
Hi Uffe,

I don't get your point with the transition which has a constraint type Time (specification value can be set to the wait time, eg "10s") and a guard "Timeout".
I never succeeded using the constraint Time ... it has no effect in my State Machine.

To solve my issues I use two events from a state, one is triggered when the timeout is expired, the other one is for the proper event awaited.
However the "timeout" delay can never be simulated in EA.

3
General Board / Executable States machine - files generation
« on: November 30, 2020, 09:33:12 pm »
Hi all,
When EA generates C files from an executable STM the following files :
  • ConsoleManager.c / ConsoleManager.h
  • ContextManager.c / ContextManager.h
  • SimulationManager.c / SimulationManager.h
  • StmCommonForwardDeclaration.h
  • STM.c / STM.h
Is it possible to create an additional header file containing data that will be generated from EA  ?

For example I would like that the enum of the states is in this particular file, that will be included in ContextManager.h.

Best regards,


4
So far I am manually generating C code from a state machine described in C.
The generated code is copied by the EA build scripts in a specific place in order to be compiled with other source code.
Then all the source code is compiled on a Jenkins server.

I would like to have a way to launch the C code generation from a script in order to bypass the manual action in EA.
Thus my Jenkins server could automatically open, generate code from EA.
The whole compilation of my project could be automatically done on a periodic basis.

I don't know if that clarify my question  ;)



5
Hi all,

I hope you are doing well  ;D

I read here https://sparxsystems.com/enterprise_architect_user_guide/15.2/automation/theautomationinterface.html the following
Quote
The Automation Interface provides a way of accessing the internals of Enterprise Architect models. Examples of things you can do using the Automation Interface include:

[...]
Generate code from a StateMachine diagram
[...]

Does it mean I could have a service - let's say Jenkins - calling a script which opens a *.eapx file and executes what is necessary to generate code from a State Machine ?
Where could I find more information on this ?

Thanks

Yann

6
Thanks, it works this way but the feature "Relationship Matrix" does not work with such a trick.

I succeeded by clicking & dropping a trigger then creating a "Realization" link with the requirement.
This way I can create "Relationship Matrix" with Type "State" or "Trigger".

Thanks for the support.

7
Yes I could not find the quicklinker menu but I succeeded by creating the link with the toolbox and Realization item.
This is not convenient at all, but it does the job.

I have one last question regarding the Realization link:
a state from a State Machine can have a link "Realization" with a requirement, but it seems no way to have the same kind of link for a transition between state.
Is that right ?
Or do I need to have a specific access to create a "Realization" link between a transition and a requirement ?

8
OK thanks.

Here is a screenshot of the video.
https://ibb.co/rxmGn9z
It might be useful to understand what I'm trying to do.

So what is not working is repeting with several requirements to create a "Realization" link with states of a state machine.
Only the first one is working.

9
I can't figure out how to add an image on the message.
Thus it is difficult to explain what the video contains !

10
I'm doing what is presented here
https://www.sparxsystems.fr/resources/demos/DOORS/doors_EA_integration.htm

but not with use cases but with state machine.

I have no issues creating several "Realization" links between requirements and Activities in a Use Case.

11
Hi,

My project (under EA13.5) contains a state machine with different states and requirements imported from DOORS.
I can select and drop any requirements as Instance (Object) or Link.

After selecting and dropping the first requirement as Link I can create a "Realization" link between a state and this new created object.
Following selecting and dropping actions do not propose this "Realization" link - choice is limited to Dependency, Trace or Information Flow.

Using selecting and dropping the requirement as Instance (Object) does not allow to create "Realization" link either.

How can I do to have several "Realization" links in the same state machine ?

Thanks for your support.

12
General Board / Add manually options for generating C code
« on: March 03, 2020, 06:59:07 pm »
Hi,

Is it possible to manually add options in EA13.5 > Configure > Options > Source Code Engineering > C ?

I would like to add an option as genOptStmCGenerateTrace  related to Generate Trace Code for example.



13
General Board / Re: Issue while code generation in C
« on: February 07, 2020, 06:28:02 pm »
Hi,

I checked the templates until "Class Body Impl" that has this code.
Quote
%if genOptStmCUseNewTemplate == "T" and stmContextHasStatemachine == "T"%
/* Begin - EA generated code for StateMachine */
\n
%StmContextDefinitionImpl%
\n
/* End - EA generated code for StateMachine */

I have no idea where I can find the code executed for StmContextDefinitionImpl. Any idea where I can find this ?

14
General Board / Re: Issue while code generation in C
« on: February 06, 2020, 11:06:09 pm »
For those interested, part of the solution is to change Configure > Model > Options > C > Object Oriented Support from False to True.

However the automatic conversion of this.variableName to this->variableName does not work! May be another option to change somewhere ?

Quote
Enterprise Architect's Executable StateMachine supports simulation for C, C++, C#, Java and JavaScript.
For C and C++, the syntax differs from C#, Java and JavaScript in accessing the context's member variables. C and C++
use the pointer '->' while the others simply use '.'; however, you can always use this.variableName to access the
variables. Enterprise Architect will translate it to this->variableName for C and C++.
So for all languages, simply use this format for the simulation:
this.variableName

15
General Board / Re: Issue while code generation in C
« on: February 05, 2020, 09:04:16 pm »

This is the explanation we can find in user guide "Executable StateMachines" from Sparx
Quote
Access Context's member variable from State behavior and Transition Effect
Enterprise Architect's Executable StateMachine supports simulation for C, C++, C#, Java and JavaScript.
For C and C++, the syntax differs from C#, Java and JavaScript in accessing the context's member variables. C and C++
use the pointer '->' while the others simply use '.'; however, you can always use this.variableName to access the
variables. Enterprise Architect will translate it to this->variableName for C and C++.
So for all languages, simply use this format for the simulation:
this.variableName

Examples:
In the transition's effect:
   this.authorizeCnt++;
In some state's entry, do or exit behavior:
   this.foo += this.bar;
Note: by default Enterprise Architect is only replacing 'this->' with 'this' for C and C++; For example:
   this.foo = this.bar + myObject.iCount + myPointer->iCount;
will be translated to:
   this->foo = this->bar + myObject.iCount + myPointer->iCount;


However the attribute variableName when declared in the class, will be "generated" in C as a local variable.
Thus the use of this.variableName (automatically generated) is obviously an error for the compiler.

How can I solve the issue ?

Try example Executable State Machine > Simulation Commands from Sparx: C code is generated, but can not be compiled.

Pages: [1] 2