0001 function observations = get_observations( services, sensors, targets, allocs )
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 observations = struct('sensor_id', {}, 'target_id', {}, 'data_format', {}, 'data', {}, 'accuracy', {});
0016
0017 noOfSensors = length( sensors );
0018 noOfTargets = length( targets );
0019
0020
0021
0022 for s=1:noOfSensors
0023 sensor = sensors( s );
0024 service = services( find_sensor_services( sensor, services ) );
0025
0026 for t=1:noOfTargets
0027 plts = targets( t ).plt;
0028 noOfPlts = length(plts);
0029
0030 for p=1:noOfPlts
0031 detection_degree = feval(sensor.detection_model, sensor, plts(p));
0032 if ( detection_degree == 1 )
0033
0034 disp(['Observation occurred for sensor: ' sensor.id ' of enemy platoon: ' plts(p).id]);
0035
0036 noise = rand(1,2)*service.quality.accuracy;
0037 observed_position = cog( plts(p).real_pos ) + noise;
0038
0039 observations( end+1 ) = struct('sensor_id', sensor.id, 'target_id', plts(p).id, 'data_format', 'position', 'data', observed_position, 'accuracy', service.quality.accuracy);
0040 end
0041 end
0042 end
0043 end
0044
0045
0046