Chapters

18 IoT Edge Models: Cold-Chain Processing

analytics-ml
edge
patterns
iot

18.1 Start With the Decision

A truck gateway can spot a temperature breach before the cloud replies. It must filter, store, and prove each alert on the move.

18.2 Route Overview

This is part 2 of 2. Review IoT Edge Models: Processing Levels for the preceding evidence.

18.3 Learning Objectives

  • Test cold chain edge processing with a concrete scenario and pass criteria.
  • Validate three-tier edge design exercise with a concrete scenario and pass criteria.

18.4 Chapter Roadmap

  • Cold Chain Edge Processing
  • Checkpoint: Cold-Chain Edge Case
  • Cold Chain Cost Calculator
  • Choose the Processing Level
  • Checkpoint: Placement Choice
  • Level 4: Data Accumulation (Storage)
  • Application Requirements Summary
  • Latency vs Bandwidth Matrix
  • Interactive Quiz: Match Concepts
  • Interactive Quiz: Sequence the Steps
  • Common Pitfalls
  • Map Edge Patterns to Tiers
  • 2. Designing each tier independently
  • Map Management Flows
  • Tailor IoT Reference Models
  • Checkpoint: Model Review
  • Label the Diagram
  • Code Challenge
  • Edge Placement Contracts
  • Summary
  • Key Takeaway
  • Concept Check
  • Quick Knowledge Check
  • Concept Relationships
  • How This Concept Connects
  • See Also
  • Related Resources
  • Try It Yourself
  • Three-Tier Edge Design Exercise
  • Knowledge Check
  • Quiz: IoT Reference Model
  • What’s Next

18.5 Cold Chain Edge Processing

With the Level 3 functions named, test whether they still hold up when the network is mobile and compliance-sensitive.

Scenario: A pharmaceutical distributor monitors 50 refrigerated trucks, each carrying 20 temperature sensors that sample at 1 Hz (once per second). The system must detect temperature excursions above 8 degrees Celsius within 30 seconds for regulatory compliance.

Without Edge Processing (Cloud-Only Architecture):

MetricCalculationValue
Raw data rate per truck20 sensors x 1 sample/sec x 16 bytes320 bytes/sec
Fleet data rate50 trucks x 320 bytes/sec16,000 bytes/sec (16 kB/s)
Daily data volume16 kB/s x 86,400 sec1.38 GB/day
Monthly cellular data cost1.38 GB/day x 30 days x $0.10/MB$4,140/month
Cloud ingestion cost41.4 GB/month x $0.25/GB (AWS IoT Core)$10.35/month
Excursion detection latencyCellular RTT (200 ms) + cloud processing (500 ms)700 ms

With Level 3 Edge Processing:

Each truck runs an edge gateway (Raspberry Pi or similar) that performs:

  • Evaluation: Discard readings within 2-8 degrees Celsius (normal range). Only escalate outliers.
  • Formatting: Convert raw ADC values to Celsius, attach truck ID and GPS coordinates.
  • Distillation: Compute 1-minute averages, min/max. Replace 1,200 raw readings with 4 summary values per sensor per minute.
  • Assessment: If any sensor exceeds 8 degrees Celsius for 3 consecutive readings (3 seconds), trigger immediate alert to dispatch.
MetricCalculationValue
Distilled data rate per truck20 sensors x 4 values/min x 8 bytes / 60 sec10.7 bytes/sec
Fleet data rate50 trucks x 10.7 bytes/sec535 bytes/sec
Daily data volume535 bytes/sec x 86,400 sec46.2 MB/day
Monthly cellular data cost46.2 MB/day x 30 days x $0.10/MB$139/month
Excursion detection latencyLocal processing on gateway3 seconds (3 readings)

Savings Summary:

CategoryCloud-OnlyEdge ProcessingSavings
Cellular data cost$4,140/month$139/month97% reduction
Data volume1.38 GB/day46.2 MB/day30x reduction
Detection latency700 ms (but requires constant connectivity)3 seconds (works offline)Operates during cellular dead zones
Gateway hardware cost$050 x $35 = $1,750 (one-time)Pays for itself in 13 days

The edge gateway investment of $1,750 saves $4,001 per month in cellular costs. More critically, the edge architecture detects temperature excursions even when trucks pass through tunnels or rural areas without cellular coverage — a compliance requirement that cloud-only architectures cannot guarantee.

Data DoraCheckpoint: Cold-Chain Edge Case

You now know:

  • The cloud-only fleet sends 16 kB/s, or 1.38 GB/day, before any filtering.
  • Level 3 summaries reduce the flow to 535 bytes/sec and 46.2 MB/day.
  • Gateway spending is justified when local alerts still work during cellular dead zones.

