Automatic Meter Reading in Simulink
This example shows you how to use Simulink® and Communications Toolbox™ to read utility meters by processing Standard Consumption Message (SCM) or Interval Data Message (IDM) signals emitted by meters. You can either use recorded data from a file, or receive over-the-air signals in real time using the RTL-SDR Radio or ADALM-PLUTO Radio.
Required Hardware and Software
To run this example using recorded data from a file, you need the following software:
To receive signals in real time, you also need one of the following 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 radio and the corresponding Communications Toolbox Support Package for ADALM-PLUTO Radio
For a full list of Communications Toolbox supported SDR platforms, refer to Supported Hardware section of the Software Defined Radio (SDR) discovery page.
For an introduction to the SCM/IDM signaling scheme and AMR technology for reading utility meters, refer to the Automatic Meter Reading (Communications Toolbox) example in MATLAB®.
Receiver Model Structure
The following block diagram summarizes the receiver structure. The processing has four main parts: Signal Source, Physical Layer, Message Parser, and Data Viewer.
This example can use three signal sources:
''File'': Over-the-air signals written to a file and read using a Baseband File Reader (Communications Toolbox) block at 1.0 Msps
''RTL-SDR Radio'': RTL-SDR radio at a sample rate of 1.0 Msps
''ADALM-PLUTO Radio'': ADALM-PLUTO radio at a sample rate of 1.0 Msps
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 the radio as the signal source.
The baseband samples received from the 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.
The RTL-SDR radio is capable of using a sampling rate in the range of 225-300 kHz or 900-2560 kHz and ADALM-PLUTO radio is capable of using a sampling rate in the range of 520 kHz-61.44 MHz. A sampling rate of 1.0 Msps is used to produce a sufficient number of samples per Manchester encoded data bit. For each frequency in the hopping pattern, every AMR data packet is transmitted. The frequency hopping allows for increased reliability over time. Since every packet is transmitted on each frequency hop, it is sufficient to monitor only one frequency for this example. The radio is tuned to a center frequency of 915 MHz for the entire simulation runtime.
The received complex samples are amplitude demodulated by extracting their magnitude. The on-off keyed Manchester coding implies that the bit selection block includes clock recovery. The output of this block is 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.
For a valid message, the bits are then parsed into the specific fields of either the IDM or SCM format. This example can parse both the SCM format and the IDM format.
The data viewer shows the decoded SCM or IDM messages on a user interface. For each successfully decoded SCM/IDM, the commodity type, meter ID, 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 user interface.
Meter ID - The default value,
0, is reserved for displaying all detected meters. You can enter the ID of a specific meter to display readings from only that meter ID.
Log data to file - Save the decoded messages in a TXT file. You can use the saved data for post processing.
This figures shows the meter readings displayed in the user interface.
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 radio, 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 AMRSimulinkExampleApp app. The app allows you to set the run duration, select the signal source, change the center frequency of the radio, and run to log meter readings.
Automatic meter reading, https://en.wikipedia.org/wiki/Encoder_receiver_transmitter, 2016.
Itron Electricity meters, https://www.itron.com/solutions/who-we-serve/electricity, 2017.