Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.etrice.doc/html/etrice-docse5.html')
-rw-r--r--plugins/org.eclipse.etrice.doc/html/etrice-docse5.html170
1 files changed, 161 insertions, 9 deletions
diff --git a/plugins/org.eclipse.etrice.doc/html/etrice-docse5.html b/plugins/org.eclipse.etrice.doc/html/etrice-docse5.html
index 11a411586..d65fed437 100644
--- a/plugins/org.eclipse.etrice.doc/html/etrice-docse5.html
+++ b/plugins/org.eclipse.etrice.doc/html/etrice-docse5.html
@@ -4,24 +4,128 @@
<!--http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd-->
<html xmlns="http://www.w3.org/1999/xhtml"
>
-<head><title>Create a state machine</title>
+<head><title>Tutorial HelloWorld for Java</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<!-- xhtml,3,next,html -->
<meta name="src" content="etrice-doc.tex" />
-<meta name="date" content="2013-06-13 15:30:00" />
+<meta name="date" content="2013-06-14 00:19:00" />
<link rel="stylesheet" type="text/css" href="etrice-doc.css" />
</head><body
>
-<!--l. 78--><div class="crosslinks"><p class="noindent">[<a
+<!--l. 1--><div class="crosslinks"><p class="noindent">[<a
href="etrice-docse6.html" >next</a>] [<a
href="etrice-docse4.html" >prev</a>] [<a
href="etrice-docse4.html#tailetrice-docse4.html" >prev-tail</a>] [<a
href="#tailetrice-docse5.html">tail</a>] [<a
-href="etrice-docch5.html#etrice-docse5.html" >up</a>] </p></div>
-<h3 class="sectionHead"><span class="titlemark">5.3 </span> <a
- id="x12-310005.3"></a>Create a state machine</h3>
+href="etrice-docch2.html#etrice-docse5.html" >up</a>] </p></div>
+<h3 class="sectionHead"><span class="titlemark">2.3 </span> <a
+ id="x9-280002.3"></a>Tutorial HelloWorld for Java</h3>
+<!--l. 3--><p class="noindent" >
+</p>
+<h4 class="subsectionHead"><span class="titlemark">2.3.1 </span> <a
+ id="x9-290002.3.1"></a>Scope</h4>
+<!--l. 5--><p class="noindent" >In this tutorial you will build your first very simple eTrice model. The goal is to learn the work
+flow of eTrice and to understand a few basic features of ROOM. You will perform the following
+steps:
+</p><!--l. 8--><p class="noindent" >
+ </p><ol class="enumerate1" >
+ <li
+ class="enumerate" id="x9-29002x1">create a new model from scratch
+ </li>
+ <li
+ class="enumerate" id="x9-29004x2">add a very simple state machine to an actor
+ </li>
+ <li
+ class="enumerate" id="x9-29006x3">generate the source code
+ </li>
+ <li
+ class="enumerate" id="x9-29008x4">run the model
+ </li>
+ <li
+ class="enumerate" id="x9-29010x5">open the message sequence chart</li></ol>
+<!--l. 16--><p class="noindent" >Make sure that you have set up the workspace as described in <span
+class="ec-lmsso-10">Setting up the workspace</span>.
+</p><!--l. 18--><p class="noindent" >
+</p>
+<h4 class="subsectionHead"><span class="titlemark">2.3.2 </span> <a
+ id="x9-300002.3.2"></a>Create a new model from scratch</h4>
+<!--l. 20--><p class="noindent" >The easiest way to create a new eTrice Project is to use the eclipse project wizard. From the eclipse file menu
+select <span
+class="ec-lmssbx-10">File-&#x003E;New-&#x003E;Project </span>and create a new eTrice project and name it <span
+class="ec-lmssbx-10">HelloWorld</span>.
+</p><!--l. 23--><p class="noindent" ><img
+src="images/015-HelloWorld10.png" alt="PIC"
+ />
+</p><!--l. 26--><p class="noindent" >The wizard creates everything that is needed to create, build and run an eTrice model. The resulting project
+should look like this:
+</p><!--l. 29--><p class="noindent" ><img
+src="images/015-HelloWorld11.png" alt="PIC"
+ />
+</p><!--l. 32--><p class="noindent" >Within the model directory the model file <span
+class="ec-lmsso-10">HelloWorld.room </span>was created. Open the <span
+class="ec-lmsso-10">HelloWorld.room </span>file
+and delete the contents of the file. Open the content assist with Ctrl+Space and select <span
+class="ec-lmsso-10">model</span>
+<span
+class="ec-lmsso-10">skeleton</span>.
+</p><!--l. 36--><p class="noindent" ><img
+src="images/015-HelloWorld12.png" alt="PIC"
+ />
+
+
+</p><!--l. 39--><p class="noindent" >Edit the template variables by typing the new names and jumping with Tab from name to name.
+</p><!--l. 41--><p class="noindent" >The resulting model code should look like this:
+
+
+</p>
+<div class="verbatim" id="verbatim-1">
+RoomModel&#x00A0;HelloWorld&#x00A0;{
+&#x00A0;<br />
+&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;LogicalSystem&#x00A0;System_HelloWorld&#x00A0;{
+&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;SubSystemRef&#x00A0;subsystem&#x00A0;:&#x00A0;SubSystem_HelloWorld
+&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;}
+&#x00A0;<br />
+&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;SubSystemClass&#x00A0;SubSystem_HelloWorld&#x00A0;{
+&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;ActorRef&#x00A0;application&#x00A0;:&#x00A0;HelloWorldTop
+&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;}
+&#x00A0;<br />
+&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;ActorClass&#x00A0;HelloWorldTop&#x00A0;{
+&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;}
+&#x00A0;<br />}
+</div>
+<!--l. 57--><p class="nopar" >
+</p><!--l. 59--><p class="noindent" >The goal of eTrice is to describe distributed systems on a logical level. In the current version not all
+elements will be used. But as prerequisite for further versions the following elements can be defined:
+</p>
+ <ul class="itemize1">
+ <li class="itemize">the <span
+class="ec-lmsso-10">LogicalSystem </span>(currently optional)
+ </li>
+ <li class="itemize">at least one <span
+class="ec-lmsso-10">SubSystemClass </span>(mandatory)
+ </li>
+ <li class="itemize">at least one <span
+class="ec-lmsso-10">ActorClass </span>(mandatory)</li></ul>
+<!--l. 67--><p class="noindent" >The <span
+class="ec-lmsso-10">LogicalSystem </span>represents the complete distributed system and contains at least one <span
+class="ec-lmsso-10">SubSystemRef</span>. The
+<span
+class="ec-lmsso-10">SubSystemClass </span>represents an address space and contains at least one <span
+class="ec-lmsso-10">ActorRef</span>. The <span
+class="ec-lmsso-10">ActorClass </span>is the
+building block of which an application will be built of. It is in general a good idea to define a top level actor
+that can be used as reference within the subsystem.
+</p><!--l. 72--><p class="noindent" >The outline view of the textual ROOM editor shows the main modeling elements in an easy to navigate
+tree.
+</p><!--l. 74--><p class="noindent" ><img
+src="images/015-HelloWorld02.png" alt="PIC"
+ />
+</p><!--l. 78--><p class="noindent" >
+</p>
+<h4 class="subsectionHead"><span class="titlemark">2.3.3 </span> <a
+ id="x9-310002.3.3"></a>Create a state machine</h4>
<!--l. 80--><p class="noindent" >We will implement the Hello World code on the initial transition of the <span
class="ec-lmsso-10">HelloWorldTop </span>actor. Therefore open
the state machine editor by right clicking the <span
@@ -58,15 +162,63 @@ diagram.
</p><!--l. 105--><p class="noindent" ><img
src="images/015-HelloWorld05.png" alt="PIC"
/>
+</p><!--l. 109--><p class="noindent" >
+</p>
+<h4 class="subsectionHead"><span class="titlemark">2.3.4 </span> <a
+ id="x9-320002.3.4"></a>Build and run the model</h4>
+<!--l. 111--><p class="noindent" >Now the model is finished and source code can be generated. The project wizard has created a launch
+configuration that is responsible for generating the source code. From <span
+class="ec-lmsso-10">HelloWorld/ </span>right click
+<span
+class="ec-lmssbx-10">gen_HelloWorld.launch </span>and run it as gen_HelloWorld. All model files in the model directory will be
+generated.
+</p><!--l. 116--><p class="noindent" ><img
+src="images/015-HelloWorld06.png" alt="PIC"
+ />
+</p><!--l. 119--><p class="noindent" >The code will be generated to the src-gen directory. The main function will be contained in
+<span
+class="ec-lmssbx-10">SubSystem_HelloWorldRunner.java</span>. Select this file and run it as Java application.
+</p><!--l. 122--><p class="noindent" ><img
+src="images/015-HelloWorld07.png" alt="PIC"
+ />
+</p><!--l. 126--><p class="noindent" >The Hello World application starts and the string will be printed on the console window. To stop the
+application the user must type <span
+class="ec-lmssbx-10">quit </span>in the console window.
+</p><!--l. 129--><p class="noindent" ><img
+src="images/015-HelloWorld08.png" alt="PIC"
+ />
+</p><!--l. 132--><p class="noindent" >
+</p>
+<h4 class="subsectionHead"><span class="titlemark">2.3.5 </span> <a
+ id="x9-330002.3.5"></a>Open the Message Sequence Chart</h4>
+<!--l. 134--><p class="noindent" >During runtime the application produced a MSC and wrote it to a file. Open
+HelloWorld/tmp/log/SubSystem_HelloWorld_Async.seq using Trace2UML (it is open source and can be
+obtained from http://trace2uml.tigris.org/). You should see something like this:
+</p><!--l. 138--><p class="noindent" ><img
+src="images/015-HelloWorld09.png" alt="PIC"
+ />
+</p><!--l. 142--><p class="noindent" >
+</p>
+<h4 class="subsectionHead"><span class="titlemark">2.3.6 </span> <a
+ id="x9-340002.3.6"></a>Summary</h4>
+<!--l. 144--><p class="noindent" >Now you have generated your first eTrice model from scratch. You can switch between diagram editor and
+model (.room file) and you can see what will be generated during editing and saving the diagram files. You
+should take a look at the generated source files to understand how the state machine is generated and the life
+cycle of the application. The next tutorials will deal with more complex hierarchies in structure and
+behavior.
+
+
+
+
</p>
-<!--l. 109--><div class="crosslinks"><p class="noindent">[<a
+<!--l. 1--><div class="crosslinks"><p class="noindent">[<a
href="etrice-docse6.html" >next</a>] [<a
href="etrice-docse4.html" >prev</a>] [<a
href="etrice-docse4.html#tailetrice-docse4.html" >prev-tail</a>] [<a
href="etrice-docse5.html" >front</a>] [<a
-href="etrice-docch5.html#etrice-docse5.html" >up</a>] </p></div>
-<!--l. 109--><p class="noindent" ><a
+href="etrice-docch2.html#etrice-docse5.html" >up</a>] </p></div>
+<!--l. 1--><p class="noindent" ><a
id="tailetrice-docse5.html"></a> </p>
</body></html>

Back to the top