18.6 Cold Chain Cost Calculator

Adjust the parameters below to explore how edge processing affects your cold chain monitoring costs.

18.7 Choose the Processing Level

Not all data needs to travel to the cloud. The following decision table helps determine where to process each data stream:

Decision FactorProcess at Level 3 (Edge)Process at Level 5-7 (Cloud)
Latency requirementSub-second response needed (safety shutdowns, real-time control)Minutes to hours acceptable (trend analysis, reporting)
Data volumeHigh-frequency raw data (>1 reading/sec per sensor)Pre-aggregated summaries (hourly/daily)
ConnectivityIntermittent or expensive (cellular, satellite)Reliable broadband available
PrivacySensitive data that should not leave premises (medical, industrial IP)Non-sensitive operational metrics
Compute complexitySimple rules, thresholds, averagingML model training, cross-site correlation

Real-world example — vibration monitoring on rail networks: Deutsche Bahn deploys vibration sensors on approximately 5,400 ICE train wheelsets. Each sensor generates about 50 kB/second at 20 kHz sampling. Uploading everything would require approximately 23 TB/day in cellular bandwidth. Instead, edge gateways on each train run FFT (Fast Fourier Transform) locally, extract the dominant frequency peaks (~200 bytes), and upload only the spectral summary every 10 minutes. Cloud analytics then correlates these summaries across the fleet to predict bearing failures weeks before they occur. The edge processing reduces data volume by over 99.99% while preserving the diagnostic information needed for predictive maintenance.

Data DoraCheckpoint: Placement Choice

You now know:

  • Edge placement is strongest for sub-second response, high-frequency data, intermittent links, privacy, and simple local rules.
  • Cloud placement fits minutes-to-hours analysis, stored summaries, broadband links, non-sensitive metrics, and cross-site training.
  • The rail example keeps diagnostic features while avoiding roughly 23 TB/day of raw cellular upload.

18.8 Level 4: Data Accumulation (Storage)

After deciding what Level 3 should distill, decide what Level 4 must remember.

Levels 1-3 have data in motion and are event-driven. At Level 4, the data in motion is converted to data at rest. Decisions at Level 4 include:

  • Is the data of interest to higher levels?
  • Does the data need to be saved or accumulated in memory for short-term use?
  • Does persistency require a file system, big data system, or relational database?
  • What data transformations are needed for the required storage system?
  • Does the data need to be recombined or recomputed?

Storage Decision Matrix:

Data CharacteristicStorage TypeExample
Short-term, high-frequencyIn-memory bufferLast 100 sensor readings
Time-series, queryableTime-series DB (InfluxDB, TimescaleDB)Historical sensor data
Relational, structuredSQL databaseDevice configuration, metadata
Unstructured, largeObject storage (S3, blob)Images, video clips
Real-time streamingMessage queue (Kafka, MQTT)Event streams for processing

18.9 Application Requirements Summary

Understanding the IoT Reference Model helps match application requirements to appropriate processing levels:

The comparison diagram in Figure 18.1 makes the application constraint visible before a processing level is chosen.

Massive IoT pairs high volume with delay tolerance; critical IoT pairs low latency with high reliability.
Figure 18.1: Massive IoT versus Critical IoT Processing Strategies

Read Figure 18.1 from the Massive IoT branch to the Critical IoT branch. Massive deployments prioritise fleet scale, unit cost, and efficient batch handling; critical systems prioritise bounded latency and local real-time action because delayed decisions can become unsafe. Neither branch removes the need for cloud history or edge evidence, but it changes which tier may close the immediate loop. This completes the chapter’s running placement narrative by tying reference-model levels to the consequence, scale, and timing of the application decision.

18.10 Latency vs Bandwidth Matrix

This view shows how edge processing decisions balance latency and bandwidth requirements:

The placement cost is easiest to see as elapsed path, not as an abstract cloud label. The path diagram in Figure 18.2 traces a cloud-bound event so the latency discussion can identify where delay is introduced.

High-latency impact path showing an event passing through sensor, transmission, network, cloud processing, and response before the resulting action
Figure 18.2: High-latency cloud processing path from an event to a returned action

In the path diagram Figure 18.2, Event occurs precedes the Sensor, then the route crosses Transmission and Network before reaching Cloud Processing. A Response must traverse the return path before Action can occur. Those labelled stages are additive and variable, so a safety deadline cannot be justified from compute time alone. This completes the reference-model argument: keep an immediate decision at the edge when the full round trip cannot meet its bound, and send history upward when cloud context matters more than response time.

