Main Content

Automatic Meter Reading

This example shows you how to use Communications Toolbox™ to read utility meters by processing Standard Consumption Message (SCM) signals and Interval Data Message (IDM) signals which are emitted by Encoder-Receiver-Transmitter (ERT) compatible meters. You can either use recorded data from a file, or receive over-the-air signals in real time using an RTL-SDR or ADALM-PLUTO radio.

In Simulink®, you can explore theAutomatic Meter Reading in Simulinkexample.

需要硬件和软件

要使用文件中记录的数据运行此示例,您需要Communications Toolbox™。

To receive signals in real time, you also need one of these SDR devices and the corresponding support package Add-On:

  • RTL-SDR radio and the corresponding Communications Toolbox Support Package for RTL-SDR Radio

  • ADALM-PLUTO广播和相应的注意ions Toolbox Support Package for Analog Devices® ADALM-PLUTO Radio

For more information, see theSoftware Defined Radio (SDR) discovery page

Background

Automatic Meter Reading (AMR) is a technology that autonomously collects the consumption and status data from utility meters (such as electric, gas, or water meters) and delivers the data to utility providers for billing or analysis purposes. The AMR system utilizes low power radio frequency (RF) communication to transmit meter readings to a remote receiver. The RF transmission properties include:

  • Transmission frequency within range: 910-920 MHz

  • Data rate: 32768 bps

  • 开关的曼彻斯特钥匙

The SCM and IDM are two types of the conventional message types that the meters send out. The SCM packets are used with a fixed length of 96 bits, whereas IDM packets are used with a fixed length of 736 bits. These tables show the packet format of the SCM and IDM messages:

Meters capable of sending both SCM and IDM messages transmit them on the same channel with separation of roughly 275 msec. Each meter transmits the SCM and IDM messages over multiple frequencies using a hopping pattern. The actual transmission frequencies, the frequency hopping pattern, and the time interval between transmissions are random to avoid interference from other transmissions. For more information, see reference [1].

Run Example

When you run the example:

  • The receiver initializes the simulation parameters and calculates the AMR parameters.

  • A data viewer display shows the meter ID, consumption information, and commodity type.

  • The simulation loop calls the signal source, physical layer, message parser, and data viewer.

  • 处理循环使用框架持续时间跟踪无线电时间。

  • The display updates for each data capture, showing unique meter IDs with the latest consumption information.

Initialize Parameters

The default signal source is 'File', which runs the example using the recorded baseband signal fileamr_capture_01.bb。要使用您的RTL或Adalm-Pluto SDR运行示例,请更改signalSourcewhen you call thehelperAMRInit.mfile. Valid options forsignalSourceare 'File', 'RTL-SDR', and 'ADALM-PLUTO'.

signalSource ='File'; initParam = helperAMRInit(signalSource);% Calculate AMR system parameters based on the initialized parameters[amrParam,sigSrc] = helperAMRConfig(initParam);% Create the data viewer objectviewer = helperAMRViewer('MeterID',initParam.MeterID,。。。'LogData',initParam.LogData,。。。'LogFilename',initParam.LogFilename,。。。'Fc',amrParam.CenterFrequency,。。。'SignalSourceType',initParam.SignalSourceType); start(viewer); radioTime = 0;%初始化无线电时间% Main Processing LoopwhileradioTime < initParam.Duration rcvdSignal = sigSrc(); amrBits = helperAMRRxPHY(rcvdSignal,amrParam); amrMessages = helperAMRMessageParser(amrBits,amrParam); update(viewer,amrMessages); radioTime = radioTime + amrParam.FrameDuration;endstop(viewer);% Stop the viewerrelease(sigSrc);% Release the signal source

接收器代码结构

The flow chart summarizes the receiver code structure. The processing has four main parts: Signal Source, Physical Layer, Message Parser and Data Viewer.

Signal Source

This example can use three signal sources:

  1. '''':写在文件上的空中信号并使用Baseband File Readerobject at 1.0 Msps

  2. ''RTL-SDR'': RTL-SDR radio at a sample rate of 1.0 Msps

  3. 'adalm-pluto'':以1.0 msps的样本速率Adalm-Pluto无线电

If you assign ''RTL-SDR'' or ''ADALM-PLUTO'' as the signal source, the example searches your computer for the radio you specified, either an RTL-SDR radio at radio address '0' or an ADALM-PLUTO radio at radio address 'usb:0' and uses it as the signal source.

物理层

收到th基带样本e signal source are processed by the physical layer (PHY) to produce packets that contain the SCM or IDM information. This diagram shows the physical layer receive processing.

RTL-SDR无线电能够使用225-300 kHz或900-2560 kHz的采样率。Adalm-Pluto无线电能够使用520 kHz-61.44 MHz的采样率。每个曼彻斯特编码的数据位的采样率为1.0 MSPS。对于跳跃模式的每个频率,每个AMR数据包都会传输。频率跳跃允许随着时间的推移可靠性提高。由于每个数据包都在每个频率HOP上传输,因此仅监视此示例的一个频率就足够了。对于整个模拟运行时,收音机被调整为915 MHz的中心频率。

The received complex samples are amplitude demodulated by extracting their magnitude. The on-off keyed Manchester coding implies the bit selection block includes clock recovery. This block outputs bit sequences (ignoring the idle times in the transmission) which are subsequently checked for the known preamble. If the preamble matches, the bit sequence is further decoded, otherwise, it is discarded and the next sequence is processed.

When the known SCM preamble is found for a bit sequence, the received message bits are decoded using a shortened (255,239) BCH code which can correct up to two bit errors. In the case where the known IDM preamble is found, the receiver performs a cyclic redundancy check (CRC) of the meter serial number and of the whole packet starting at the Packet type (the 5th byte) to determine if the packet is valid. Valid, corrected messages are passed onto the AMR message parser.

Message Parser

For a valid message, the bits are then parsed into the specific fields of the SCM or the IDM format.

Data Viewer

The data viewer shows the decoded packets on a separate MATLAB® figure. For each successfully decoded packet, the meter ID, commodity type, AMR packet type, consumption information and the capture time is shown. As data is captured and decoded, the application lists the information decoded from these messages in a tabular form. The table lists only the unique meter IDs with their latest consumption information.

You can also change the meter ID and start text file logging using the data viewer.

  • Meter ID- 将仪表ID从0更改为0,即默认值,保留用于显示所有检测到的仪表,转换为要显示的特定仪表ID。

  • Log data to file- Save the decoded messages in a TXT file. You can use the saved data for post processing.

进一步探索

The data file accompanying the example has only one meter reading and has been captured at center frequency of 915 MHz. Using RTL-SDR or ADALM-PLUTO, the example will display readings from multiple meters when it is run for a longer period in a residential neighborhood.

You can further explore AMR signals using the AMRExampleApp user interface. This app allows you to select the signal source and change the center frequency of the RTL-SDR or ADALM-PLUTO. This link launchs theAMRExampleAppapp shown here.

You can also explore the following functions for details of the physical layer, AMR message formats:

A version of the example that works with multiple radios isAMRMultipleRadios.m。This allows you to examine the frequency hop patterns for a meter by setting different center frequencies per radio device available. The script is set for two radios, but can be extended for any number.

Selected Bibliography