13.02.2013 Views

Evaluation Environment for AUTOSAR-Autocode in Motor Control ...

Evaluation Environment for AUTOSAR-Autocode in Motor Control ...

Evaluation Environment for AUTOSAR-Autocode in Motor Control ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.8 Example<br />

them “types” or “ <strong>in</strong>terfaces ”. Additionally, it is not needed to have different names<br />

<strong>for</strong> these packages.<br />

1 <br />

<br />

<br />

<br />

swc root<br />

<br />

<br />

swc1<br />

<br />

10 <br />

pport1<br />

/<strong>in</strong>terfaces/SR Int16<br />

<br />

<br />

rport1<br />

/<strong>in</strong>terfaces/CS str<strong>in</strong>g to <strong>in</strong>t<br />

<br />

<br />

<br />

20 <br />

<br />

<br />

<br />

List<strong>in</strong>g 2.3: Example description of SWC1<br />

To describe the component SWC1, the code of list<strong>in</strong>g 2.3 is used. Here are the two<br />

ports of SWC1 specified. List<strong>in</strong>g 2.4 shows the <strong>in</strong>ternal behavior of SWC1. There are<br />

the runnables and the ports, which are accessed by the runnables, described. This is<br />

needed to generate the API and to provide consistency <strong>for</strong> the communication. The<br />

access is specified with DataSendPo<strong>in</strong>ts and a SynchronousServerCallPo<strong>in</strong>t. Runnable<br />

run11 writes both values to the sender port pport11, whereas run12 only writes the<br />

value <strong>in</strong>tValue1.<br />

The runnables are triggered by the specified tim<strong>in</strong>g events. One runnable can be<br />

triggered by more than one event, but this case is not shown here.<br />

At this po<strong>in</strong>t it can be seen that every part is very flexible handled with references. It<br />

is also permitted to have more than one <strong>in</strong>ternal behavior <strong>for</strong> one Software Component<br />

specified, but just one can be used. This is done by the <strong>in</strong>stantiation of the SWC, which<br />

is part of the system description and not shown here. So it is e.g. possible to reuse a<br />

def<strong>in</strong>ition of a Software Component and reuse it with different <strong>in</strong>ternal behaviors. As<br />

also can be seen <strong>in</strong> the configuration, it is possible <strong>for</strong> an <strong>in</strong>ternal behavior to support<br />

multiple <strong>in</strong>stantiation, which should also not be considered here, because it does not<br />

contribute to the understand<strong>in</strong>g and would just complicate the example.<br />

2.8.2 The Generated Source Code<br />

After call<strong>in</strong>g the RTE generator with that configuration, it should produce the auto<br />

generated part of the RTE. This part conta<strong>in</strong>s the API <strong>for</strong> the SWCs. The <strong>in</strong>terest<strong>in</strong>g<br />

extract <strong>for</strong> SWC1 is shown <strong>in</strong> list<strong>in</strong>g 2.5. In the last two l<strong>in</strong>es the functions <strong>for</strong> the<br />

runnables are declared. These functions are called when a runnable is executed. This<br />

means <strong>for</strong> this example that the functions are called when the tim<strong>in</strong>g events occur. So<br />

19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!