I am implementing a WSN algorithm in Castalia. I need to calculate sensing range of the sensing device. I know I will need to use the sensing sensitivity parameter but what will be the exact equation?
相关问题
- Is it possible to use RInside in omnet++/Veins pro
- How to create own header structure in OMNET++
- How to get Coordinates of each vehicle in VEINS?
- Omnet++ , veins , the number of neighbors nodes fo
- How to collect traffic data and macroscopic statis
相关文章
- Wave Service Advertisement (WSA) implementation
- Omnet++ : Ad Hoc Network
- How can I get a traffic light that exists in sumo
- How can I combine my customize module with Omnet++
- Using a subset of a SUMO scenario for OMNeT++ netw
- Is it possible to detect LTE connection using iOS
- “no route to host” on device on getOutputStream()
- Transmission of vehicular status in Veins
The answer will vary depending on the behaviour specified by the PhysicalProcess module used. Since you say in your comment that you may be using the CarsPhysicalProcess let's use that as an example.
A sensor reading request initiated by the application is first sent to the SensorManager via a
SensorReadingMessage
message. InSensorManager.cc
you can see how this is processed in itshandleMessage
function:As you can see, what it's doing is first working out how much time has elapsed since the last sensor reading request for this sensor. If it's less time than specified by the minSamplingInterval possible for this sensor (this is determined by the maxSampleRates NED parameter of the SensorManager), it just returns the last sensor reading given. If it's greater, a new sensor reading is made.
A new sensor reading is made by sending a
PhysicalProcessMessage
message to the PhysicalProcess module (via thetoNodeContainerModule
gate). In the message we pass the X and Y coordinates of the node.Now, if we have specified CarsPhysicalProcess as the physical process to be used in our omnetpp.ini file, the
CarsPhysicalProcess
module will receive this message. You can see this inCarsPhysicalProcess.cc
:You can see that we calculate a sensor value based on the X and Y coordinates of the node, and the time at which the sensor reading was made. The response is sent back to the SensorManager via the
toNode
gate. So we need to look at thecalculateScenarioReturnValue
function to understand what's going on:We start with a sensor return value of 0. Then we loop over every car that is on the road (if you look at the
TIMER_SERVICE
case statement in thehandleMessage
function, you will see that CarsPhysicalProcess puts cars on the road randomly according to thecar_interarrival
rate, up to a maximum ofmax_num_cars
number of cars). For every car, we calculate how far the car has travelled down the road, and then calculate the distance between the car and the node. Then for each car we add to the return value based on the formula:Where
distance
is the distance we have calculated between the car and the node,K_PARAM = 0.1
,A_PARAM = 1
(defined at the top of CarsPhysicalProcess.cc) andcar_value
is a number specified in the CarsPhysicalProcess.ned parameter file (default is 30).This value is passed back to the SensorManager. The SensorManager then may change this value depending on the sensitivity, resolution, noise and bias of the sensor (defined as SensorManager parameters):
So you can see that if the value is below the sensitivity of the sensor, the floor of the sensitivity is returned.
So basically you can see that there is no specific 'sensing range' in Castalia - it all depends on how the specific PhysicalProcess handles the message. In the case of CarsPhysicalProcess, as long as there is a car on the road, it will always return a value, regardless of the distance - it just might be very small if the car is a long distance away from the node. If the value is very small, you may receive the lowest sensor sensitivity instead. You could increase or decrease the
car_value
parameter to get a stronger response from the sensor (so this is kind of like a sensor range)EDIT--- The default sensitivity (which you can find in
SensorManager.ned
) is 0. Therefore for CarsPhysicalProcess, any car on the road at any distance should be detected and returned as a value greater than 0. In other words, there is an unlimited range. If the car is very, very far away it may return a number so small it becomes truncated to zero (this depends on the limits in precision of a double value in the implementation of c++)If you wanted to implement a sensing range, you would have to set a value for
devicesSensitivity
inSensorManager.ned
. Then in your application, you would test to see if the returned value is greater than the sensitivity value - if it is, the car is 'in range', if it is (almost) equal to the sensitivity it is out of range. I say almost because (as we have seen earlier) the SensorManager adds noise to the value returned, so for example if you have a sensitivity value of 5, and no cars, you will get values which will hover slightly around 5 (e.g. 5.0001, 4.99)With a sensitivity value set, to calculate the sensing range (assuming only 1 car on the road), this means simply solving the equation above for distance, using the minimum sensitivity value as the returned value. i.e. if we use a sensitivity value of 5:
Substitute values for the parameters, and use algebra to solve for distance.