Skip to content

DS 251 · Module 1

AIoT Architecture and Meter Data

Core question: where does one meter reading come from, and what has to be true before it can feed an energy KPI?

Start Section 1
0 / 6 completed
Sync my progressJoin a session to keep progress across devices and share it with your instructor

Info

After you join, your completed lesson numbers are sent to your instructor together with your learner code, so they can see your progress. Use the codes your instructor gave you or the email you sign in with, and do not enter your name, company secrets or other personal data. Progress is kept with the rest of that session's data.

Learning objectives

  • Describe the roles of the meter, gateway, MQTT broker, ingestion service and downstream users in an AIoT energy pipeline
  • Tell power (kW) from energy (kWh) and read a 15-minute interval value by its start time
  • Explain why MQTT QoS 1 (at least once) can deliver the same reading twice, and why the receiver deduplicates on a key
  • Say what edge AI and digital twins add, and why simulated savings are not measured savings
  • Trace one reading from the meter to a row in the data file, naming its source meter, interval and one transmission risk
  • Draw a flow diagram and a draft field list for the campus case

Case and Pre-test

10 min

Case and Pre-test: One Building, One Meter, Two Weeks

Learning objective: know the case, the question it asks and your own starting point. DS 251 follows one campus electricity case from the sensor to a KPI that someone else can recompute; DS 252 then rates, reports and verifies the same KPI.

Course case (synthetic)

The campus facilities office wants to know whether Building A used less electricity in the week from 16 November 2026 than in the week before. Building A has one revenue meter, A01, that reports the energy used in every 15-minute interval. Your job across the three modules: turn the meter messages into a daily KPI table whose every number points back to the readings it came from.

The two comparison periods (time zone Asia/Taipei; start included, end excluded)
PeriodStartEndExpected intervals
B (baseline)2026-11-09 00:002026-11-16 00:007 days x 96 = 672
C (comparison)2026-11-16 00:002026-11-23 00:007 days x 96 = 672
Human → AI → Human
  1. Human sets the question, building, meter, periods and data rules
  2. AI and code assist: replay messages, clean, compute, draft
  3. Human checks the quality log, recomputes, and decides what can be handed over

Warning

Synthetic-data notice: Building A, meter A01 and every reading in this course are synthetic teaching data (data version power-demo-v1). They describe no real building and are not an energy audit.
Check yourself

The facilities office asks: "Did Building A use 10% less electricity last week?" What must be fixed before anyone computes an answer?

The facilities office asks: "Did Building A use 10% less electricity last week?" What must be fixed before anyone computes an answer?

Key takeaway: Fix the building, meter, periods and unit before you touch the data.

The AIoT Pipeline

8 min

From Sensor to Dataset: the AIoT Pipeline

Learning objective: name each component between the meter and the KPI, what it is responsible for, and where data can be lost, repeated or changed.

Path of one reading
  1. Meter A01 measures the energy used in each 15-minute interval
  2. Gateway reads the meter and publishes an MQTT message
  3. MQTT broker forwards the message to subscribers
  4. Ingestion service checks the message and stores it with received_at
  5. Downstream: data contract, daily KPI, evidence index, reports
Components and their typical risks
ComponentResponsible forWhat can go wrong
Meter (sensor)Measuring energy per interval for one buildingWrong meter mapping, clock drift, a different unit setting
Gateway (edge)Reading the meter and publishing messagesOffline buffer, late bursts after reconnecting
MQTT brokerRouting messages to subscribersRedelivery under QoS 1, so the same reading can arrive twice
IngestionValidating and storing each messageSilent drops, duplicate rows, unit or time-zone changes
Downstream usersKPIs, dashboards, disclosure draftsUsing rows that were never checked

Edge AI and digital twins can help

  • Edge AI can flag a stuck or noisy meter near the source
  • A digital twin can test control scenarios before trying them
  • Both reduce manual monitoring work

What they are not

  • A flag is a prompt to check, not a correction of the data
  • Twin results are scenarios, not measured savings
  • Simulated savings often exceed what real buildings achieve
  • MQTT QoS 1 can deliver a message more than once, so the receiver deduplicates on a key, not on the message
  • Shared vocabularies for meters, points and units (such as Brick or SAREF) make a meter easier to map to its building and metric
  • A model or twin output stays a scenario until meter data for both periods confirms the change
Check yourself

A vendor shows a digital twin of Building A that predicts a 15% saving from a new schedule. How should the team use this number?

A vendor shows a digital twin of Building A that predicts a 15% saving from a new schedule. How should the team use this number?

Key takeaway: Every hop between meter and KPI has a job and a failure mode; models suggest, meters measure.

kW, kWh and Intervals

7 min

kW, kWh and the 15-Minute Interval

Learning objective: tell power from energy and read an interval value correctly, because a unit mix-up silently changes every total.

