README 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. This is an example for instrument figures. Here is some background and
  2. usage info on instrument figures.
  3. The following instrument figure types exist: gauge, linearGauge,
  4. progressMeter, thermometer, counter, indicatorLabel, and indicatorText.
  5. They are implemented with the C++ types GaugeFigure, LinearGaugeFigure,
  6. ProgressMeterFigure, ThermometerFigure, CounterFigure,
  7. IndicatorLabelFigurea and IndicatorTextFigure. These C++ types all
  8. implement IIndicatorFigure.
  9. In practice, instrument figures are driven by signals, using a @statistic
  10. for converting emitted signals into calls to IIndicatorFigure's setValue()
  11. method. An example:
  12. @figure[thruputMeter](type=gauge; pos=50,100; size=150,150);
  13. @statistic[dummy](source=throughput; record=figure; targetFigure=thruputMeter);
  14. The first line adds a figure of the type GaugeFigure to the canvas, with
  15. the name thruputMeter. The second line adds a special "figure" result
  16. recorder for the throughput signal. The result recorder (see the
  17. FigureRecorder C++ class) sends every emitted value to the figure denoted
  18. by the targetFigure attribute of the @statistic, in this case thruputMeter.
  19. One issue is that @statistic can only add signal listeners to the current
  20. module (on which the @statistic is declared), but not to a submodule or
  21. sub-submodule. The workaround for this issue is to use a @delegatesignal
  22. property to "teleport" the signal from its emitted module to the module of
  23. the @statistic, under a new name. An example:
  24. @delegatesignal[rcvdPk](source=hostB.udpApp[0].rcvdPk; target=hostB_rcvdPk);
  25. @signal[hostB_rcvdPk];
  26. The first line adds a listener to the hostB.udpApp[0] submodule for the
  27. rcvdPk signal, and emits it on the current module as hostB_rcvdPk. A
  28. @statistic can then use hostB_rcvdPk as its source signal. The second,
  29. @signal line is necessary because OMNeT++ only allows declared signals to
  30. be emitted.
  31. IMPORTANT: When using @delegatesignal, the network must contain a
  32. DelegateSignalConfigurator module somewhere, because it is what processes
  33. those properties and makes them work.
  34. See the Wireless Tutorial (tutorials/wireless) for an example.