Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 57b66f1c72a1a59ad3cd932fd39a75bd249c8c30 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<!--  generated by featurizer  -->
<p>&rsquo;&rsquo;&rsquo;&rsquo;&rsquo;&rsquo;</p>
<p>&rsquo;&rsquo;&rsquo;<br/> ## room</p>
<pre><code>    ```room
    import room.basic.types.* from &quot;../../../org.eclipse.etrice.modellib.c/model/Types.room&quot;

    ActorClass InternalEndPortExample {
       Structure {
         Port internalEndPort : PSimpleProtocol
         ActorRef actorRef1 : SimpleActorClass1

         // internalEndPort lives &#39;local&#39; 
         // and thus needs a Binding to port of an ActorRef
         Binding internalEndPort and actorRef1.externalPort
       }
       Behavior {
         // send/receive messages from internalEndPorts
       }
    }

    ActorClass Receiver {
         Interface {
          Port sender: PingPongProtocol
         }
         Structure {
          external Port sender
          SAP timing : PTimer
         }
         Behavior {
          StateMachine {
              Transition init: initial -&gt; WaitingForPing { }
              Transition tr0: WaitingForPing -&gt; WaitingForAWhile {
                 triggers {
                   &lt;ping: sender&gt;
                 }
              }
              Transition tr1: WaitingForAWhile -&gt; SentPong {
                 triggers {
                   &lt;timeout: timing&gt;
                 }
              }
              State WaitingForPing
              State SentPong {
                 entry {
                   &quot;sender.pong();&quot;
                 }
              }
              State WaitingForAWhile {
                 entry {
                   &quot;timing.startTimeout(1000);&quot;
                 }
              }
          }
         }
       }

    // eventdriven ProtocolClass (asynchronous message passing, bidirectional)
    eventdriven ProtocolClass ProtocolClassEvt {
       // ProtocolClass ProtocolClassEvt { // same like above because eventdriven is default 
       incoming {
         // incoming means incoming for a regular port and outging for a conjugated port
         Message message1() // message without data
         Message message2(data: int32) // message with simple data
         Message message3(data: DMessageData) // message with complex data (DataClass)

       }
       outgoing {
       // outgoing means outging for a regular port and incoming for a conjugated port
         Message message1(data: int32) // incoming and outgoing Messages can have the same name to enable symmetric protocols
       }
    }

    // DataClass for sending complex data via message
    DataClass DMessageData {
       Attribute SomeData: int16
       Attribute SomeMoreData: int32
    }
    ```

    ## etMap

    ```etmap
    MappingModel PingPongMapping {
       import PingPong_Model.* from &quot;PingPong.room&quot;
       import GenericPhysicalModel.* from &quot;GenericPhysical.etphys&quot;

       Mapping LogSys -&gt; PhysSys1 {
         SubSystemMapping subSystemRef -&gt; nodeRef1 {
          ThreadMapping defaultThread -&gt; PhysicalThread1
         }
       }

    }
    ```

    ## etPhys

    ```etphys
    PhysicalModel GenericPhysicalModel {

       PhysicalSystem PhysSys1 {
         NodeRef nodeRef1 : NodeClass1
       }

       NodeClass NodeClass1 {
         runtime = RuntimeClass1
         priomin = -10
         priomax = 10

         DefaultThread PhysicalThread1 {
          execmode = mixed
          interval = 100ms
          prio = 0
          stacksize = 1024
          msgblocksize = 64
          msgpoolsize = 100
         }
       }

       RuntimeClass RuntimeClass1 {
         model = multiThreaded
       } 

    } 
    ```

    ## config

    ```config
    /*******************************************************************************
     * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
     * All rights reserved. This program and the accompanying materials
     * are made available under the terms of the Eclipse Public License v1.0
     * which accompanies this distribution, and is available at
     * http://www.eclipse.org/legal/epl-v10.html
     * 
     * CONTRIBUTORS:
     *        Thomas Schuetz (initial contribution)
     * 
     *******************************************************************************/
    ConfigModel trafficlight.example.config {

       import TrafficLight_Model.* from &quot;TrafficLight.room&quot;

       ActorInstanceConfig LSTraffic/mainSS/application/pedestrianLight {
         Attr ipConfig{
          Attr IPAddr=&quot;localhost&quot;
          Attr TcpPort=4443
         }
       } 
    }
    ```

    &lt;pre lang=&quot;no-highlight&quot;&gt;&lt;code&gt; 
    ```
    &quot;no highlighting&quot;  /* comment */
    // nop 
    ```

    ```no-highlight
    &quot;no highlighting&quot;  /* comment */
    // nop 
    ```
    &lt;/code&gt;&lt;/pre&gt;

    ```
    &quot;no highlighting&quot;  /* comment */
    // nop 
    ```

    ```no-highlight
    &quot;no highlighting&quot;  /* comment */
    // nop 
    ```

    ## TODO

    Syntax highlighting for other languages like c:       

    ```c
    void etMessageQueue_push(etMessageQueue* self, etMessage* msg){
       /* TODO: optimize queue for concurrent push / pop */
       ET_MSC_LOGGER_SYNC_ENTRY(&quot;etMessageQueue&quot;, &quot;push&quot;)
       if (self-&gt;first == NULL) {
         /*no message in queue*/
         self-&gt;first = self-&gt;last = msg;
       }
       else {
         /*at least one message in queue*/
         self-&gt;last-&gt;next = msg;
         self-&gt;last = msg;
       }
       msg-&gt;next = NULL; /*TODO: optimization: this line could be removed if we assume that all messages are initialized*/

       if (++self-&gt;size &gt; self-&gt;highWaterMark)
         self-&gt;highWaterMark++;

       ET_MSC_LOGGER_SYNC_EXIT
    }
    ```
&#39;&#39;&#39;
</code></pre>

Back to the top