InterpolatingAntenna.test 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. %description:
  2. Tests InterpolatingAntenna for a simple configuration.
  3. %file: test.cc
  4. #include "inet/physicallayer/contract/packetlevel/IAntenna.h"
  5. namespace InterpolatingAntenna {
  6. using namespace inet;
  7. using namespace inet::physicallayer;
  8. class AntennaTest : public cSimpleModule
  9. {
  10. public:
  11. AntennaTest() : cSimpleModule() {}
  12. protected:
  13. virtual int numInitStages() const { return NUM_INIT_STAGES; }
  14. virtual void initialize(int stage);
  15. };
  16. Define_Module(AntennaTest);
  17. void AntennaTest::initialize(int stage)
  18. {
  19. if (stage == INITSTAGE_LAST)
  20. {
  21. IAntenna *antenna = check_and_cast<IAntenna *>(getSimulation()->getModuleByPath("host.wlan[0].radio.antenna"));
  22. EV_INFO << antenna->computeGain(EulerAngles(0, 0, 0)) << " "
  23. << antenna->computeGain(EulerAngles(M_PI / 2, 0, 0)) << " "
  24. << antenna->computeGain(EulerAngles(M_PI, 0, 0)) << " "
  25. << antenna->computeGain(EulerAngles(3 * M_PI / 2, 0, 0)) << " "
  26. << antenna->computeGain(EulerAngles(2 * M_PI, 0, 0)) << "\n";
  27. }
  28. }
  29. }
  30. %file: test.ned
  31. import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
  32. import inet.node.inet.WirelessHost;
  33. import inet.physicallayer.ieee80211.packetlevel.Ieee80211ScalarRadioMedium;
  34. simple AntennaTest
  35. {
  36. // @class(::inet::physicallayer::InterpolatingAntenna::AntennaTest);
  37. }
  38. network Test
  39. {
  40. submodules:
  41. radioMedium: Ieee80211ScalarRadioMedium;
  42. configurator: IPv4NetworkConfigurator;
  43. host: WirelessHost;
  44. test: AntennaTest;
  45. }
  46. %inifile: omnetpp.ini
  47. [General]
  48. network = Test
  49. sim-time-limit = 400us
  50. ned-path = .;../../../../src
  51. #omnetpp 5.0 - 5.1 compatibility:
  52. eventlog-file = "${resultdir}/${configname}-${runnumber}.elog"
  53. output-scalar-file = "${resultdir}/${configname}-${runnumber}.sca"
  54. output-vector-file = "${resultdir}/${configname}-${runnumber}.vec"
  55. snapshot-file = "${resultdir}/${configname}-${runnumber}.sna"
  56. # mobility
  57. **.mobility.constraintAreaMinZ = 0m
  58. **.mobility.constraintAreaMinX = 0m
  59. **.mobility.constraintAreaMinY = 0m
  60. **.mobility.constraintAreaMaxX = 1000m
  61. **.mobility.constraintAreaMaxY = 1000m
  62. **.mobility.constraintAreaMaxZ = 0m
  63. **.mobility.initFromDisplayString = false
  64. # radio medium
  65. *.radioMedium.backgroundNoise.power = -110dBm
  66. # antenna
  67. **.antennaType = "InterpolatingAntenna"
  68. **.headingGains = "0 0 180 10 360 0"
  69. %contains: stdout
  70. 1 5.5 10 5.5 1
  71. %#--------------------------------------------------------------------------------------------------------------
  72. %not-contains: stdout
  73. undisposed object:
  74. %not-contains: stdout
  75. -- check module destructor
  76. %#--------------------------------------------------------------------------------------------------------------