This repository has been archived by the owner on Dec 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
RealTimeCoordination.mo
6347 lines (6026 loc) · 457 KB
/
RealTimeCoordination.mo
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
within RealTimeCoordinationLibrary;
package RealTimeCoordination
"Library Real-Time Coordination is a free Modelica package providing components to model coordination systems in a convenient way."
package UsersGuide "User's Guide"
extends Modelica.Icons.Information;
package Elements "Elements"
extends Modelica.Icons.Information;
class Message_Mailbox "Message and Mailbox"
extends Modelica.Icons.Information;
annotation (Documentation(info="<!DOCTYPE html>
<html>
<head><title>RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.Messsage_Mailbox</title></head>
<body>
<p>Examples are specified at: "<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.Examples.AsynchronousCommunication\">Examples.AsynchronousCommunication</a>" and "<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.Examples.InteractingComponents\">Examples.InteractingComponents</a>".</p>
<p>We use messages to model asynchronous communication between different state graphs. Message defines the type of asynchronous messages.</p>
<p><img src=\"modelica://RealTimeCoordinationLibrary/Resources/images/message.jpg\" alt =\"\"/></p>
<p>A message has parameters that transfer information from its sender to its receiver. The signature of the message type defines which parameter the message has. The parameters have a call by value semantics. The sender transition binds concrete values to the parameters that can be accessed by the receiver transition. In StateGraph2 models, the defined messages can be used as raise messages by a sender transition. A raise message is a message which is raised when a transition fires. A raise message is sent via the associated output delegation port of the State Graph2 class. This port is connected to an input delegation port which itself has a StateGraph2 model and a receiver mailbox and a receiver transition.</p>
<p><img src=\"modelica://RealTimeCoordinationLibrary/Resources/images/messageExample.jpg\" alt =\"\"/></p>
<p>In StateGraph2 models, we use the messages defined within the receiver input delegation port, mailbox and receiver transition as trigger messages. A trigger message is a message which can enable a transition when it is available and all other required conditions for enabling a transition are true.</p>
<p><img src=\"modelica://RealTimeCoordinationLibrary/Resources/images/triggerMessage.jpg\" alt =\"\"/></p>
<p>The mailbox of the StateGraph2 model stores incoming messages. The mailbox is a FIFO queue. The queue size is determined by the parameter <b>queueSize</b>.</p>
<p>Furthermore, the user must specify how many Integer, Boolean, and Real parameters the messages have. Therefore, the parameters <b>numberofMessageIntegers</b>, <b>numberOfMessageBooleans</b>, and <b>numberOfMessageReals</b> must be set. </p>
<p><img src=\"modelica://RealTimeCoordinationLibrary/Resources/images/mailbox.jpg\" alt =\"\"/> </p>
<p>When a transition uses a message to fire then this message is dispatched and deleted from the mailbox. </p>
<p>For each message only one transition can fire and dispatch the message. Messages have no specified duration of life. This means, they remain in the mailbox until they are dispatched or the mailbox is full. The handling of a mailbox overflow is handled by a assert function. </p>
<p><img src=\"modelica://RealTimeCoordinationLibrary/Resources/images/receive.jpg\" alt =\"\"/></p>
<p>The receiver transition must set the check box <b>use_messageReceive</b>.</p>
<p><img src=\"modelica://RealTimeCoordinationLibrary/Resources/images/transitionReceive.jpg\" alt =\"\"/></p>
</body>
</html>
"));
end Message_Mailbox;
class Synchronization "Synchronization"
extends Modelica.Icons.Information;
annotation (Documentation(info="<!DOCTYPE html>
<html>
<head><title>RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.Synchronization</title></head>
<body>
<p>Examples are specified at: "<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.Examples.Synchronization\">Examples.Synchronization</a>".</p>
<p>A common use case when modeling orthogonal regions is to allow two regions to change their state only in an atomic way. This means either both transitions are allowed to fire or both transition are not allowed to fire. Sending and receiving synchronizations via synchronization channels synchronize the firing of transitions of parallel regions. A synchronization channel has to be specified at a common ancestor state of the parallel regions and serves as the type for the synchronizations using it.</p>
<p><img src=\"modelica://RealTimeCoordinationLibrary/Resources/images/sync.jpg\" alt =\"\"/></p>
<p>Sending a synchronization via the synchronization channel from one <b>sender transition</b> </p>
<p><img src=\"modelica://RealTimeCoordinationLibrary/Resources/images/syncSendDialog.jpg\" alt =\"\"/></p>
<p>to a <b>receiver transition</b> performs a synchronization. We allow only a receiving synchronization or sending synchronization per transition.</p>
<p><img src=\"modelica://RealTimeCoordinationLibrary/Resources/images/syncReceiveDialog.jpg\" alt =\"\"/></p>
<p>A synchronization affects the prioritization and execution order of parallel transitions as described in the following. The sender transition is executed before the receiver transition because a synchronization is directed from sender to receiver. This may violate region priorities when the sender transition is in a region with a lower priority than the region of the receiver transition because without the sending and the receiving of synchronizations between them the transition in the region with the higher priority would be executed first. </p>
</body>
</html>
"));
end Synchronization;
class Transition "Transition"
extends Modelica.Icons.Information;
annotation (Documentation(info="<!DOCTYPE html>
<html>
<head><title>RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.Transition</title></head>
<body>
<p>Examples are specified at: "<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.Examples.Transition\">Examples.Transition</a>".</p>
<p>Transitions of StateGraph2 are used to change the Step (i.e., the state) of a StateGraph2 model. When the Step connected to the input of a Transition is active and the Transition condition becomes true, then the Transition fires. This means that the Step connected to the input to the Transition is deactivated and the Step connected to the output of the Transition is activated. </p>
<p>We changed the transition of StateGraph2 as follows. Instead of <i>delayTransition </i>and<i> waitTime</i> we added the <b>use_after </b>and<b> afterTime </b>parameters. The after time construct differs from the delay time in the original version of the StateGraph2 library in that at least the after time must have expired to let the transition fire. In contrast, the semantics of the delay time is that exactly the after time must have expired in order to let the transition fire. We introduced the after time semantics because it might happen that for two transitions that need to synchronize the time instants in which they are allowed to fire might not match due to their delay time.</p>
<p>We extended the transition of StateGraph2 as follows. We added the parameters <b>use_syncSend</b>,<b> use_syncReceive</b>,<b> use_messageReceive</b>,<b> numberOfMessageIntegers</b>,<b> numberOfMessageBooleans</b>,<b> numberOfMessageReals</b>, and<b> syncChannelName</b>. </p>
<p>We use these parameters to synchronize the firing of parallel transitions as described in "<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.Synchronization\">Synchronization</a>" and to receive asynchronous messages as described in "<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.Message_Mailbox\">Message and Mailbox</a>".</p>
<p><img src=\"modelica://RealTimeCoordinationLibrary/Resources/images/transition.jpg\" alt =\"\"/></p>
</body>
</html>
"));
end Transition;
class Clock "Clock"
extends Modelica.Icons.Information;
annotation (Documentation(info="<!DOCTYPE html>
<html>
<head><title>RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.Clock</title></head>
<body>
<p>Examples are specified at: "<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.Examples.Clock\">Examples.Clock</a>".</p>
<p>A StateGraph2 model has a finite number of clocks. A clock models the elapsing of time during the execution of a system. Time elapses continuously, not in discrete steps. A clock can be reset to zero when it's input port <i>u</i>. The time value represented by a clock is relative to the last point in time when the clock has been reset. </p>
<p><img src=\"modelica://RealTimeCoordinationLibrary/Resources/images/clock.jpg\" alt =\"\"/></p>
</body>
</html>
"));
end Clock;
class Invariant "Invariant"
extends Modelica.Icons.Information;
annotation (Documentation(info="<!DOCTYPE html>
<html>
<head><title>RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.Invariant</title></head>
<body>
<p>Examples are specified at: "<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.Examples.Invariant\">Examples.Invariant</a>".
</p>
<p>
An invariant is an inequation that specifies an upper <b>bound</b> on a clock, e.g., c < 2 or c <= 2 where c is a <a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.Clock\">Clock</a>. Invariants are assigned to generalized steps and are used to specify a time span in which this generalized step is allowed to be active.
</p>
<p>
<img src=\"modelica://RealTimeCoordinationLibrary/Resources/images/invariant.jpg\" alt =\"\"/>
</p>
</body>
</html>
"));
end Invariant;
class ClockConstraint "ClockConstraint"
extends Modelica.Icons.Information;
annotation (Documentation(info="<!DOCTYPE html>
<html>
<head><title>RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.ClockConstraint</title></head>
<body>
<p>Examples are specified at: "<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.Examples.ClockConstraint\">Examples.ClockConstraint</a>".</p>
<p>A clock constraint might be any kind of inequation specifying a <b>bound</b> on a certain clock, e.g., c > 2, c >= 5, c < 2, c <= 5, where c is a <a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.Clock\">Clock</a>. Clock constraints are assigned to transitions in order to restrict the time span in which a transition is allowed to fire.</p>
<p><img src=\"modelica://RealTimeCoordinationLibrary/Resources/images/clockCondition.jpg\" alt =\"\"/></p>
</body>
</html>
"));
end ClockConstraint;
class DelegationPort "DelegationPort"
extends Modelica.Icons.Information;
annotation (Documentation(info="<!DOCTYPE html>
<html>
<head><title>RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.DelegationPort</title></head>
<body>
<p>Examples are specified at: "<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.Examples.InteractingComponents\">Examples.InteractingComponents</a>".</p>
<p>If two extended StateGraph2 models are included in different component instances they might still communicate asynchronously across the boundaries of these component instances with the help of delegation ports. Therefore, one component defines an output delegation port and the other defines an input delegation port. Both delegation ports are connected. Then, the component instance containing the message type connects the message type to the output delegation ports and the component instance containing the Mailbox instance connects the Mailbox instance to the input delegation port. </p>
<p>It is necessary that instances of DelegationPort redeclare the variables Integers, Booleans and Reals with the required array size as shown in the Figure below. Connected DelegationPorts must always have the same redeclaration. </p>
<p><br/><img src=\"modelica://RealTimeCoordinationLibrary/Resources/images/DelegationPort.jpg\" alt =\"\"/></p>
</body>
</html>"));
end DelegationPort;
annotation (__Dymola_DocumentationClass=true, Documentation(info="<!DOCTYPE html>
<html>
<head><title>RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements</title></head>
<body>
<ol>
<li>"<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.Message_Mailbox\">Message and Mailbox</a>" gives an overview about the elements: Message and Mailbox.</li>
<li>"<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.Synchronization\">Synchronization</a>" gives an overview about the element: Synchronization.</li>
<li>"<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.Transition\">Transition</a>" gives an overview about the element: Transition.</li>
<li>"<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.Clock\">Clock</a>" gives an overview about the element: Clock.</li>
<li>"<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.Invariant\">Invariant</a>" gives an overview about the element: Invariant. </li>
<li>"<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.ClockConstraint\">ClockConstraint</a>" gives an overview about the element: ClockConstraint. </li>
<li>"<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements.DelegationPort\">DelegationPort</a>" gives an overview about the element: DelegationPort. </li>
</ol>
</body>
</html>
"));
end Elements;
class Literature "Literature"
extends Modelica.Icons.Information;
annotation (Documentation(info="<!DOCTYPE html>
<html>
<head><title>RealTimeCoordinationLibrary.RealTimeCoordination.Literature</title></head>
<body>
<p>
The RealTimeCoordination library is described in detail in
</p>
<dl>
<dt>Uwe Pohlmann, Stefan Dziwok,Julian Suck, Boris Wolf,Chia Choon Loh, Matthias Tichy (2012):</dt>
<dd>
A Modelica Library for Real-Time Coordination Modeling., Modelica 2012
<br> </dd>
</dl>
<P> and is additionally
based on the following references:</p>
<P>[1] R. Alur and D.L. Dill. A theory of timed automata. <I>Theoretical computer science</I>, 126(2):183–235, 1994. </P>
<P>[2] S. Becker, C. Brenner, S. Dziwok, T. Gewering, C. Heinzemann, U. Pohlmann, C. Priesterjahn, </P>
<P>W. Schäfer, J. Suck, O. Sudmann, and M. Tichy. The mechatronicuml method -process, syntax, and semantics. Technical Report tr-ri-12-318, Software Engineering Group, Heinz Nixdorf Institute University of Paderborn, 2012. </P>
<P>[3] Lionel C. Briand and Alexander L. Wolf, editors. <I>International Conference on Software Engineering, ISCE 2007, Workshop on the Future of Software Engineering, FOSE 2007, May 23-25, 2007, Minneapolis, MN, USA</I>, 2007. </P>
<p>[4] U. Donath, J. Haufe, T. Blochwitz, and T. Neidhold. A new approach for modeling and verification of discrete control components within a Modelica environment. In <I>Proceedings of the 6th Modelica Conference, Bielefeld</I>, pages 269–276, 2008.
<p>[5] Christof Ebert and Capers Jones. Embedded software: Facts, figures, and future. <I>IEEE Computer</I>, 42(4):42– 52, 2009.
<p>[6] Peter Fritzson. <I>Principles of Object-Oriented Modeling and Simulation with Modelica 2.1</I>. Wiley-IEEE Press, 1st edition, 2004.
<p>[7] Object Management Group. Omg unified modeling language (omg uml), superstructure, v2.4.1. Technical report, 2011.
<p>[8] D. Harel. Statecharts: A visual formalism for complex systems. <I>Science of computer programming</I>, 8(3):231–274, 1987.
<p>[9] C. Heinzemann, U. Pohlmann, J. Rieke, W. Schäfer,
O. Sudmann, and M. Tichy. Generating simulink and stateflow models from software specifications. In <I>Proceedings of the International Design Conference, DESIGN 2012, Dubrovnik, Croatia</I>, May 2012. </P>
<p>[10] S. Herbrechtsmeier, U. Witkowski, and U. Rückert. Bebot: A modular mobile miniature robot platform supporting hardware reconfiguration and multistandard communication. In <I>Progress in Robotics, </I>
<I>Communications in Computer and Information Science. Proceedings of the FIRA RoboWorld Congress 2009</I>, volume 44, pages 346–356, Incheon, Korea, 2009. Springer. </P>
<p>[11] I. Kaiser, T. Kaulmann, J. Gausemeier, and U. Witkowski. Miniaturization of autonomous robots by the new technology molded interconnected devices (mid). In <I>Proceedings of the 4th International Symposium on Autonomous Minirobots for Research and Edutainment</I>, October 2007. </p>
<p>[12] C. C. Loh and A. Trächtler. Laser-sintered platform with optical sensor for a mobile robot used in cooperative load transport. In <I>Proceedings of the 37th Annual Conference on IEEE Industrial Electronics Society</I>, pages 888–893, November 2011. </P>
<p>[13] M. Malmheden, Hilding Elmqvist, S.E. Mattsson,
D. Henriksson, and M. Otter. ModeGraph-A Modelica Library for Embedded Control Based on Mode-Automata. In <I>in Proc. of Modelica 2008 conference, Bielefeld, Germany.</I>, 2008. </P>
<p>[14] M. Otter, K-E. Årzén, and I. Dressler. StateGraph–A Modelica Library for Hierarchical State Machines. In <I>Proceedings of the 4th International Modelica Conference (Modelica 2005), Hamburg, Germany</I>, 2005. </P>
<p>[15] M. Otter, M. Malmheden, H. Elmqvist, S.E. Mattsson,
<p>C. Johnsson, D. Systèmes, and S.D. Lund. A new formalism for modeling of reactive and hybrid systems. In <I>Proceedings of the 7th Modelica’2009 Conference, Como, Italy</I>, 2009. </p>
<p>[16] M. Pajic, Z. Jiang, I. Lee, O. Sokolsky, and R. Mangharam. From verification to implementation: A model translation tool and a pacemaker case study. In <I>Proceedings of the 18th IEEE Real-Time and Embedded Technology and Applications Symposium (RTAS 2012), Beijing, China</I>, April 2012. </p>
<p>[17] U. Pohlmann and M. Tichy. Modelica code generation from ModelicaML state machines extended by asynchronous communication. In <I>Proceedings of the 4th International Workshop on Equation-Based Object-Oriented Modeling Languages and Tools, EOOLT 2011, Zurich, Switzerland</I>, 2011. </p>
<p>[18] W. Schäfer and H. Wehrheim. The Challenges of Building Advanced Mechatronic Systems. In Briand and Wolf [3], pages 72–84. </p>
<p>[19] W. Schamai. Modelica modeling language (ModelicaML) : A UML profile for Modelica. Technical report, Linköping University, Department of Computer and Information Science, The Institute of Technology, 2009. </p>
<p>[20] W. Schamai, U. Pohlmann, P. Fritzson, C. J.J. Paredis, P. Helle, and C. Strobel. Execution of uml state machines using modelica. In <I>Proceedings of EOOLT</I>, pages 1–10, 2010. </p>
<p>[21] C. Weiß. V2X communication in Europe -From research projects towards standardization and field testing of vehicle communication technology. <I>Computer Networks</I>, 55(14):3103–3119, 2011.</p>
</body>
</html>
"));
end Literature;
annotation (__Dymola_DocumentationClass=true, Documentation(info="<!DOCTYPE html>
<html>
<head><title>RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide</title></head>
<body>
<p>
Library <b>Real-Time Coordination</b> is a <b>free</b> Modelica package providing
components to model <b>coordination</b>
systems in a convenient
way. This package contains the <b>User's Guide</b> for
the library and has the following content:
</p>
<ol>
<li>"<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Elements\">Elements</a>"
gives an overview of the most important aspects of the Real-Time Coordination library.</li>
<li> "<a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.UsersGuide.Literature\">Literature</a>"
provides references that have been used to design and implement this
library.</li>
</ol>
<p>For an application example have a look at: <a href=\"modelica://RealTimeCoordinationLibrary.RealTimeCoordination.Examples.Application.BeBotSystem\">BeBotSystem</a> </p>
</body>
</html>
"));
end UsersGuide;
package Examples
"Examples to demonstrate the usage of the Real-Time Coordination library"
package AsynchronousCommunication
model FirstExample
"First example of an asynchronous communication with two parameters of type integer."
extends Modelica.Icons.Example;
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T2(
use_syncReceive=false,
numberOfMessageIntegers=2,
use_messageReceive=true,
numberOfMessageReceive=1,
use_after=true,
afterTime=2)
annotation (Placement(transformation(extent={{24,6},{32,14}})));
Modelica_StateGraph2.Parallel step1(initialStep=true, nEntry=2)
annotation (Placement(transformation(extent={{-76,-76},{44,84}})));
RealTimeCoordination.Step
step2(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{-66,34},{-58,42}})));
RealTimeCoordination.Step
step3(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{24,32},{32,40}})));
RealTimeCoordination.Step
step4(nIn=1)
annotation (Placement(transformation(extent={{-66,-22},{-58,-14}})));
RealTimeCoordination.Step
step5(nIn=1)
annotation (Placement(transformation(extent={{26,-22},{34,-14}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Message
message(numberOfMessageIntegers=2,
nIn=1)
annotation (Placement(transformation(extent={{-46,-4},{-26,16}})));
RealTimeCoordination.Mailbox
mailbox(
numberOfMessageIntegers=2,
queueSize=40,
nIn=1,
nOut=1)
annotation (Placement(transformation(extent={{-12,-10},{8,10}})));
Modelica.Blocks.Sources.IntegerExpression integerExpression(y=5)
annotation (Placement(transformation(extent={{-124,30},{-104,50}})));
Modelica.Blocks.Sources.IntegerExpression integerExpression1(y=3)
annotation (Placement(transformation(extent={{-124,14},{-104,34}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T1(
use_firePort=true,
use_after=true,
afterTime=1)
annotation (Placement(transformation(extent={{-66,0},{-58,8}})));
equation
connect(step1.entry[1], step2.inPort[1]) annotation (Line(
points={{-19,76},{-39,76},{-39,42},{-62,42}}));
connect(step1.entry[2], step3.inPort[1]) annotation (Line(
points={{-13,76},{4,76},{4,40},{28,40}}));
connect(step3.outPort[1], T2.inPort) annotation (Line(
points={{28,31.4},{28,14}}));
connect(T2.outPort, step5.inPort[1]) annotation (Line(
points={{28,5},{30,5},{30,-14}}));
connect(integerExpression.y, message.u_integers[1]) annotation (
Line(
points={{-103,40},{-74,40},{-74,16.2},{-47,16.2}},
color={255,127,0}));
connect(integerExpression1.y, message.u_integers[2]) annotation (
Line(
points={{-103,24},{-74,24},{-74,14.2},{-47,14.2}},
color={255,127,0}));
connect(step2.outPort[1], T1.inPort) annotation (Line(
points={{-62,33.4},{-62,8}}));
connect(T1.outPort, step4.inPort[1]) annotation (Line(
points={{-62,-1},{-62,-14}}));
connect(T1.firePort, message.conditionPort[1]) annotation (Line(
points={{-57.8,4},{-52,4},{-52,-3.6},{-48,-3.6}},
color={255,0,255}));
connect(message.message_output_port, mailbox.mailbox_input_port[
1]) annotation (Line(
points={{-27,5},{-18.5,5},{-18.5,-1},{-11,-1}}));
connect(mailbox.mailbox_output_port[1], T2.transition_input_port[1])
annotation (Line(
points={{7,-1},{16.5,-1},{16.5,12.12},{23.1,12.12}}));
annotation (Icon(graphics={ Ellipse(extent={{-100,100},{100,
-100}},
lineColor={95,95,95},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Polygon(
points={{-36,60},{64,0},{-36,-60},{-36,60}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={95,95,95},
fillPattern=FillPattern.Solid)}));
end FirstExample;
model SecondExample "Second example for testing the MailBox capacity."
extends Modelica.Icons.Example;
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T2(
use_syncReceive=false,
numberOfMessageIntegers=2,
use_messageReceive=true,
numberOfMessageReceive=1)
annotation (Placement(transformation(extent={{24,6},{32,14}})));
Modelica_StateGraph2.Parallel step1(initialStep=true, nEntry=2)
annotation (Placement(transformation(extent={{-76,-76},{44,84}})));
Modelica_StateGraph2.Step step2(nIn=2, nOut=1)
annotation (Placement(transformation(extent={{-66,34},{-58,42}})));
Modelica_StateGraph2.Step step3(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{24,32},{32,40}})));
RealTimeCoordination.Step
step4(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{-66,-22},{-58,-14}})));
Modelica_StateGraph2.Step step5(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{26,-22},{34,-14}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Message
message(numberOfMessageIntegers=2,
nIn=1)
annotation (Placement(transformation(extent={{-42,-4},{-22,16}})));
RealTimeCoordination.Mailbox
mailbox(
nIn=1,
numberOfMessageIntegers=2,
queueSize=30,
nOut=2)
annotation (Placement(transformation(extent={{-12,-10},{8,10}})));
Modelica.Blocks.Sources.IntegerExpression integerExpression(y=5)
annotation (Placement(transformation(extent={{-124,30},{-104,50}})));
Modelica.Blocks.Sources.IntegerExpression integerExpression1(y=3)
annotation (Placement(transformation(extent={{-124,14},{-104,34}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T1(use_firePort=true)
annotation (Placement(transformation(extent={{-66,-2},{-58,6}})));
Modelica_StateGraph2.Step step6(nIn=1)
annotation (Placement(transformation(extent={{28,-54},{36,-46}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T3(
numberOfMessageReceive=1,
numberOfMessageIntegers=2,
use_messageReceive=true)
annotation (Placement(transformation(extent={{28,-38},{36,-30}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T4(use_after=true, afterTime=1)
annotation (Placement(transformation(
extent={{-4,-4},{4,4}},
rotation=180,
origin={-84,2})));
equation
connect(step1.entry[1], step2.inPort[1]) annotation (Line(
points={{-19,76},{-39,76},{-39,42},{-63,42}}));
connect(step1.entry[2], step3.inPort[1]) annotation (Line(
points={{-13,76},{4,76},{4,40},{28,40}}));
connect(step3.outPort[1], T2.inPort) annotation (Line(
points={{28,31.4},{28,14}}));
connect(T2.outPort, step5.inPort[1]) annotation (Line(
points={{28,5},{30,5},{30,-14}}));
connect(integerExpression.y, message.u_integers[1]) annotation (
Line(
points={{-103,40},{-74,40},{-74,16.2},{-43,16.2}},
color={255,127,0}));
connect(integerExpression1.y, message.u_integers[2]) annotation (
Line(
points={{-103,24},{-74,24},{-74,14.2},{-43,14.2}},
color={255,127,0}));
connect(step2.outPort[1], T1.inPort) annotation (Line(
points={{-62,33.4},{-62,6}}));
connect(T1.outPort, step4.inPort[1]) annotation (Line(
points={{-62,-3},{-62,-14}}));
connect(step5.outPort[1], T3.inPort) annotation (Line(
points={{30,-22.6},{32,-22.6},{32,-30}}));
connect(T3.outPort, step6.inPort[1]) annotation (Line(
points={{32,-39},{32,-46}}));
connect(step4.outPort[1], T4.inPort) annotation (Line(
points={{-62,-22.6},{-74,-22.6},{-74,-22},{-84,-22},{-84,-2}}));
connect(T4.outPort, step2.inPort[2]) annotation (Line(
points={{-84,7},{-84,52},{-61,52},{-61,42}}));
connect(message.message_output_port, mailbox.mailbox_input_port[
1]) annotation (Line(
points={{-23,5},{-16.5,5},{-16.5,-1},{-11,-1}}));
connect(mailbox.mailbox_output_port[1], T2.transition_input_port[1])
annotation (Line(
points={{7,-1.5},{16.5,-1.5},{16.5,12.12},{23.1,12.12}}));
connect(mailbox.mailbox_output_port[2], T3.transition_input_port[1])
annotation (Line(
points={{7,-0.5},{7,-16.5},{27.1,-16.5},{27.1,-31.88}}));
connect(T1.firePort, message.conditionPort[1]) annotation (Line(
points={{-57.8,2},{-50,2},{-50,-3.6},{-44,-3.6}},
color={255,0,255}));
annotation (Icon(graphics={ Ellipse(extent={{-100,100},{100,
-100}},
lineColor={95,95,95},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Polygon(
points={{-36,60},{64,0},{-36,-60},{-36,60}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={95,95,95},
fillPattern=FillPattern.Solid)}));
end SecondExample;
model ThirdExample
"Third example with sending two message instances to one MailBox component."
extends Modelica.Icons.Example;
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T2(
use_syncReceive=false,
numberOfMessageReceive=1,
use_messageReceive=true,
numberOfMessageIntegers=3,
condition=time > 3.5)
annotation (Placement(transformation(extent={{24,6},{32,14}})));
Modelica_StateGraph2.Parallel step1(initialStep=true, nEntry=3)
annotation (Placement(transformation(extent={{-76,-76},{94,84}})));
Modelica_StateGraph2.Step step2(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{-66,34},{-58,42}})));
Modelica_StateGraph2.Step step3(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{24,32},{32,40}})));
Modelica_StateGraph2.Step step4(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{-66,-22},{-58,-14}})));
Modelica_StateGraph2.Step step5(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{26,-22},{34,-14}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Message
message(numberOfMessageIntegers=3,
nIn=1)
annotation (Placement(transformation(extent={{-46,-4},{-26,16}})));
RealTimeCoordination.Mailbox
mailbox(
nIn=2,
queueSize=40,
numberOfMessageIntegers=3,
nOut=3)
annotation (Placement(transformation(extent={{-12,-10},{8,10}})));
Modelica.Blocks.Sources.IntegerExpression integerExpression(y=5)
annotation (Placement(transformation(extent={{-124,30},{-104,50}})));
Modelica.Blocks.Sources.IntegerExpression integerExpression1(y=3)
annotation (Placement(transformation(extent={{-124,14},{-104,34}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T1(
use_firePort=true,
use_after=true,
afterTime=0.5)
annotation (Placement(transformation(extent={{-66,0},{-58,8}})));
Modelica_StateGraph2.Step step6(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{70,28},{78,36}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T3(
use_messageReceive=true,
afterTime=0.5,
numberOfMessageIntegers=3,
use_after=false,
numberOfMessageReceive=1,
condition=time > 3)
annotation (Placement(transformation(extent={{70,6},{78,14}})));
Modelica_StateGraph2.Step step7(nIn=1)
annotation (Placement(transformation(extent={{76,-22},{84,-14}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T4(
use_firePort=true,
use_after=true,
afterTime=1)
annotation (Placement(transformation(extent={{-66,-42},{-58,-34}})));
Modelica_StateGraph2.Step step8(nIn=1)
annotation (Placement(transformation(extent={{-64,-58},{-56,-50}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Message
message1(numberOfMessageIntegers=3,
nIn=1)
annotation (Placement(transformation(extent={{-34,-34},{-14,-14}})));
Modelica.Blocks.Sources.IntegerExpression integerExpression2(y=1)
annotation (Placement(transformation(extent={{-102,-28},{-82,-8}})));
Modelica.Blocks.Sources.IntegerExpression integerExpression3(y=2)
annotation (Placement(transformation(extent={{-104,-40},{-84,-20}})));
Modelica_StateGraph2.Step step9(nIn=1)
annotation (Placement(transformation(extent={{30,-48},{38,-40}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T5(
use_messageReceive=true,
numberOfMessageIntegers=3,
numberOfMessageReceive=1)
annotation (Placement(transformation(extent={{26,-34},{34,-26}})));
equation
connect(step1.entry[1], step2.inPort[1]) annotation (Line(
points={{3.33333,76},{-39,76},{-39,42},{-62,42}}));
connect(step1.entry[2], step3.inPort[1]) annotation (Line(
points={{9,76},{4,76},{4,40},{28,40}}));
connect(step3.outPort[1], T2.inPort) annotation (Line(
points={{28,31.4},{28,14}}));
connect(T2.outPort, step5.inPort[1]) annotation (Line(
points={{28,5},{30,5},{30,-14}}));
connect(integerExpression.y, message.u_integers[1]) annotation (
Line(
points={{-103,40},{-74,40},{-74,16.5333},{-47,16.5333}},
color={255,127,0}));
connect(integerExpression1.y, message.u_integers[2]) annotation (
Line(
points={{-103,24},{-74,24},{-74,15.2},{-47,15.2}},
color={255,127,0}));
connect(step2.outPort[1], T1.inPort) annotation (Line(
points={{-62,33.4},{-62,8}}));
connect(T1.outPort, step4.inPort[1]) annotation (Line(
points={{-62,-1},{-62,-14}}));
connect(integerExpression1.y, message.u_integers[3]) annotation (
Line(
points={{-103,24},{-76,24},{-76,13.8667},{-47,13.8667}},
color={255,127,0}));
connect(step1.entry[3], step6.inPort[1]) annotation (Line(
points={{14.6667,76},{74,76},{74,38},{74,38},{74,36},{74,36}}));
connect(step6.outPort[1], T3.inPort) annotation (Line(
points={{74,27.4},{74,14}}));
connect(T3.outPort, step7.inPort[1]) annotation (Line(
points={{74,5},{78,5},{78,-14},{80,-14}}));
connect(step4.outPort[1], T4.inPort) annotation (Line(
points={{-62,-22.6},{-62,-34}}));
connect(T4.outPort, step8.inPort[1]) annotation (Line(
points={{-62,-43},{-62,-50},{-60,-50}}));
connect(integerExpression2.y, message1.u_integers[1]) annotation (
Line(
points={{-81,-18},{-58,-18},{-58,-13.4667},{-35,-13.4667}},
color={255,127,0}));
connect(integerExpression3.y, message1.u_integers[2]) annotation (
Line(
points={{-83,-30},{-58,-30},{-58,-14.8},{-35,-14.8}},
color={255,127,0}));
connect(integerExpression3.y, message1.u_integers[3]) annotation (
Line(
points={{-83,-30},{-60,-30},{-60,-16.1333},{-35,-16.1333}},
color={255,127,0}));
connect(step5.outPort[1], T5.inPort) annotation (Line(
points={{30,-22.6},{30,-26}}));
connect(T5.outPort, step9.inPort[1]) annotation (Line(
points={{30,-35},{32,-35},{32,-40},{34,-40}}));
connect(message.message_output_port, mailbox.mailbox_input_port[
1]) annotation (Line(
points={{-27,5},{-18.5,5},{-18.5,-1.5},{-11,-1.5}}));
connect(message1.message_output_port, mailbox.mailbox_input_port[
2]) annotation (Line(
points={{-15,-25},{-15,-12.5},{-11,-12.5},{-11,-0.5}}));
connect(mailbox.mailbox_output_port[1], T5.transition_input_port[1])
annotation (Line(
points={{7,-1.66667},{7,-13.5},{25.1,-13.5},{25.1,-27.88}}));
connect(mailbox.mailbox_output_port[2], T3.transition_input_port[1])
annotation (Line(
points={{7,-1},{38.5,-1},{38.5,12.12},{69.1,12.12}}));
connect(mailbox.mailbox_output_port[3], T2.transition_input_port[1])
annotation (Line(
points={{7,-0.333333},{16.5,-0.333333},{16.5,12.12},{23.1,12.12}}));
connect(T1.firePort, message.conditionPort[1]) annotation (Line(
points={{-57.8,4},{-52,4},{-52,-3.6},{-48,-3.6}},
color={255,0,255}));
connect(T4.firePort, message1.conditionPort[1]) annotation (Line(
points={{-57.8,-38},{-46,-38},{-46,-33.6},{-36,-33.6}},
color={255,0,255}));
end ThirdExample;
model SyncExample
"Example to demontrate asynchronous and synchronous communication at one transition instance."
extends Modelica.Icons.Example;
Modelica_StateGraph2.Parallel step1( nEntry=2,
initialStep=false,
nIn=1)
annotation (Placement(transformation(extent={{-94,-34},{22,72}})));
Modelica_StateGraph2.Step step2(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{-84,50},{-76,58}})));
Modelica_StateGraph2.Step step3(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{-18,50},{-10,58}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T1(
use_firePort=true,
use_after=true,
afterTime=3)
annotation (Placement(transformation(extent={{-82,30},{-74,38}})));
Modelica_StateGraph2.Step step4(nIn=1)
annotation (Placement(transformation(extent={{-80,14},{-72,22}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Message
message(nIn=1)
annotation (Placement(transformation(extent={{-54,-8},{-34,12}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T3(
use_messageReceive=true,
numberOfMessageReceive=1,
use_syncReceive=true,
numberOfSyncReceive=1)
annotation (Placement(transformation(extent={{-4,8},{4,16}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Mailbox
mailbox(nOut=1, nIn=1)
annotation (Placement(transformation(extent={{-28,-10},{-8,10}})));
Modelica_StateGraph2.Step step6(nIn=1)
annotation (Placement(transformation(extent={{-4,-10},{4,-2}})));
Modelica_StateGraph2.Parallel step8(nEntry=2, initialStep=true)
annotation (Placement(transformation(extent={{-102,-102},{96,98}})));
Modelica_StateGraph2.Parallel step5(nIn=1, nEntry=1)
annotation (Placement(transformation(extent={{32,-42},{108,64}})));
Modelica_StateGraph2.Step step9(nOut=1, nIn=1)
annotation (Placement(transformation(extent={{64,40},{72,48}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T2(
afterTime=2,
use_syncReceive=false,
use_syncSend=true,
numberOfSyncSend=1,
use_conditionPort=false,
condition=time > 2,
use_after=false)
annotation (Placement(transformation(extent={{62,20},{70,28}})));
Modelica_StateGraph2.Step step10(nIn=1)
annotation (Placement(transformation(extent={{62,0},{70,8}})));
equation
connect(step2.inPort[1], step1.entry[1]) annotation (Line(
points={{-80,58},{-56,58},{-56,66.7},{-38.9,66.7}}));
connect(step3.inPort[1], step1.entry[2]) annotation (Line(
points={{-14,58},{-26,58},{-26,66.7},{-33.1,66.7}}));
connect(step2.outPort[1], T1.inPort) annotation (Line(
points={{-80,49.4},{-80,38},{-78,38}}));
connect(T1.outPort, step4.inPort[1]) annotation (Line(
points={{-78,29},{-76,29},{-76,22}}));
connect(T1.firePort, message.conditionPort[1]) annotation (Line(
points={{-73.8,34},{-58,34},{-58,-7.6},{-56,-7.6}},
color={255,0,255}));
connect(T3.outPort, step6.inPort[1]) annotation (Line(
points={{0,7},{0,-2}}));
connect(mailbox.mailbox_output_port[1], T3.transition_input_port[1])
annotation (Line(
points={{-9,-1},{-9,12.5},{-4.9,12.5},{-4.9,14.12}}));
connect(step8.entry[1], step1.inPort[1]) annotation (Line(
points={{-7.95,88},{-18,88},{-18,72},{-36,72}}));
connect(step8.entry[2], step5.inPort[1]) annotation (Line(
points={{1.95,88},{34,88},{34,64},{70,64}}));
connect(step9.outPort[1], T2.inPort) annotation (Line(
points={{68,39.4},{68,33.7},{66,33.7},{66,28}}));
connect(step5.entry[1], step9.inPort[1]) annotation (Line(
points={{70,58.7},{70,48},{68,48}}));
connect(T2.outPort, step10.inPort[1]) annotation (Line(
points={{66,19},{66,8}}));
connect(step3.outPort[1], T3.inPort) annotation (Line(
points={{-14,49.4},{-14,32.7},{0,32.7},{0,16}}));
connect(message.message_output_port, mailbox.mailbox_input_port[
1]) annotation (Line(
points={{-35,1},{-31,1},{-31,-1},{-27,-1}}));
connect(T3.receiver[1], T2.sender[1]) annotation (Line(
points={{-2.82,16.02},{32.59,16.02},{32.59,28.06},{68.6,28.06}},
color={255,128,0}));
annotation ( Icon(graphics={
Ellipse(extent={{-90,110},{110,
-90}},
lineColor={95,95,95},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Polygon(
points={{-26,70},{74,10},{-26,-50},{-26,70}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={95,95,95},
fillPattern=FillPattern.Solid)}));
end SyncExample;
model Sync2Example
"Example to demontrate asynchronous and synchronous communication at one transition instance."
extends Modelica.Icons.Example;
Modelica_StateGraph2.Parallel step1( nEntry=2,
initialStep=false,
nIn=1)
annotation (Placement(transformation(extent={{-94,-34},{22,72}})));
Modelica_StateGraph2.Step step2(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{-84,50},{-76,58}})));
Modelica_StateGraph2.Step step3(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{-18,50},{-10,58}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T1(
use_firePort=true,
use_after=true,
afterTime=3)
annotation (Placement(transformation(extent={{-82,30},{-74,38}})));
Modelica_StateGraph2.Step step4(nIn=1)
annotation (Placement(transformation(extent={{-80,14},{-72,22}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Message
message(nIn=1)
annotation (Placement(transformation(extent={{-54,-8},{-34,12}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T3(
use_messageReceive=true,
numberOfMessageReceive=1,
use_syncSend=true,
use_syncReceive=false,
numberOfSyncSend=1)
annotation (Placement(transformation(extent={{-4,8},{4,16}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Mailbox
mailbox(nOut=1, nIn=1)
annotation (Placement(transformation(extent={{-28,-10},{-8,10}})));
Modelica_StateGraph2.Step step6(nIn=1)
annotation (Placement(transformation(extent={{-4,-10},{4,-2}})));
Modelica_StateGraph2.Parallel step8(nEntry=2, initialStep=true)
annotation (Placement(transformation(extent={{-102,-102},{96,98}})));
Modelica_StateGraph2.Parallel step5(nIn=1, nEntry=1)
annotation (Placement(transformation(extent={{32,-42},{108,64}})));
Modelica_StateGraph2.Step step9(nOut=1, nIn=1)
annotation (Placement(transformation(extent={{64,40},{72,48}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T2(
afterTime=2,
use_after=false,
condition=time > 2,
use_syncSend=false,
use_syncReceive=true,
numberOfSyncReceive=1)
annotation (Placement(transformation(extent={{62,20},{70,28}})));
Modelica_StateGraph2.Step step10(nIn=1)
annotation (Placement(transformation(extent={{62,0},{70,8}})));
equation
connect(step2.inPort[1], step1.entry[1]) annotation (Line(
points={{-80,58},{-56,58},{-56,66.7},{-38.9,66.7}}));
connect(step3.inPort[1], step1.entry[2]) annotation (Line(
points={{-14,58},{-26,58},{-26,66.7},{-33.1,66.7}}));
connect(step2.outPort[1], T1.inPort) annotation (Line(
points={{-80,49.4},{-80,38},{-78,38}}));
connect(T1.outPort, step4.inPort[1]) annotation (Line(
points={{-78,29},{-76,29},{-76,22}}));
connect(T1.firePort, message.conditionPort[1]) annotation (Line(
points={{-73.8,34},{-58,34},{-58,-7.6},{-56,-7.6}},
color={255,0,255}));
connect(T3.outPort, step6.inPort[1]) annotation (Line(
points={{0,7},{0,-2}}));
connect(mailbox.mailbox_output_port[1], T3.transition_input_port[1])
annotation (Line(
points={{-9,-1},{-9,12.5},{-4.9,12.5},{-4.9,14.12}}));
connect(step8.entry[1], step1.inPort[1]) annotation (Line(
points={{-7.95,88},{-18,88},{-18,72},{-36,72}}));
connect(step8.entry[2], step5.inPort[1]) annotation (Line(
points={{1.95,88},{34,88},{34,64},{70,64}}));
connect(step9.outPort[1], T2.inPort) annotation (Line(
points={{68,39.4},{68,33.7},{66,33.7},{66,28}}));
connect(step5.entry[1], step9.inPort[1]) annotation (Line(
points={{70,58.7},{70,48},{68,48}}));
connect(T2.outPort, step10.inPort[1]) annotation (Line(
points={{66,19},{66,8}}));
connect(step3.outPort[1], T3.inPort) annotation (Line(
points={{-14,49.4},{-14,32.7},{0,32.7},{0,16}}));
connect(message.message_output_port, mailbox.mailbox_input_port[
1]) annotation (Line(
points={{-35,1},{-31,1},{-31,-1},{-27,-1}}));
connect(T2.receiver[1], T3.sender[1]) annotation (Line(
points={{63.18,28.02},{32.59,28.02},{32.59,16.06},{2.6,16.06}},
color={255,128,0}));
annotation ( Icon(graphics={
Ellipse(extent={{-90,110},{110,
-90}},
lineColor={95,95,95},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Polygon(
points={{-26,70},{74,10},{-26,-50},{-26,70}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={95,95,95},
fillPattern=FillPattern.Solid)}));
end Sync2Example;
model SyncPrioExample
"Example to demontrate the priorities at synchronization."
extends Modelica.Icons.Example;
Modelica_StateGraph2.Parallel step1( nEntry=2,
initialStep=false,
nIn=1)
annotation (Placement(transformation(extent={{-94,-34},{22,72}})));
Modelica_StateGraph2.Step step2(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{-84,50},{-76,58}})));
Modelica_StateGraph2.Step step3(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{-18,50},{-10,58}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T1(
use_firePort=true,
use_after=true,
afterTime=0.5)
annotation (Placement(transformation(extent={{-82,30},{-74,38}})));
Modelica_StateGraph2.Step step4(nIn=1)
annotation (Placement(transformation(extent={{-80,14},{-72,22}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Message
message(nIn=1)
annotation (Placement(transformation(extent={{-54,-8},{-34,12}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T3(
use_messageReceive=true,
numberOfMessageReceive=1,
use_syncSend=true,
use_syncReceive=false,
numberOfSyncSend=2)
annotation (Placement(transformation(extent={{-4,8},{4,16}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Mailbox
mailbox(nOut=1, nIn=1)
annotation (Placement(transformation(extent={{-28,-10},{-8,10}})));
Modelica_StateGraph2.Step step6(nIn=1)
annotation (Placement(transformation(extent={{-4,-10},{4,-2}})));
Modelica_StateGraph2.Parallel step8(nEntry=3, initialStep=true)
annotation (Placement(transformation(extent={{-102,-102},{134,100}})));
Modelica_StateGraph2.Parallel step5(nIn=1, nEntry=1)
annotation (Placement(transformation(extent={{34,-6},{108,64}})));
Modelica_StateGraph2.Step step9(nOut=1, nIn=1)
annotation (Placement(transformation(extent={{64,40},{72,48}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T2(
afterTime=2,
use_after=false,
condition=time > 2,
use_syncSend=false,
use_syncReceive=true,
numberOfSyncReceive=1)
annotation (Placement(transformation(extent={{62,20},{70,28}})));
Modelica_StateGraph2.Step step10(nIn=1)
annotation (Placement(transformation(extent={{62,0},{70,8}})));
Modelica_StateGraph2.Parallel step7( nEntry=1, nIn=1)
annotation (Placement(transformation(extent={{38,-92},{112,-22}})));
Modelica_StateGraph2.Step step11(
nOut=1, nIn=1)
annotation (Placement(transformation(extent={{72,-42},{80,-34}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T4(
afterTime=2,
use_after=false,
condition=time > 2,
use_syncSend=false,
use_syncReceive=true,
numberOfSyncReceive=1)
annotation (Placement(transformation(extent={{70,-62},{78,-54}})));
Modelica_StateGraph2.Step step12(nIn=1)
annotation (Placement(transformation(extent={{70,-82},{78,-74}})));
equation
connect(step2.inPort[1], step1.entry[1]) annotation (Line(
points={{-80,58},{-56,58},{-56,66.7},{-38.9,66.7}}));
connect(step3.inPort[1], step1.entry[2]) annotation (Line(
points={{-14,58},{-26,58},{-26,66.7},{-33.1,66.7}}));
connect(step2.outPort[1], T1.inPort) annotation (Line(
points={{-80,49.4},{-80,38},{-78,38}}));
connect(T1.outPort, step4.inPort[1]) annotation (Line(
points={{-78,29},{-76,29},{-76,22}}));
connect(T1.firePort, message.conditionPort[1]) annotation (Line(
points={{-73.8,34},{-58,34},{-58,-7.6},{-56,-7.6}},
color={255,0,255}));
connect(T3.outPort, step6.inPort[1]) annotation (Line(
points={{0,7},{0,-2}}));
connect(mailbox.mailbox_output_port[1], T3.transition_input_port[1])
annotation (Line(
points={{-9,-1},{-9,12.5},{-4.9,12.5},{-4.9,14.12}}));
connect(step8.entry[1], step1.inPort[1]) annotation (Line(
points={{8.13333,89.9},{-18,89.9},{-18,72},{-36,72}}));
connect(step8.entry[2], step5.inPort[1]) annotation (Line(
points={{16,89.9},{34,89.9},{34,64},{71,64}}));
connect(step9.outPort[1], T2.inPort) annotation (Line(
points={{68,39.4},{68,33.7},{66,33.7},{66,28}}));
connect(step5.entry[1], step9.inPort[1]) annotation (Line(
points={{71,60.5},{71,48},{68,48}}));
connect(T2.outPort, step10.inPort[1]) annotation (Line(
points={{66,19},{66,8}}));
connect(step3.outPort[1], T3.inPort) annotation (Line(
points={{-14,49.4},{-14,32.7},{0,32.7},{0,16}}));
connect(message.message_output_port, mailbox.mailbox_input_port[
1]) annotation (Line(
points={{-35,1},{-31,1},{-31,-1},{-27,-1}}));
connect(step11.outPort[1], T4.inPort)
annotation (Line(
points={{76,-42.6},{76,-48.3},{74,-48.3},{74,-54}}));
connect(step7.entry[1], step11.inPort[1])
annotation (Line(
points={{75,-25.5},{75,-34},{76,-34}}));
connect(T4.outPort,step12. inPort[1]) annotation (Line(
points={{74,-63},{74,-74}}));
connect(T4.receiver[1], T3.sender[1]) annotation (Line(
points={{71.18,-53.98},{71.18,-18.99},{2.24,-18.99},{2.24,16.06}},
color={255,128,0}));
connect(step7.inPort[1], step8.entry[3]) annotation (Line(
points={{75,-22},{48,-22},{48,89.9},{23.8667,89.9}}));
connect(T2.receiver[1], T3.sender[2]) annotation (Line(
points={{63.18,28.02},{33.59,28.02},{33.59,16.06},{2.96,16.06}},
color={255,128,0}));
annotation ( Icon(graphics={
Ellipse(extent={{-90,110},{110,
-90}},
lineColor={95,95,95},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Polygon(
points={{-26,70},{74,10},{-26,-50},{-26,70}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={95,95,95},
fillPattern=FillPattern.Solid)}));
end SyncPrioExample;
model SyncPrio2Example
"Example to demontrate the priorities at synchronization."
extends Modelica.Icons.Example;
Modelica_StateGraph2.Parallel step1( nEntry=3,
initialStep=false,
nIn=1)
annotation (Placement(transformation(extent={{-116,-36},{22,72}})));
Modelica_StateGraph2.Step step2(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{-110,50},{-102,58}})));
Modelica_StateGraph2.Step step3(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{-44,50},{-36,58}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T1(
use_firePort=true,
use_after=true,
afterTime=1)
annotation (Placement(transformation(extent={{-108,30},{-100,38}})));
Modelica_StateGraph2.Step step4(nIn=1)
annotation (Placement(transformation(extent={{-106,14},{-98,22}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Message
message(nIn=1)
annotation (Placement(transformation(extent={{-80,-8},{-60,12}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T3(
use_messageReceive=true,
numberOfMessageReceive=1,
use_syncSend=true,
use_syncReceive=false,
numberOfSyncSend=1,
use_after=true,
afterTime=2)
annotation (Placement(transformation(extent={{-30,8},{-22,16}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Mailbox
mailbox(nOut=2, nIn=1)
annotation (Placement(transformation(extent={{-54,-10},{-34,10}})));
Modelica_StateGraph2.Step step6(nIn=1)
annotation (Placement(transformation(extent={{-24,-22},{-16,-14}})));
Modelica_StateGraph2.Parallel step8(nEntry=3, initialStep=true)
annotation (Placement(transformation(extent={{-102,-102},{134,100}})));
Modelica_StateGraph2.Parallel step5(nIn=1, nEntry=1)
annotation (Placement(transformation(extent={{34,-6},{108,64}})));
Modelica_StateGraph2.Step step9(nOut=1, nIn=1)
annotation (Placement(transformation(extent={{64,40},{72,48}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T2(
afterTime=2,
use_after=false,
use_syncSend=false,
use_syncReceive=true,
numberOfSyncReceive=1)
annotation (Placement(transformation(extent={{62,20},{70,28}})));
Modelica_StateGraph2.Step step10(nIn=1)
annotation (Placement(transformation(extent={{62,0},{70,8}})));
Modelica_StateGraph2.Parallel step7( nEntry=1, nIn=1)
annotation (Placement(transformation(extent={{38,-92},{112,-22}})));
Modelica_StateGraph2.Step step11(
nOut=1, nIn=1)
annotation (Placement(transformation(extent={{72,-42},{80,-34}})));
RealTimeCoordinationLibrary.RealTimeCoordination.Transition
T4(
afterTime=2,
use_after=false,
use_syncSend=false,
use_syncReceive=true,
numberOfSyncReceive=1)