Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

Mobility, spatial and temporal awareness

Mobility, spatial and temporal awareness covers how pervasive systems determine and use where (space) and when (time) information — including sensing, models, estimation, synchronization and mobility management.

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Engineers use mobility, spatial and temporal awareness when devices must know their location, track moving users or sensors, coordinate actions in time, or manage handovers between networks. Correct spatial and temporal information is essential for context-aware applications (see Context and context-aware computing), indoor navigation, sensor fusion, activity recognition and coordinated services in smart environments.

Key ideas

  • Location sensing methods: common methods are GNSS/GPS (satellite-based positioning), Wi‑Fi fingerprinting (match measured radio signal pattern to a database), RSSI-based ranging (estimate distance from received signal strength), time-of-flight (ToF) / time-difference-of-arrival (TDoA) (use signal travel time), angle-of-arrival (AoA), inertial/dead-reckoning (use accelerometer/gyroscope to estimate movement), and vision-based (camera + SLAM). Define terms: RSSI is Received Signal Strength Indicator; ToF is time a signal takes to travel between transmitter and receiver. Note: TDoA requires synchronized anchors/base stations; AoA requires antenna arrays (or dual-antenna phase measurements); UWB ToF/TDoA often achieves decimeter-level accuracy indoors.

  • Error and accuracy: every sensing method has error (difference between measured and true value) and precision (repeatability). Define bias (systematic error) and variance (random error). For example, GPS typical horizontal accuracy in open sky is on the order of 3–10 m (depends on receiver and conditions). Accuracy depends strongly on dilution of precision (GDOP/PDOP), multipath and atmospheric effects, and may be improved with augmentation (e.g., SBAS, RTK).

  • Propagation models: used to relate signal measurements to distance. The Friis transmission equation gives received power in free space; the log-distance path loss model extends to environments with a path-loss exponent n.

    • Assumptions: Friis assumes free-space line-of-sight and far-field conditions; log-distance model assumes average exponential decay with distance and a Gaussian random shadowing term. Far-field typically requires d >> λ (and for large antennas d ≳ 2·D^2/λ, where D is the largest antenna dimension).
  • Sensor fusion and state estimation: combine multiple noisy measurements to estimate state (e.g., position and velocity). Two main approaches:

    • Kalman filter (KF): optimal estimator for linear systems with Gaussian noise. Produces minimum-variance unbiased estimate under those assumptions. KF has a prediction (time-update) and correction (measurement-update) step. Universities ask to derive KF equations from least-squares or from Bayesian linear-Gaussian priors. Required assumptions must be stated: linear dynamics x_{k} = A x_{k-1} + B u_{k-1} + w_{k-1}, measurement z_{k} = H x_{k} + v_{k}, with w and v zero-mean Gaussian with known covariances. For non-linear models, use the Extended Kalman Filter (EKF) (linearizes via Jacobians) or the Unscented Kalman Filter (UKF) (propagates sigma points).
    • Particle filter: sequential Monte Carlo method for non-linear, non-Gaussian systems. Represent posterior by weighted particles; resample to avoid degeneracy.
  • Dead reckoning: compute new position by integrating velocity or steps from previous position. Errors accumulate (drift) and must be corrected by absolute fixes (GPS, landmarks).

  • Geofencing: define a geographic boundary and detect entry/exit events. A geofence can be circular (center+radius) or polygonal. Describe what to draw: draw a map with a circular geofence, a moving point trajectory showing entry and exit times; label center, radius, entry point and timestamps.

  • Mobility models: mathematical models describing how nodes move. Common models: Random Walk, Random Waypoint, Gauss–Markov, Group Mobility. Define Random Waypoint: node chooses a random destination in area, moves there at chosen speed, pauses, repeats. Note: in steady state the node distribution is non-uniform (denser toward the center), and naive speed selection leads to “speed decay” unless the initial state is drawn from the stationary distribution. State model assumptions: independence of node choices unless group models.

  • Handover and mobility management: when a mobile device moves between coverage areas (cells, access points) the system performs handover to maintain connectivity. Distinguish vertical handover (between different technologies, e.g., Wi‑Fi to LTE) and horizontal handover (same technology). Important metrics: handover latency, packet loss, and signalling overhead. Practical algorithms use hysteresis margins and time-to-trigger (TTT) to avoid ping‑pong; make‑before‑break (when supported) reduces disruption compared to break‑before‑make.

  • Time synchronization: making clocks agree in time or ordering. Define clock offset (difference between two clocks) and clock skew/drift (rate difference). A simple clock model is C(t) = θ + ρ·t + ε(t), where θ is offset, ρ is skew, and ε is stochastic jitter. Protocols:

    • NTP (Network Time Protocol): hierarchical client-server synchronization over IP; typical accuracy milliseconds on internet, better on LAN.

    • PTP (IEEE 1588 Precision Time Protocol): master–slave synchronization with hardware timestamping; achieves microsecond or sub-microsecond accuracy on LANs with hardware support.

    • Cristian's algorithm: client requests time from a server and estimates offset assuming symmetric delay.

    • Berkeley algorithm: master polls peers and averages times to synchronize cluster.

    • Time scales: UTC (with leap seconds), TAI (no leap seconds), and GPS Time (no leap seconds; differs from UTC by a constant plus leap seconds). GNSS receivers typically output GPS or UTC time; conversions must account for leap seconds.

    • Logical clocks (Lamport clocks): assign scalar logical times to events so that causally related events are ordered: if event a causally precedes b, then L(a) < L(b). For concurrency detection, define vector clocks: vector of counters, one per process, that provide partial ordering and allow detecting causality precisely.

    • For message-based synchronization, two-way exchange yields offset and round-trip delay equations: draw timing diagram of client and server timestamps t1..t4 and label.

  • Context models for spatial/temporal awareness: context can be represented as key-value pairs, ontologies, or probabilistic belief (e.g., P(location | sensors)). State when to use which: ontologies for semantic reasoning, probabilistic models when data is noisy.

