InstrumentsExample.ned 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package inet.examples.visualization.instruments;
  2. import inet.common.misc.SignalSource;
  3. import inet.common.figures.DelegateSignalConfigurator;
  4. network InstrumentsExample
  5. {
  6. parameters:
  7. @display("bgb=800,450");
  8. @figure[text](type=indicatorText; pos=20,50; anchor=w);
  9. @statistic[text](source=signalSourceOutput; record=figure; targetFigure=text);
  10. @figure[label](type=indicatorLabel; pos=20,80; anchor=w);
  11. @statistic[label](source=signalSourceOutput; record=figure; targetFigure=label);
  12. @figure[gauge](type=gauge; pos=50,100; size=150,150);
  13. @statistic[gauge](source=signalSourceOutput; record=figure; targetFigure=gauge);
  14. @figure[lineargauge](type=linearGauge; pos=300,50; size=300,50);
  15. @statistic[lineargauge](source=signalSourceOutput; record=figure; targetFigure=lineargauge);
  16. @figure[progress](type=progressMeter; pos=300,150; size=300,20);
  17. @statistic[progress](source=signalSourceOutput; record=figure; targetFigure=progress);
  18. @figure[counter](type=counter; pos=300,250);
  19. @statistic[counter](source=signalSourceOutput; record=figure; targetFigure=counter);
  20. @figure[thermometer](type=thermometer; pos=700,50; size=50,300);
  21. @statistic[thermometer](source=signalSourceOutput; record=figure; targetFigure=thermometer);
  22. @figure[image](type=indexedImage; pos=240,280; size=16,16; images=status/off,status/green,status/red);
  23. @statistic[image](source=signalSourceOutput; record=figure; targetFigure=image); // note: indexedImage takes the value modulo the number of images
  24. @figure[plot](type=plot; pos=420,270; size=200,100);
  25. @statistic[plot](source=signalSourceOutput; record=figure; targetFigure=plot);
  26. signalSource.value = default(dropUnit(simTime()));
  27. submodules:
  28. signalSource: SignalSource {
  29. @display("p=50,350;is=s");
  30. }
  31. }
  32. network InstrumentsExample2 extends InstrumentsExample
  33. {
  34. parameters:
  35. @figure[text](textFormat="Value=%g (An Indicator Text)"; initialValue=0);
  36. @figure[label](textFormat="Value=%g (An Indicator Label)"; initialValue=0);
  37. @figure[gauge](backgroundColor=lightBlue; needleColor=yellow; initialValue=0; minValue=-10; maxValue=10; tickSize=2; label="A Gauge"; labelFont="Arial,10pt,italic"; labelColor="grey"; colorStrip=green 0.6 yellow 0.9 red);
  38. @figure[lineargauge](backgroundColor=lightBlue; needleColor=magenta; initialValue=0; cornerRadius=5; minValue=-10; maxValue=10; tickSize=2; label="A Linear Gauge"; labelFont="Arial,10pt,italic"; labelColor="grey");
  39. @figure[progress](backgroundColor=white; initialValue=0; stripColor=darkorange; text="%g (%.4g%%)"; textFont="Arial,14pt,bold"; textColor="blue4"; cornerRadius=5; borderWidth=4; minValue=-10; maxValue=10; label="A Progress Meter"; labelFont="Arial,10pt,italic"; labelColor="grey");
  40. @figure[counter](backgroundColor=white; initialValue=0; decimalPlaces=5; digitBackgroundColor=lightGreen; digitBorderColor=grey; digitFont="Arial,20pt,bold"; digitColor=grey; label="A Counter"; labelFont="Arial,10pt,italic"; labelColor="grey");
  41. @figure[thermometer](mercuryColor=firebrick; initialValue=0; minValue=-10; maxValue=10; tickSize=2; label="A Thermometer"; labelFont="Arial,10pt,italic"; labelColor="grey");
  42. @figure[image](images=trafficlight_off,trafficlight_red,trafficlight_yellow,trafficlight_green,trafficlight_redyellow; initialValue=9; size=-,-; opacity=0.8; tintColor=yellow; tintAmount=0.1; labelOffset=1, 35; label="An Indexed Image"; labelFont="Arial,10pt,italic"; labelColor="grey");
  43. @figure[plot](backgroundColor=lightBlue; lineColor=red3; minValue=-10; maxValue=10; valueTickSize=5; timeWindow=100; timeTickSize=20; label="A Plot"; labelFont="Arial,10pt,italic"; labelColor="grey");
  44. signalSource.value = 12*sin(0.05 * dropUnit(simTime()));
  45. }