root/branches/maintenance/2.2.1/Modelica/Blocks/Interfaces.mo

Revision 463, 51.4 kB (checked in by hubertus, 22 months ago)

Created maintenance version from Dynasims version with minimal changes (no checksum, 1 graphics, a few improved documentation places, structurallyIncomplete annotations in Visualizers)

Line 
1package Interfaces "Connectors and partial models for input/output blocks"
2  import Modelica.SIunits;
3    extends Modelica.Icons.Library;
4
5    annotation(preferedView="info",
6      Coordsys(
7        extent=[0, 0; 733, 491],
8        grid=[2, 2],
9        component=[20, 20]),
10      Window(
11        x=0.05,
12        y=0.09,
13        width=0.72,
14        height=0.71,
15        library=1,
16        autolayout=1),
17      Documentation(info="<HTML>
18<p>
19This package contains interface definitions for
20<b>continuous</b> input/output blocks with Real,
21Integer and Boolean signals. Furthermore, it contains
22partial models for continuous and discrete blocks.
23</p>
24
25</HTML>
26", revisions="<html>
27<ul>
28<li><i>Oct. 21, 2002</i>
29       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
30       and <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
31       Added several new interfaces. <a href=\"../Documentation/ChangeNotes1.5.html\">Detailed description</a> available.
32<li><i>Oct. 24, 1999</i>
33       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
34       RealInputSignal renamed to RealInput. RealOutputSignal renamed to
35       output RealOutput. GraphBlock renamed to BlockIcon. SISOreal renamed to
36       SISO. SOreal renamed to SO. I2SOreal renamed to M2SO.
37       SignalGenerator renamed to SignalSource. Introduced the following
38       new models: MIMO, MIMOs, SVcontrol, MVcontrol, DiscreteBlockIcon,
39       DiscreteBlock, DiscreteSISO, DiscreteMIMO, DiscreteMIMOs,
40       BooleanBlockIcon, BooleanSISO, BooleanSignalSource, MI2BooleanMOs.</li>
41<li><i>June 30, 1999</i>
42       by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
43       Realized a first version, based on an existing Dymola library
44       of Dieter Moormann and Hilding Elmqvist.</li>
45</ul>
46</html>
47"));
48
49connector RealSignal "Real port (both input/output possible)"
50  replaceable type SignalType = Real;
51
52  extends SignalType;
53
54    annotation (Documentation(info="<html>
55<p>
56Connector with one signal of type Real (no icon, no input/output prefix).
57</p>
58</html>"));
59end RealSignal;
60
61connector BooleanSignal = Boolean "Boolean port (both input/output possible)"
62    annotation (Documentation(info="<html>
63<p>
64Connector with one signal of type Boolean (no icon, no input/output prefix).
65</p>
66</html>"));
67connector IntegerSignal = Integer "Integer port (both input/output possible)"
68    annotation (Documentation(info="<html>
69<p>
70Connector with one signal of type Icon (no icon, no input/output prefix).
71</p>
72</html>"));
73
74connector RealInput = input RealSignal "'input Real' as connector"
75  annotation (defaultComponentName="u",
76  Coordsys(extent=[-100, -100; 100, 100],
77    grid=[1,1],
78    component=[20,20],
79      scale=0.2),
80  Icon(coordinateSystem(extent=[-100,-100; 100,100]),
81       Polygon(points=[-100,100; 100,0; -100,-100; -100,100], style(
82          color=74,
83          rgbcolor={0,0,127},
84          fillColor=74,
85          rgbfillColor={0,0,127}))),
86  Diagram(Polygon(points=[0,50; 100,0; 0,-50; 0,50], style(
87          color=74,
88          rgbcolor={0,0,127},
89          fillColor=74,
90          rgbfillColor={0,0,127})),
91                                  Text(
92      extent=[-120,105; 100,60],
93      string="%name",
94        style(color=74, rgbcolor={0,0,127}))),
95    Documentation(info="<html>
96<p>
97Connector with one input signal of type Real.
98</p>
99</html>"));
100
101connector RealOutput = output RealSignal "'output Real' as connector"
102  annotation (defaultComponentName="y",
103  Coordsys(extent=[-100, -100; 100, 100],
104    grid=[1,1],
105    component=[20,20]),
106  Icon(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style(
107          color=74,
108          rgbcolor={0,0,127},
109          fillColor=7,
110          rgbfillColor={255,255,255}))),
111  Diagram(Polygon(points=[-100,50; 0,0; -100,-50; -100,50], style(
112          color=74,
113          rgbcolor={0,0,127},
114          fillColor=7,
115          rgbfillColor={255,255,255})),
116                                  Text(
117      extent=[-100,140; 130,60],
118      string="%name",
119        style(color=74, rgbcolor={0,0,127}))),
120    Documentation(info="<html>
121<p>
122Connector with one output signal of type Real.
123</p>
124</html>"));
125
126connector BooleanInput = input BooleanSignal "'input Boolean' as connector"
127  annotation (defaultComponentName="u",
128       Icon(coordinateSystem(extent=[-100,-100; 100,100]),
129            Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100],
130         style(color=5, fillColor=5))), Diagram(Polygon(points=[0,50; 100,0;
131          0,-50; 0,50],                   style(color=5, fillColor=5)),
132                                  Text(
133      extent=[-120,105; 100,60],
134      string="%name",
135      style(color=5))),
136  Coordsys(grid=[1,1], component=[20,20],
137      scale=0.2),
138    Documentation(info="<html>
139<p>
140Connector with one input signal of type Boolean.
141</p>
142</html>"));
143
144connector BooleanOutput = output BooleanSignal "'output Boolean' as connector"
145                                  annotation (defaultComponentName="y",
146  Coordsys(extent=[-100, -100; 100, 100],
147    grid=[1,1],
148    component=[20,20]),
149  Icon(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style(color=
150           5, fillColor=7))),
151  Diagram(Polygon(points=[-100,50; 0,0; -100,-50; -100,50],          style(
152          color=5, fillColor=7)), Text(
153      extent=[-100,140; 130,60],
154      string="%name",
155      style(color=5))),
156    Documentation(info="<html>
157<p>
158Connector with one output signal of type Boolean.
159</p>
160</html>"));
161
162connector IntegerInput = input IntegerSignal "'input Integer' as connector"
163  annotation (defaultComponentName="u",
164  Coordsys(
165    extent=[-100, -100; 100, 100],
166    grid=[1,1],
167    component=[20,20],
168      scale=0.2),
169  Icon(coordinateSystem(extent=[-100,-100; 100,100]),
170       Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style(color=
171           45, fillColor=45))),
172  Diagram(Polygon(points=[0,50; 100,0; 0,-50; 0,50],                 style(
173          color=45, fillColor=45)), Text(
174      extent=[-120,105; 100,60],
175      style(color=45),
176      string="%name")),
177    Documentation(info="<html>
178<p>
179Connector with one input signal of type Integer.
180</p>
181</html>"));
182
183connector IntegerOutput = output IntegerSignal "'output Integer' as connector"
184                                  annotation (defaultComponentName="y",
185  Coordsys(
186    extent=[-100, -100; 100, 100],
187    grid=[1,1],
188    component=[20,20]),
189  Icon(Polygon(points=[-100, 100; 100, 0; -100, -100; -100, 100], style(color=
190           45, fillColor=7))),
191  Diagram(Polygon(points=[-100,50; 0,0; -100,-50; -100,50],          style(
192          color=45, fillColor=7)),  Text(
193      extent=[-100,140; 130,60],
194      style(color=45),
195      string="%name")),
196    Documentation(info="<html>
197<p>
198Connector with one output signal of type Integer.
199</p>
200</html>"));
201
202    partial block BlockIcon "Basic graphical layout of input/output block"
203      annotation (
204        Coordsys(extent=[-100, -100; 100, 100]),
205        Window(
206          x=0,
207          y=0,
208          width=0.6,
209          height=0.6),
210        Icon(Rectangle(extent=[-100, -100; 100, 100], style(
211            color=74,
212            rgbcolor={0,0,127},
213            fillColor=7,
214            rgbfillColor={255,255,255})),
215                               Text(extent=[-150, 150; 150, 110], string=
216                "%name")),
217      Documentation(info="<html>
218<p>
219Block that has only the basic icon for an input/output
220block (no declarations, no equations). Most blocks
221of package Modelica.Blocks inherit directly or indirectly
222from this block.
223</p>
224</html>"));
225    equation
226
227    end BlockIcon;
228
229    partial block SO "Single Output continuous control block"
230      extends BlockIcon;
231
232      RealOutput y "Connector of Real output signal"
233        annotation (extent=[100, -10; 120, 10]);
234      annotation (
235        Coordsys(
236          extent=[-100, -100; 100, 100],
237          grid=[2, 2],
238          component=[20, 20]),
239        Window(
240          x=0.25,
241          y=0.02,
242          width=0.6,
243          height=0.6),
244        Diagram,
245      Documentation(info="<html>
246<p>
247Block has one continuous Real output signal.
248</p>
249</html>"));
250    end SO;
251
252    partial block MO "Multiple Output continuous control block"
253      extends BlockIcon;
254
255      parameter Integer nout(min=1) = 1 "Number of outputs";
256      RealOutput y[nout] "Connector of Real output signals"
257        annotation (extent=[100, -10; 120, 10]);
258      annotation (
259        Coordsys(
260          extent=[-100, -100; 100, 100],
261          grid=[2, 2],
262          component=[20, 20]),
263        Window(
264          x=0.13,
265          y=0.03,
266          width=0.6,
267          height=0.6),
268        Documentation(info="<html>
269<p>
270Block has one continuous Real output signal vector.
271</p>
272</html>"));
273    end MO;
274
275    partial block SISO "Single Input Single Output continuous control block"
276      extends BlockIcon;
277
278      RealInput u "Connector of Real input signal"
279        annotation (extent=[-140, -20; -100, 20]);
280      RealOutput y "Connector of Real output signal"
281        annotation (extent=[100, -10; 120, 10]);
282      annotation (Coordsys(
283          extent=[-100, -100; 100, 100],
284          grid=[2, 2],
285          component=[20, 20]), Window(
286          x=0.32,
287          y=0.07,
288          width=0.6,
289          height=0.6),
290      Documentation(info="<html>
291<p>
292Block has one continuous Real input and one continuous Real output signal.
293</p>
294</html>"));
295    end SISO;
296
297    partial block SI2SO
298    "2 Single Input / 1 Single Output continuous control block"
299      extends BlockIcon;
300
301      RealInput u1 "Connector of Real input signal 1"
302        annotation (extent=[-140, 40; -100, 80]);
303      RealInput u2 "Connector of Real input signal 2"
304        annotation (extent=[-140, -80; -100, -40]);
305      RealOutput y "Connector of Real output signal"
306        annotation (extent=[100, -10; 120, 10]);
307
308      annotation (
309        Coordsys(
310          extent=[-100, -100; 100, 100],
311          grid=[2, 2],
312          component=[20, 20]),
313        Window(
314          x=0.31,
315          y=0.07,
316          width=0.6,
317          height=0.6),
318        Documentation(info="<html>
319<p>
320Block has two continuous Real input signals u1 and u2 and one
321continuous Real output signal y.
322</p>
323</html>"),
324        Diagram);
325    end SI2SO;
326
327partial block SIMO "Single Input Multiple Output continuous control block"
328  extends BlockIcon;
329  parameter Integer nout=1 "Number of outputs";
330      RealInput u "Connector of Real input signal"
331        annotation (extent=[-140, -20; -100, 20]);
332      RealOutput y[nout] "Connector of Real output signals"
333        annotation (extent=[100, -10; 120, 10]);
334
335  annotation (Documentation(info="<HTML>
336<p> Block has one continuous Real input signal and a
337    vector of continuous Real output signals.</p>
338
339</HTML>
340"));
341end SIMO;
342
343    partial block MISO "Multiple Input Single Output continuous control block"
344
345      extends BlockIcon;
346      parameter Integer nin=1 "Number of inputs";
347      RealInput u[nin] "Connector of Real input signals"
348        annotation (extent=[-140, -20; -100, 20]);
349      RealOutput y "Connector of Real output signal"
350        annotation (extent=[100, -10; 120, 10]);
351      annotation (Documentation(info="<HTML>
352<p>
353Block has a vector of continuous Real input signals and
354one continuous Real output signal.
355</p>
356</HTML>
357"));
358    end MISO;
359
360    partial block MIMO
361    "Multiple Input Multiple Output continuous control block"
362
363      extends BlockIcon;
364      parameter Integer nin=1 "Number of inputs";
365      parameter Integer nout=1 "Number of outputs";
366      RealInput u[nin] "Connector of Real input signals"
367        annotation (extent=[-140, -20; -100, 20]);
368      RealOutput y[nout] "Connector of Real output signals"
369        annotation (extent=[100, -10; 120, 10]);
370      annotation (Documentation(info="<HTML>
371<p>
372Block has a continuous Real input and a continuous Real output signal vector.
373The signal sizes of the input and output vector may be different.
374</p>
375</HTML>
376"));
377    end MIMO;
378
379    partial block MIMOs
380    "Multiple Input Multiple Output continuous control block with same number of inputs and outputs"
381
382      extends BlockIcon;
383      parameter Integer n=1 "Number of inputs (= number of outputs)";
384      RealInput u[n] "Connector of Real input signals"
385        annotation (extent=[-140, -20; -100, 20]);
386      RealOutput y[n] "Connector of Real output signals"
387        annotation (extent=[100, -10; 120, 10]);
388      annotation (
389        Documentation(info="<HTML>
390<p>
391Block has a continuous Real input and a continuous Real output signal vector
392where the signal sizes of the input and output vector are identical.
393</p>
394</HTML>
395"),     Coordsys(
396          extent=[-100, -100; 100, 100],
397          grid=[2, 2],
398          component=[20, 20]),
399        Window(
400          x=0.28,
401          y=0.16,
402          width=0.6,
403          height=0.6));
404    end MIMOs;
405
406    partial block MI2MO
407    "2 Multiple Input / Multiple Output continuous control block"
408      extends BlockIcon;
409
410      parameter Integer n=1 "Dimension of input and output vectors.";
411
412      RealInput u1[n] "Connector 1 of Real input signals"
413        annotation (extent=[-140, 40; -100, 80]);
414      RealInput u2[n] "Connector 2 of Real input signals"
415        annotation (extent=[-140, -80; -100, -40]);
416      RealOutput y[n] "Connector of Real output signals"
417        annotation (extent=[100, -10; 120, 10]);
418      annotation (
419        Coordsys(
420          extent=[-100, -100; 100, 100],
421          grid=[2, 2],
422          component=[20, 20]),
423        Window(
424          x=0.31,
425          y=0.07,
426          width=0.6,
427          height=0.6),
428        Documentation(info="<html>
429<p>
430Block has two continuous Real input vectors u1 and u2 and one
431continuous Real output vector y.
432All vectors have the same number of elements.
433</p>
434</html>"),
435        Diagram);
436    end MI2MO;
437
438    partial block SignalSource "Base class for continuous signal source"
439      extends SO;
440      parameter Real offset=0 "offset of output signal";
441      parameter SIunits.Time startTime=0 "output = offset for time < startTime";
442    annotation (Documentation(info="<html>
443<p>
444Basic block for Real sources of package Blocks.Sources.
445This component has one continuous Real output signal y
446and two parameters (offset, startTime) to shift the
447generated signal.
448</p>
449</html>"));
450    end SignalSource;
451
452    partial block SVcontrol "Single-Variable continuous controller"
453      extends BlockIcon;
454
455      RealInput u_s "Connector of setpoint input signal"
456        annotation (extent=[-140, -20; -100, 20]);
457      RealInput u_m "Connector of measurement input signal"
458        annotation (extent=[20, -100; -20, -140], rotation=-90);
459      RealOutput y "Connector of actuator output signal"
460        annotation (extent=[100, -10; 120, 10]);
461      annotation (
462        Diagram(
463          Text(extent=[-102, 34; -142, 24], string="(setpoint)"),
464          Text(extent=[100, 24; 140, 14], string="(actuator)"),
465          Text(extent=[-83, -112; -33, -102], string=" (measurement)")),
466        Coordsys(
467          extent=[-100, -100; 100, 100],
468          grid=[2, 2],
469          component=[20, 20]),
470        Window(
471          x=0.19,
472          y=0.21,
473          width=0.6,
474          height=0.46),
475      Documentation(info="<html>
476<p>
477Block has two continuous Real input signals and one
478continuous Real output signal. The block is designed
479to be used as base class for a corresponding controller.
480</p>
481</html>"));
482    end SVcontrol;
483
484    partial block MVcontrol "Multi-Variable continuous controller"
485      extends BlockIcon;
486
487      parameter Integer nu_s=1 "Number of setpoint inputs";
488      parameter Integer nu_m=1 "Number of measurement inputs";
489      parameter Integer ny=1 "Number of actuator outputs";
490      RealInput u_s[nu_s] "Connector of setpoint input signals"
491        annotation (extent=[-140, -20; -100, 20]);
492      RealInput u_m[nu_m] "Connector of measurement input signals"
493        annotation (extent=[20, -100; -20, -140], rotation=-90);
494      RealOutput y[ny] "Connector of actuator output signals"
495        annotation (extent=[100, -10; 120, 10]);
496      annotation (
497        Diagram(
498          Text(extent=[-100, 36; -140, 26], string="(setpoint)"),
499          Text(extent=[102, 24; 142, 14], string="(actuator)"),
500          Text(extent=[-75, -108; -25, -98], string=" (measurement)")),
501        Coordsys(
502          extent=[-100, -100; 100, 100],
503          grid=[2, 2],
504          component=[20, 20]),
505        Window(
506          x=0.26,
507          y=0.19,
508          width=0.6,
509          height=0.6),
510      Documentation(info="<html>
511<p>
512Block has two continuous Real input signal vectors and one
513continuous Real output signal vector. The block is designed
514to be used as base class for a corresponding controller.
515</p>
516</html>"));
517    end MVcontrol;
518
519    partial block DiscreteBlockIcon
520    "Graphical layout of discrete block component icon"
521      annotation (Icon(Rectangle(extent=[-100, -100; 100, 100], style(color=3,
522                fillColor=52)), Text(extent=[-150, 150; 150, 110], string=
523                "%name")), Documentation(info="<html>
524<p>
525Block that has only the basic icon for an input/output,
526discrete block (no declarations, no equations), e.g.,
527from Blocks.Discrete.
528</p>
529</html>"));
530    equation
531
532    end DiscreteBlockIcon;
533
534    partial block DiscreteBlock "Base class of discrete control blocks"
535      extends DiscreteBlockIcon;
536
537      parameter SI.Time samplePeriod(min=100*Modelica.Constants.eps) = 0.1
538      "Sample period of component";
539      parameter SI.Time startTime=0 "First sample time instant";
540  protected
541      output Boolean sampleTrigger "True, if sample time instant";
542      output Boolean firstTrigger "Rising edge signals first sample instant";
543    equation
544      sampleTrigger = sample(startTime, samplePeriod);
545      when sampleTrigger then
546        firstTrigger = time <= startTime + samplePeriod/2;
547      end when;
548    annotation (Documentation(info="<html>
549<p>
550Basic definitions of a discrete block of library
551Blocks.Discrete.
552</p>
553</html>"));
554    end DiscreteBlock;
555
556    partial block DiscreteSISO
557    "Single Input Single Output discrete control block"
558
559      extends DiscreteBlock;
560
561      Modelica.Blocks.Interfaces.RealInput u "Continuous input signal"
562                                  annotation (extent=[-140,
563              -20; -100, 20]);
564      Modelica.Blocks.Interfaces.RealOutput y "Continuous output signal"
565                                   annotation (extent=[100,
566              -10; 120, 10]);
567    annotation (Documentation(info="<html>
568<p>
569Block has one continuous input and one continuous output signal
570which are sampled due to the defined <b>samplePeriod</b> parameter.
571</p>
572</html>"));
573    end DiscreteSISO;
574
575    partial block DiscreteMIMO
576    "Multiple Input Multiple Output discrete control block"
577
578      extends DiscreteBlock;
579      parameter Integer nin=1 "Number of inputs";
580      parameter Integer nout=1 "Number of outputs";
581
582      Modelica.Blocks.Interfaces.RealInput u[nin] "Continuous input signals"
583                                   annotation (extent=[-140,
584              -20; -100, 20]);
585      Modelica.Blocks.Interfaces.RealOutput y[nout] "Continuous output signals"
586                                    annotation (extent=[100,
587              -10; 120, 10]);
588
589      annotation (Documentation(info="<html>
590<p>
591Block has a continuous input and a continuous output signal vector
592which are sampled due to the defined <b>samplePeriod</b> parameter.
593</p>
594</HTML>
595"));
596    end DiscreteMIMO;
597
598    partial block DiscreteMIMOs
599    "Multiple Input Multiple Output discrete control block"
600      parameter Integer n=1 "Number of inputs (= number of outputs)";
601      extends DiscreteBlock;
602
603      Modelica.Blocks.Interfaces.RealInput u[n] "Continuous input signals"
604                                   annotation (extent=[-140,
605              -20; -100, 20]);
606      Modelica.Blocks.Interfaces.RealOutput y[n] "Continuous output signals"
607                                    annotation (extent=[100,
608              -10; 120, 10]);
609
610      annotation (Documentation(info="<html>
611<p>
612Block has a continuous input and a continuous output signal vector
613where the signal sizes of the input and output vector are identical.
614These signals are sampled due to the defined <b>samplePeriod</b> parameter.
615</p>
616</HTML>
617"));
618
619    end DiscreteMIMOs;
620
621    partial block SVdiscrete "Discrete Single-Variable controller"
622      extends DiscreteBlock;
623
624      Discrete.Sampler sampler_s(
625        final samplePeriod=samplePeriod,
626        final startTime=startTime) annotation (extent=[-100, -10; -80, 10]);
627      Discrete.Sampler sampler_m(
628        final samplePeriod=samplePeriod,
629        final startTime=startTime) annotation (extent=[-10, -100; 10, -80],
630          rotation=90);
631      Modelica.Blocks.Interfaces.RealInput u_s
632      "Continuous scalar setpoint input signal"   annotation (extent=[-140, -20; -
633            100, 20]);
634      Modelica.Blocks.Interfaces.RealInput u_m
635      "Continuous scalar measurement input signal"   annotation (extent=[20, -100; -
636            20, -140], rotation=-90);
637      Modelica.Blocks.Interfaces.RealOutput y
638      "Continuous scalar actuator output signal"   annotation (extent=[100, -10; 120,
639              10]);
640      annotation (Diagram(
641          Text(
642            extent=[-100, 34; -140, 24],
643            string="(setpoint)",
644            style(color=0)),
645          Text(
646            extent=[100, 22; 130, 14],
647            string="(actuator)",
648            style