Formulas

Pr(dBm) = Pt(dBm) + Gt(dBi) + Gr(dBi) - 20·log10(4·π·d/λ) — Friis free-space equation (received power), where Pt is transmit power (dBm), Gt/Gr are antenna gains (dBi), d is distance (m), λ is wavelength (m). Applies in free-space, far-field.

Pr(dBm) = P0(dBm) - 10·n·log10(d/d0) + Xσ — Log-distance path-loss model, where P0 is reference received power at distance d0 (m), n is path loss exponent (unitless), Xσ ~ N(0,σ^2) is shadowing (dB). Applies in empirical environments.

d = d0 · 10^{(P0 - Pr)/(10·n)} — Inverse of log-distance model to estimate distance d (m) from measured Pr (dBm).

x_k = A·x_{k-1} + B·u_{k-1} + w_{k-1} — State transition (state x, control u, process noise w) in Kalman Filter; units depend on state.

z_k = H·x_k + v_k — Measurement equation (measurement z, measurement noise v).

Predict: x̂_{k|k-1} = A·x̂_{k-1|k-1} + B·u_{k-1}

Predict covariance: P_{k|k-1} = A·P_{k-1|k-1}·A^T + Q — Q is process noise covariance (units^2).

Kalman gain: K_k = P_{k|k-1}·H^T·(H·P_{k|k-1}·H^T + R)^{-1} — R is measurement noise covariance.

Update: x̂_{k|k} = x̂_{k|k-1} + K_k·(z_k - H·x̂_{k|k-1})

Update covariance: P_{k|k} = (I - K_k·H)·P_{k|k-1}

Two-way offset estimate: θ = ((t2 - t1) + (t3 - t4)) / 2 — with client timestamps t1 (send), t4 (receive), server t2 (recv), t3 (send). Round-trip time RTT = (t4 - t1) - (t3 - t2).

Lamport rule: if a → b (a causally before b) then L(a) < L(b) — L is Lamport timestamp (integer). Great-circle (Haversine) distance between two lat/lon points: a = sin^2((φ2−φ1)/2) + cos φ1 · cos φ2 · sin^2((λ2−λ1)/2); d = 2·R·atan2(√a, √(1−a)) — R ≈ 6371 km; angles in radians.

Worked examples

