1 | /************************************************************************************ |
---|
2 | * Copyright (C) 2008 by Politehnica University of Bucharest and Rutgers University |
---|
3 | * All rights reserved. |
---|
4 | * Refer to LICENSE for terms and conditions of use. |
---|
5 | ***********************************************************************************/ |
---|
6 | //Petroaca - object which measures the interference and noise on the station for the duration of a frame |
---|
7 | package vnsim.network.dsrc; |
---|
8 | |
---|
9 | import vnsim.map.object.Globals; |
---|
10 | |
---|
11 | public class NoiseMonitor |
---|
12 | { |
---|
13 | private double InterferenceAndNoiseLevel; |
---|
14 | // the Signal to Interference/Noise Ratio threshold |
---|
15 | |
---|
16 | //the natural noise an antenna experiences |
---|
17 | private double thermalNoise; |
---|
18 | |
---|
19 | //constructor - initialising the IAndN with the value of the thermalNoise and the SINRThreshold with the value best suited for the type of modulation |
---|
20 | public NoiseMonitor(double thermalNoise) |
---|
21 | { |
---|
22 | this.thermalNoise=thermalNoise; |
---|
23 | this.InterferenceAndNoiseLevel=this.thermalNoise; |
---|
24 | } |
---|
25 | |
---|
26 | //when the frame time changes the interference returns to its initial value |
---|
27 | public void refreshInterference() |
---|
28 | { |
---|
29 | this.InterferenceAndNoiseLevel=this.thermalNoise; |
---|
30 | } |
---|
31 | |
---|
32 | |
---|
33 | public void addInterference(double receivedPower) |
---|
34 | { |
---|
35 | this.InterferenceAndNoiseLevel+=receivedPower; |
---|
36 | } |
---|
37 | |
---|
38 | public double getInterference() |
---|
39 | { |
---|
40 | return this.InterferenceAndNoiseLevel; |
---|
41 | } |
---|
42 | |
---|
43 | public double getThermalNoise() |
---|
44 | { |
---|
45 | return this.thermalNoise; |
---|
46 | } |
---|
47 | } |
---|