The optimal processing location depends on both latency sensitivity and data volume. Edge processing is essential when either latency is critical or bandwidth is limited.

Massive IoT vs Critical IoT Requirements: Two distinct IoT application categories — Massive IoT prioritizes scale and cost efficiency with delay tolerance (smart metering, agriculture), while Critical IoT demands ultra-low latency and high reliability for safety-critical applications (autonomous vehicles, industrial control). Edge processing strategies differ accordingly.

18.11 Interactive Quiz: Match Concepts

18.12 Interactive Quiz: Sequence the Steps

Common Pitfalls

Edge patterns like ‘filter-at-source’ and ‘aggregate-at-fog’ must be mapped to specific reference model tiers (device tier vs connectivity tier) before implementation decisions about hardware, protocol, and power can be made.

Optimising the device tier for low power and the cloud tier for analytical throughput without considering the connectivity tier in between often produces an architecture where the network is the bottleneck. Design all tiers together.

The data flow (sensor → cloud) is visible and well-designed in most architectures, but the control flow (cloud → device configuration, firmware updates) is often an afterthought. Both flows must be explicit in the reference model mapping.

The reference model for a smart building differs from one for industrial automation or connected health. Apply the reference model as a starting template and adapt tier responsibilities and protocols to the specific domain requirements.

Data DoraCheckpoint: Model Review

You now know:

  • Level 4 is the boundary where event-driven streams become retained records.
  • Massive IoT emphasizes scale and cost efficiency, while Critical IoT emphasizes real-time edge response.
  • The quizzes that follow check whether you can match, sequence, label, and code the same reference-model flow.

18.13 Label the Diagram

18.14 Code Challenge

18.15 Edge Placement Contracts

The reference-model mapping above still needs a concrete placement and evidence contract for the computation continuum. Continue to Edge Reference Model Placement Contracts for latency, bandwidth, privacy, tier-boundary, data-reduction, and accountability checks across device, edge, fog, storage, cloud, and application layers.

The service split in Figure 18.3 shows why the reference model names stable responsibilities without prescribing one quality-of-service policy.

Massive IoT branch emphasizes many quiet devices, capacity and coverage, compression and batching; critical IoT branch emphasizes urgent control, latency and resilience, local validation and safe state.
Figure 18.3: Massive and critical IoT share device, connectivity, and acquisition layers but optimise them for scale or consequence.

In Figure 18.3, Many quiet devices lead to Compress and batch, while Few urgent control loops lead to Decide and prove locally. Both occupy physical, connectivity, and acquisition responsibilities, but their capacity, latency, resilience, and evidence contracts are deliberately different.

The four-layer path in Figure 18.4 keeps edge transformation distinct from accumulation while showing how both depend on the lower device and connectivity contracts.

Four stacked levels show physical devices sensing and acting, connectivity moving bits, edge computing filtering and normalizing, and data accumulation turning streams into queryable records, with an upward telemetry and downward command path.
Figure 18.4: IoT Reference Model Levels 1 to 4 carry telemetry upward from devices through connectivity and edge transformation into durable data accumulation.

Walk Figure 18.4 upward from LEVEL 1 · PHYSICAL DEVICES through LEVEL 2 · CONNECTIVITY. LEVEL 3 · EDGE COMPUTING changes representation and volume near the source, while LEVEL 4 · DATA ACCUMULATION changes lifetime by turning the stream into durable, queryable records.

18.16 Summary

  • The seven-level IoT Reference Model separates operational technology (Levels 1-3, data in motion) from information technology (Levels 5-7, data at rest), with Level 4 as the transition from streaming to stored data
  • Level 1 (Physical Devices) includes all sensors, actuators, and controllers that generate or receive data
  • Level 2 (Connectivity) provides reliable, timely transmission through appropriate protocols and network topologies
  • Level 3 (Edge Computing) transforms raw data through evaluation, formatting, distillation, and assessment before storage
  • Level 4 (Data Accumulation) converts data in motion to data at rest, selecting appropriate storage types based on data characteristics
  • Massive IoT applications prioritize scale and cost at Levels 1-4 with batch processing
  • Critical IoT applications demand real-time processing at Level 3 with cloud for monitoring only
Key Takeaway

The IoT Reference Model separates edge processing (Levels 1-3, data in motion) from cloud analytics (Levels 5-7, data at rest), with Level 4 as the critical transition point. Level 3 is the edge computing layer that filters, formats, and reduces data before storage. Massive IoT applications prioritize scale and cost efficiency with batch processing, while Critical IoT demands real-time edge processing for safety and reliability.

18.17 Concept Check

Quick Knowledge Check

Q: What is the key difference between data in motion (Levels 1-3) and data at rest (Level 4+)?

