“Stratification effect com-pensation for improved underwater acoustic ranging,” IEEE Transactions on Signal Processing, vol. 56, no. 8, pp. 546- 549, 2008.
S. Kay, Fundamentals of Statistical Signal Processing: Estimation Theory, Prentice-Hall, 1993.
پیوست ها
پیوست الف، قسمت اصلی برنامه شامل توابع و زیرتوابع
warning off all
%Run simulation
NoiseVarVec = 30: 2: 50;
DiffNoiseMean = [2, 1e-3]; %mean of NLOS noise
%simulation flags
AddSyncNoiseFlag = 1; %if up then add synchronization skew and offset
OneSkewFlag = 0; %if up then consider anchor nodes to be synchronized
ChangeCFlag = 1; %if up then real sound speed is different than nominal one
AddNoiseFlag = 1;%if up then add ToA measurment noise
Pe = 0; %probability to drop a packet
CheckFlag = 0; % if up than check software correctness
%system parameters
MaxSroundSlots = 4/2;
StopW = 40; %number of reference point in the simulation
ThPIndex = 15; %number of received packets to stop localization
Tslot = 5; %slot time
NodeNum = 4; %number of nodes
CurrentNodeID = 4;
SlotRatio3Anchor = (4*StopW / (4+1)) / (3*StopW / (3+1)); %ratio of slots added to account for one more anchor node
SlotRatio2UL = (StopW / (3+2)) / (StopW / (3+1)); %ratio of slots reduced to account for 2 UL nodes
%Simulate locations parameters
GapSlots = 4/2; %gap between each location change
MaxSlotNum = 100; %Experiment time [time slots]
DiffSec = 10; %limit to move the node [coordinate seconds]
UpperLimit = 1; %upper limit for multiply of DiffSec to move the node
LowerLimit = 0.9;%lower limit for multiply of DiffSec to move the node
DelaySpread = inf; %noise cannot exceed this value
RefMinLong = [0, 0, 0];
RefMinLat = [0, 0, 0];
if AddNoiseFlag
VarNoiseVec = 1 ./ (10 .^ (NoiseVarVec ./ 10));
else
VarNoiseVec = 1 ./ (10 .^ (200 ./ 10));
end
SimNum = 1000;
%——————————–
%results
MyMethod = zeros(length(VarNoiseVec), SimNum, 2);
MyMethodDiffNoise = zeros(length(VarNoiseVec), SimNum, 2);
MyMethod3Anchor = zeros(length(VarNoiseVec), SimNum, 2);
MyMethod2UL = zeros(length(VarNoiseVec), SimNum, 2);
CRBVec = zeros(length(VarNoiseVec), SimNum, 2);
TimeOffset = zeros(length(VarNoiseVec), SimNum);
%——————————–
for SimInd = 1: SimNum
for VarNoiseInd = 1: length(VarNoiseVec)
VarNoise = VarNoiseVec(VarNoiseInd);
if ~AddSyncNoiseFlag
SyncMat = [ones(1, NodeNum), zeros(1, NodeNum)];
else
SyncMat = FindSyncVec(RefNumSync, NodeNum, Tslot, OneSkewFlag);
end
SyncVec = SyncMat(1, :);
%create simulation scenario
[TpdMat, TpdMatNoise, ToAMatrix, ToAMatrixTx, ToAMatrixDiffNoise, … ToAMatrixNoNoise, RxToAMatrixNoMove, …
TxToAMatrixNoMove, CurrentNodeX, CurrentNodeY, … CurrentNodeXNoMove, CurrentNodeYNoMove, … AnchorLocationMatrixX, AnchorLocationMatrixY,…
MotionMat, AngleMat, AngleSignMat] = …
SimulateSenarioCDF2(SyncVec, Pe, Tslot, NodeNum, CurrentNodeID, …
GapSlots, MaxSlotNum, DiffSec, UpperLimit, LowerLimit, VarNoise,…
DelaySpread, DiffNoiseMean, RefMinLong, RefMinLat);
%run The proposed method and benchmark methods
[MethodIterate, MethodIterateDiffNoise, MethodIterate3Anchor,…
MethodIterate2UL, CRB]…
= RunMethodsAllPoints(ToAMatrix, ToAMatrixTx, TpdMatNoise, ToAMatrixDiffNoise, ToAMatrixNoNoise, …
RxToAMatrixNoMove, TxToAMatrixNoMove, AnchorLocationMatrixX,…
AnchorLocationMatrixY, MotionMat, AngleMat, AngleSignMat, MaxSroundSlots, Tslot, CurrentNodeID, StopW, ThPIndex, …
SyncVec(1:NodeNum), SyncVec(NodeNum+1: 2*NodeNum), TpdMat, …
CurrentNodeX, CurrentNodeY,CurrentNodeXNoMove, CurrentNodeYNoMove,…
VarNoise, SlotRatio3Anchor, SlotRatio2UL);
%——————–
%get results
TimeOffset(VarNoiseInd, SimInd, 🙂 = (mean(SyncVec(1:NodeNum))*StopW +
mean(SyncVec(NodeNum+1:end)))-StopW ;
MyMethod(VarNoiseInd, SimInd, 🙂 = MethodIterate;
MyMethodDiffNoise(VarNoiseInd, SimInd, 🙂 = MethodIterateDiffNoise;
MyMethod3Anchor(VarNoiseInd, SimInd, 🙂 = MethodIterate3Anchor ;
MyMethod2UL(VarNoiseInd, SimInd, 🙂 = MethodIterate2UL;
CRBVec(VarNoiseInd, SimInd) = CRB;
%——————–
end
end
پیوست ب، زیر تابع RunMethodAllpoint
function [MyMethodDerrorIterateVec, MyMethodDerrorIterateVecDiffNoise,…
MyMethodDerrorIterateVec3Anchor, MyMethodDerrorIterateVec2UL,CRB]…
= RunMethodsAllPoints(ToAMatrix, ToAMatrixTx, TpdMatNoise,…
ToAMatrixDiffNoise, ToAMatrixNoNoise, RxToAMatrixNoMove,…
TxToAMatrixNoMove, AnchorLocationMatrixX, AnchorLocationMatrixY, …
MotionMat, AngleMat, AngleSignMat,MaxSroundSlots, Tslot,…
CurrentNodeID, StopW, ThPIndex, …
SkewVec, OffsetVec, TpdMat, CurrentNodeX, CurrentNodeY,…
CurrentNodeXNoMove, CurrentNodeYNoMove, NoiseVar,…
SlotRatio3Anchor, SlotRatio2UL)
%Description:
% This function operates the the proposed method and benchmark solution
%Input:
% ToAMatrix – estimated ToA [sec]
% ToAMatrixTx – transmission time (starting of slot) [sec]
% TpdMatNoise – matrix of noisy propagation delays [sec]
% ToAMatrixDiffNoise – estimated ToA for alternative noise model [sec]
% ToAMatrixNoNoise – actual ToA matrix [sec]
% RxToAMatrixNoMove – receiver clock ToA matrix when nodes are fixed [sec]
% TxToAMatrixNoMove – transmitter clock ToA matrix when nodes are fixed [sec]
% AnchorLocationMatrixX – X position of the anchor nodes
% AnchorLocationMatrixY – Y position of the anchor nodes
% MotionMat – inerciel system distance matrix [m]
% AngleMat – inerciel system angle matrix [deg]
% AngleSignMat – inerciel system sign matrix
% RefC – pre-assumed sound speed [m/sec]
% MaxSroundSlots – maximum number of time slots to look for anchor node location
% Tslot – slot time [sec]
% CurrentNodeID – the ID of the current UL node
% StopW – localization window [time slots]
% ThPIndex – number of received packets to stop localization
% SkewVec – vector of clock skew (N elements)
% OffsetVec – vector of clock offset (N elements)
% TpdMat – matrix of real propagation delays [sec]
% CurrentNodeX – X position of the UL node
% CurrentNodeY – Y position of the UL node
% CurrentNodeXNoMove – X position of the UL node when nodes are fixed
% CurrentNodeYNoMove – Y position of the UL node when nodes are fixed
% VarNoise – variance of Tpd noise
% SlotRatio3Anchor – ratio of slots added to account for one more anchor node
% SlotRatio2UL – ratio of slots reduced to account for 2 UL nodes
%
%Output:
% MyMethodDerrorIterateVec – error for the proposed method [m]
% MyMethodDerrorIterateVecDiffNoise – error for the proposed method with alternative noise [m]
% MyMethodDerrorIterateVec3Anchor – error for the proposed method with 3 anchor nodes [m]
% MyMethodDerrorIterateVec2UL – error for the proposed method with 2 UL nodes [m]
% CRB – error for CRB [m]
NodeNum = size(ToAMatrix, 2);
SlotVec = ceil(1/(1 – SlotRatio2UL)): StopW;
%initialize results
MyMethodDerrorIterateVec = (-1)*ones(2, length(SlotVec));
MyMethodDerrorIterateVecDiffNoise = (-1)*ones(2, length(SlotVec));
MyMethodDerrorIterateVec2UL = (-1)*ones(2, length(SlotVec));
MyMethodDerrorIterateVec3Anchor = (-1)*ones(2, length(SlotVec));
CRBVec = (-1)*ones(1, length(SlotVec));
InitiateFlag = 1;
%run over time slots in localization window
for SlotInd = SlotVec
%do localization in this slot if there is new information
if (sum(ToAMatrix(SlotInd, CurrentNodeID, :)) 0)
|| (sum(ToAMatrix(SlotInd, :, CurrentNodeID)) 0)
LastUpdatedSlotNum = SlotInd;
LastUpdatedSlotNum3Anchor = ceil(SlotInd * SlotRatio3Anchor);
LastUpdatedSlotNum2UL = ceil(SlotInd * SlotRatio2UL);
%perform time synchronization for the proposed method
[EstTpdMat, EstSkewVec, EstOffsetVec] = PerfomeTimeSync(ToAMatrix,…
ToAMatrixTx, MaxSroundSlots, …
CurrentNodeID, LastUpdatedSlotNum);
%perform time synchronization for the proposed method with alternative noise
[EstTpdMatDiffNoise] = …
PerfomeTimeSync(ToAMatrixDiffNoise, ToAMatrixTx, MaxSroundSlots,…
CurrentNodeID, LastUpdatedSlotNum);
%perform time synchronization for the proposed method with 3 anchor nodes
[EstTpdMat3Anchor] = …
PerfomeTimeSync(ToAMatrix, ToAMatrixTx, MaxSroundSlots,…
CurrentNodeID, LastUpdatedSlotNum3Anchor);
%perform time synchronization for the proposed method with 2 UL nodes
[EstTpdMat2UL] = …
PerfomeTimeSync(ToAMatrix, ToAMatrixTx, MaxSroundSlots,…
CurrentNodeID, LastUpdatedSlotNum2UL);
%perform localization only if time-sync succedded
if (~isempty(EstTpdMat)) && (~isempty(EstTpdMatDiffNoise))…
&& (~isempty(EstTpdMat3Anchor)) && (~isempty(EstTpdMat2UL))
%———————————————–
%perform the proposed method localization
[PIndex, CurrentXIterate, CurrentYIterate,CurrentXLS, CurrentYLS] = …
PerformLocalization(InitiateFlag, EstTpdMat, AnchorLocationMatrixX,…
AnchorLocationMatrixY, MotionMat, AngleMat, AngleSignMat,…

مطلب مرتبط :   منبع مقاله دربارهتکرار جرم، قانون مجازات، قصاص

Written by 

دیدگاهتان را بنویسید