Three things that are easy to confuse
TermWhat it isExample in this case
kW (power)The rate of use at a momentA 6 kW load running steadily
kWh (energy)Power multiplied by time: what the KPI adds up6 kW for 15 minutes = 1.5 kWh
Interval valueEnergy used in one 15-minute interval, labelled by its start time1.48 kWh for 01:00 to 01:15, stored as interval_start 01:00
WhOne thousandth of a kWh1330 Wh = 1.33 kWh
  • Intervals are left-closed and right-open: the 01:00 interval covers 01:00 up to, but not including, 01:15
  • One day has 96 intervals; one 7-day period has 672
  • Never add kW values to get energy; add kWh interval values instead
  • A file that mixes Wh and kWh is not wrong, but every value must be converted to kWh before it is added

Info

Time stamps carry their offset, for example 2026-11-16T00:00:00+08:00. Daily totals are cut by local time in Asia/Taipei, so a reading is assigned to a day by its local interval start.
Check yourself

A 15-minute interval in the file reads "6.0" with unit kW. What energy did the building use in that interval?

A 15-minute interval in the file reads "6.0" with unit kW. What energy did the building use in that interval?

Key takeaway: KPIs add kWh, not kW; every interval is identified by its start time and has a fixed 15-minute length.

Normal, Resent and Delayed Events

10 min

Replay: Normal, Resent and Delayed Messages

Learning objective: recognise the three message patterns in the replayed data and say what the receiver must do with each.

Replayed events from DS251_Meter_Readings_F1.csv (synthetic)
PatternWhat you see in the fileWhat it means
NormalR-B-0101, interval 2026-11-10 01:00, received 01:15:30One reading, received about 30 seconds after its interval ended
ResentR-B-0101-RESEND, same meter, interval and value, received 01:20:30The same reading delivered again; it must be counted once
Delayedreceived_at much later than the interval endStill valid if the key and value are sound; timeliness is noted, not a reason to drop it

MQTT QoS 1: at least once

  • The sender repeats until it gets an acknowledgement
  • So a message can arrive more than once
  • The DUP flag is only a hint, not a guarantee

What the receiver does

  • Identify a reading by meter_id and interval_start
  • Keep the first copy, log the others
  • Never trust reading_id alone to spot a repeat

Info

In class we replay the messages from a local CSV file instead of a live broker. The patterns are the same, and the replay gives everyone identical data to recompute.
Check yourself

Two rows have different reading ids but the same meter, interval start and value; one arrived five minutes later. What is the right treatment?

Two rows have different reading ids but the same meter, interval start and value; one arrived five minutes later. What is the right treatment?

Key takeaway: At-least-once delivery means repeats are normal; the receiver deduplicates on meter and interval, not on message id.

Trace One Reading

5 min

Trace One Reading

Learning objective: follow one reading end to end and name its source meter, its interval and one risk on the way.

  1. Pick a row
    R-C-0200 in DS251_Meter_Readings_F1.csv.
  2. Source
    meter_id A01, building_id A; check A01 in DS251_Meter_Registry.csv: 15-minute intervals, Asia/Taipei.
  3. Interval
    interval_start 2026-11-18T01:45:00+08:00, so it covers 01:45 to 02:00 on 18 November, inside period C.
  4. Value and unit
    value 1330, unit Wh: the same energy as 1.33 kWh once divided by 1,000.
  5. Risk
    Name one: unit mix, resend, late arrival or a missing interval. For this row it is the unit.
The row as it appears in the file
R-C-0200,A,A01,2026-11-18T01:45:00+08:00,1330,Wh,2026-11-18T02:00:30+08:00
Check yourself

R-C-0200 shows value 1330 with unit Wh, while its neighbours show 1.33 kWh. What should the trace record?

R-C-0200 shows value 1330 with unit Wh, while its neighbours show 1.33 kWh. What should the trace record?

Key takeaway: A traced reading names its meter, interval, value with unit, and the risk you checked.

Exercise: Flow Diagram and Field Draft

20 min

Exercise: Flow Diagram and Field Draft

Learning objective: in your group, draw the pipeline for the campus case and draft the fields a reading needs (15 minutes), then check your work against the module goals (5 minutes).

  1. Draw
    Sketch sensing, transmission, ingestion and downstream use for Building A, with one box per component.
  2. Mark the risks
    On each arrow, write one thing that can go wrong: resend, delay, unit mix, missing interval or wrong meter.
  3. Draft the fields
    List the fields one reading needs, with a one-line meaning each; compare with the header of the readings file.
  4. Trace
    Trace one row you choose: source meter, interval start and end, value in kWh, one transmission risk.
  5. Check
    Can a classmate find the same row from your note alone? If not, add what is missing.

Done

This is exercise 1 (ds251-m1-meter-trace). Keep the diagram and field draft: they become the AIoT flow and the meter-and-period fields of your KPI Evidence Handoff Package.

Key takeaway: Module summary: a reading becomes usable data only when its meter, interval, unit and delivery path are known and checked.

What next?