-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasic-01.xml
89 lines (76 loc) · 2.91 KB
/
basic-01.xml
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
<?xml version="1.0"?>
<Graphs xmlns="https://poets-project.org/schemas/virtual-graph-schema-v2">
<GraphType id="test">
<Documentation>PSIM Test</Documentation>
<MetaData>"native_dimension":2</MetaData>
<Properties/>
<SharedCode>
<![CDATA[
]]>
</SharedCode>
<MessageTypes>
<MessageType id="__init__">
<Documentation>Initialize state</Documentation>
</MessageType>
<MessageType id="message">
<Documentation>Test Message</Documentation>
<Message>
<Scalar type="uint32_t" name="value">
<Documentation>Test Value</Documentation>
</Scalar>
</Message>
</MessageType>
</MessageTypes>
<DeviceTypes>
<!-- Generated Block -->
<DeviceType id="device">
<Properties>
<Scalar name="id" type="uint32_t"></Scalar>
</Properties>
<State>
<Scalar name="counter" type="uint32_t"></Scalar>
</State>
<ReadyToSend>
<![CDATA[
rts = (deviceProperties->id == 0 && deviceState->counter < 10) ? 1 : 0;
]]>
</ReadyToSend>
<InputPin messageTypeId="__init__" name="__init__">
<OnReceive>
<![CDATA[
deviceState->counter = 0;
]]>
</OnReceive>
</InputPin>
<InputPin messageTypeId="message" name="input">
<OnReceive>
<![CDATA[
deviceState->counter++;
handler_log(1, "Received message %d", deviceState->counter);
if (deviceState->counter == 10)
handler_exit(0); // exit successfully
]]>
</OnReceive>
</InputPin>
<OutputPin messageTypeId="message" name="output">
<OnSend>
<![CDATA[
deviceState->counter++;
handler_log(1, "Sending message %d", deviceState->counter);
message->value = deviceState->counter;
]]>
</OnSend>
</OutputPin>
</DeviceType>
</DeviceTypes>
</GraphType>
<GraphInstance id="graph1" graphTypeId="test">
<DeviceInstances>
<DevI id="device0" type="device"><P>"id": 0</P></DevI>
<DevI id="device1" type="device"><P>"id": 1</P></DevI>
</DeviceInstances>
<EdgeInstances>
<EdgeI path="device1:input-device0:output"/>
</EdgeInstances>
</GraphInstance>
</Graphs>