| 1 | [wiki:WikiStart Orbit] > [wiki:Tutorial Tutorial] > Using Noise Generator |
| 2 | |
| 3 | = Using Noise Generator in Experiments = |
| 4 | |
| 5 | The main idea is this: |
| 6 | |
| 7 | Along with node definitions in the first part of the experiment script, |
| 8 | you also define the antenna to be a part of the experiment |
| 9 | |
| 10 | The antennas are located here: |
| 11 | * Antenna 1: Between node2-1 and node2-2 |
| 12 | * Antenna 2: Between node2-7 and node2-8 |
| 13 | * Antenna 3: Between node7-1 and node7-2 |
| 14 | * Antenna 4: Between node7-7 and node7-8. |
| 15 | |
| 16 | Attached is a template script to use the noise generator. Please use tutorial-noise.rb as a baseline |
| 17 | |
| 18 | The configurable parameters are |
| 19 | * channel on which you want to operate: |
| 20 | Valid channels are 1..11, 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157 and 161 |
| 21 | * Noise power on these channels: Limits are from -90 dBm to +5 dBm |
| 22 | |
| 23 | Here is a template script to use the noise generator |
| 24 | {{{ |
| 25 | Experiment.name = "tutorial-1a" |
| 26 | Experiment.project = "orbit:tutorial" |
| 27 | Experiment.defProperty('noisePower', -44, 'Noise level injected') |
| 28 | # |
| 29 | # Define nodes used in experiment |
| 30 | # |
| 31 | defNodes('sender', [1,2]) {|node| |
| 32 | node.image = nil # assume the right image to be on disk |
| 33 | node.prototype("test:proto:sender", { |
| 34 | 'destinationHost' => '192.168.1.1', |
| 35 | 'packetSize' => 1024, |
| 36 | 'rate' => 300, |
| 37 | 'protocol' => 'udp' |
| 38 | }) |
| 39 | node.net.w0.mode = "master" |
| 40 | } |
| 41 | |
| 42 | defNodes('receiver', [1,1]) {|node| |
| 43 | node.image = nil # assume the right image to be on disk |
| 44 | node.prototype("test:proto:receiver" , { |
| 45 | 'hostname' => '192.168.1.1', |
| 46 | 'protocol' => 'udp' |
| 47 | }) |
| 48 | node.net.w0.mode = "managed" |
| 49 | } |
| 50 | |
| 51 | allNodes.net.w0 { |w| |
| 52 | w.type = 'b' |
| 53 | w.essid = "helloworld" |
| 54 | } |
| 55 | |
| 56 | antenna(4,4).signal {|s| |
| 57 | s.bandwidth = 20 |
| 58 | s.channel = 36 |
| 59 | s.power = prop.noisePower |
| 60 | } |
| 61 | # |
| 62 | # Now, start the application |
| 63 | # |
| 64 | whenAllInstalled() {|node| |
| 65 | |
| 66 | #Then start receiver and sender |
| 67 | NodeSet['receiver'].startApplications |
| 68 | wait 30 |
| 69 | NodeSet['sender'].startApplications |
| 70 | |
| 71 | antenna(4,4).signal.on |
| 72 | |
| 73 | # Step noise power from -44 to 0dbm in steps of 4db |
| 74 | -44.step(0, 4) { |p| |
| 75 | |
| 76 | prop.noisePower = p |
| 77 | wait 5 |
| 78 | } |
| 79 | wait 10 |
| 80 | Experiment.done |
| 81 | } |
| 82 | |
| 83 | }}} |