Example 1 — Estimate distance from RSSI (log-distance model)

Given: measured Pr = -65 dBm, reference P0 = -40 dBm at d0 = 1 m, path loss exponent n = 3 (indoors). Compute distance d.

Formula: d = d0 · 10^{(P0 - Pr)/(10·n)}

Steps:

  1. Compute exponent: (P0 - Pr)/(10·n) = (-40 - (-65)) / (10·3) = (25) / 30 = 0.833333...
  2. 10^{0.833333} ≈ 6.81
  3. d = 1 m · 6.81 = 6.81 m

Answer: Distance ≈ 6.81 m.

Example 2 — Two-way time sync offset (Cristian/NTP style)

Scenario: client sends request at t1 = 10.000 s (client time). Server receives at its time t2 = 20.020 s and replies immediately. Client receives reply at t4 = 10.150 s (client time). Server's send time t3 = 20.020 s (assume immediate response).

Formula: θ = ((t2 - t1) + (t3 - t4)) / 2

Steps:

  1. t2 - t1 = 20.020 - 10.000 = 10.020 s
  2. t3 - t4 = 20.020 - 10.150 = 9.870 s
  3. θ = (10.020 + 9.870) / 2 = 19.890 / 2 = 9.945 s

Interpretation: server time = client time + θ. So client should add 9.945 s to convert to server time.

Answer: Estimated clock offset θ = 9.945 s. Note: half the RTT assumption requires roughly symmetric network delay; verify RTT = (t4 - t1) - (t3 - t2) = (0.150) - (0.000) = 0.150 s.

Example 3 — One-step 1D Kalman filter (position with noisy GPS)

Model: state x is position (m) with velocity ignored for this step. A = 1, H = 1. Initial estimate x̂0 = 0 m, P0 = 10 m^2. Process noise Q = 1 m^2 (motion uncertainty), measurement noise R = 4 m^2 (GPS variance). At time k we predict then get measurement z1 = 8 m.

Predict:

  • x̂_{1|0} = A·x̂0 = 0
  • P_{1|0} = A·P0·A^T + Q = 10 + 1 = 11

Kalman gain:

  • K1 = P_{1|0}·H^T·(H·P_{1|0}·H^T + R)^{-1} = 11 / (11 + 4) = 11/15 ≈ 0.7333

Update:

  • x̂_{1|1} = x̂_{1|0} + K1·(z1 - H·x̂_{1|0}) = 0 + 0.7333·(8 - 0) = 5.8667 m
  • P_{1|1} = (1 - K1·H)·P_{1|0} = (1 - 0.7333)·11 = 0.2667·11 ≈ 2.9333 m^2

Answer: Posterior estimate x̂ = 5.867 m with variance ≈ 2.933 m^2.

Common mistakes

  • Forgetting assumptions of Kalman filter (linearity, Gaussian noise) when claiming optimality.
  • In time synchronization problems, mixing server and client timestamps incorrectly or not computing RTT before offset.
  • Not labeling diagrams: for example, handover diagrams must show time axis, signal strength curves for two APs, and handover decision point.
  • Applying Friis formula indoors without stating free-space assumption.

For your exam

Question types you will get: definitions (e.g., define dead reckoning, path-loss exponent), short notes (compare GPS and Wi‑Fi fingerprinting), derivations (derive Kalman gain; derive distance estimate from log-distance model), numericals (RSSI→distance; time-offset computation), trace algorithms (particle filter iteration on small particle set), and diagram tasks (draw timing diagram for two-way sync; draw geofence and trajectory). A full-marks answer includes: clear definitions (bold terms or explicit), stated assumptions, step-by-step algebra with units, labelled diagram descriptions, and a final numeric answer with units.

Quick check

  1. What does clock skew mean?
  2. Give one advantage of particle filters over Kalman filters.
  3. In log-distance path loss formula, if measured Pr decreases by 10·n dB, what happens to estimated distance d?

Answers: Clock skew = rate difference between two clocks (drift rate).; Particle filters handle non-linear, non-Gaussian posteriors while KFs require linear-Gaussian models.; If Pr decreases by 10·n dB then d increases by factor 10 (distance becomes 10· previous d).

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?