Data in motion is event-driven, streaming data that flows from sensors through edge processing. Data at rest is stored in databases for batch analytics and historical queries. Level 4 is the critical transition point where real-time streams become persistent storage.

Q: Why is Level 3 edge computing called the “transformation layer”?

Level 3 performs five critical functions: evaluation (check data quality), formatting (standardize schemas), expanding (decode proprietary protocols), distillation (reduce data volume through aggregation), and assessment (trigger local responses). It transforms raw device data into cloud-ready information.

18.18 Concept Relationships

How This Concept Connects

Builds on:

Enables:

Related Concepts:

  • Massive IoT vs Critical IoT - Different processing requirements at each level
  • Gateway Architecture - Level 3 gateways handle protocol translation for non-IP devices
  • Tiered Storage - Level 4 retention policies (hot/warm/cold tiers)

18.19 See Also

Related Resources

Core Edge Computing:

Architecture Context:

Real-World Applications:

  • smart City Edge Computing{target=“blank”} - Urban-scale edge architectures

18.20 Try It Yourself

Scenario: A pharmaceutical cold chain monitoring system tracks 50 refrigerated trucks, each with 20 temperature sensors sampling at 1 Hz.

Your Task: Design the architecture for Levels 1-4:

  1. Level 1 (Devices): What sensors are needed? What’s the data format?

  2. Level 2 (Connectivity): Which protocol (Bluetooth, LoRaWAN, cellular)? Why?

  3. Level 3 (Edge Gateway): Apply the five functions:

    • Evaluation: What threshold values trigger alerts?
    • Formatting: Design the standardized data schema
    • Distillation: Calculate data reduction ratio (1 Hz raw to what summary?)
    • Assessment: What local actions (alarms, door locks)?
  • level 4 (Storage): What retention policy (hot/warm/cold tiers)?

What to Observe:

  • Compare bandwidth costs: raw 1 Hz data vs edge-processed summaries
  • Calculate alert latency: edge detection vs cloud detection
  • Consider offline operation: what happens during cellular dead zones?

Starter Code (Python simulation):

import time
import statistics

class ColdChainEdgeGateway:
    def __init__(self, truck_id, num_sensors=20):
        self.truck_id = truck_id
        self.buffer = []
        self.alert_threshold_max = 8.0  # degrees C

    def evaluate(self, reading):
        """Level 3: Evaluation - check data quality"""
        return 2.0 <= reading <= 10.0  # Valid range

    def format(self, sensor_id, temp_c):
        """Level 3: Formatting - standardize schema"""
        return {
            "truck_id": self.truck_id,
            "sensor_id": sensor_id,
            "temp_celsius": round(temp_c, 1),
            "timestamp_utc": time.time()
        }

    def distill(self, readings_1min):
        """Level 3: Distillation - 60 readings to 4 summary values"""
        return {
            "min": min(readings_1min),
            "max": max(readings_1min),
            "avg": statistics.mean(readings_1min),
            "stddev": statistics.stdev(readings_1min)
        }

    def assess(self, temp_c):
        """Level 3: Assessment - trigger local alarm"""
        if temp_c > self.alert_threshold_max:
            print(f"ALERT: Truck {self.truck_id} temp {temp_c} C exceeds 8 C")
            return True
        return False

# Test the gateway
gateway = ColdChainEdgeGateway("TRUCK-042")
readings = [5.2, 5.3, 5.1, 8.5, 8.9, 9.2]  # Temperature excursion!

for i, temp in enumerate(readings):
    if gateway.evaluate(temp):
        formatted = gateway.format(sensor_id=1, temp_c=temp)
        gateway.assess(temp)
        gateway.buffer.append(temp)

summary = gateway.distill(gateway.buffer)
print(f"1-minute summary: {summary}")
print(f"Data reduction: {len(gateway.buffer)} readings to 4 values")

Extension Challenge: Add Level 4 storage with tiered retention (last hour = raw data, last week = hourly summaries, beyond = daily aggregates).

18.21 Knowledge Check

Quiz: IoT Reference Model

18.22 What’s Next

Next TopicDescription
Edge Reference Model Placement ContractsTier placement evidence, data-reduction, and accountability contracts for Level 3 edge decisions
Edge Processing PatternsFour primary patterns: Filter, Aggregate, Infer, Store-Forward
Cyber-Foraging and CachingOpportunistic compute offloading and caching strategies
Edge Patterns Practical GuideInteractive tools and worked examples for architecture decisions

18.23 Continue Your Route

This final part closes the route from Cold Chain Edge Processing through What’s Next. Return to IoT Edge Models: Processing Levels or continue from the analytics-ml module index.