Application Note: JN-AN-1135 ZigBee PRO Smart Energy Demo

Application Note: JN-AN-1135 ZigBee PRO Smart Energy Demo This Application Note introduces the Jennic ZigBee PRO Smart Energy (SE) Profile solution. T...
Author: Scott Hines
6 downloads 1 Views 199KB Size
Application Note: JN-AN-1135 ZigBee PRO Smart Energy Demo This Application Note introduces the Jennic ZigBee PRO Smart Energy (SE) Profile solution. The key topics covered are: • ZigBee PRO Smart Energy Profile • Jennic Simple Metering Cluster • Jennic SE demonstration overview The accompanying software uses the Simple Metering Cluster to exchange data between a Metering Device and an In Premise Display (IPD). This application was developed using the Jennic ZigBee PRO, JenOS and Smart Energy APIs.

1 Application Overview This Application Note demonstrates how the Jennic ZigBee PRO Smart Energy (SE) solution can be used to transfer data between a utility meter and customer display device. The data is transferred using the Simple Metering Cluster.

Note: This application is intended to demonstrate the Jennic ZigBee PRO Smart Energy API functions. It is not intended to be a fully functional application. The ZigBee PRO and JenOS APIs, used in this demonstration, are supplied as part of the Jennic JN5148 ZigBee PRO Software Developer’s Kit (SDK). The Smart Energy API is available is as an upgrade/overlay for this SDK. Both components are available free-of-charge from the Support section of the Jennic web site (www.jennic.com/support).

2 ZigBee PRO Smart Energy Overview The ZigBee Alliance has specified the Smart Energy Profile. ZigBee Smart Energy offers utility companies secure, easy-to-use wireless Home Area Networks (HANs) for managing energy. Smart Energy gives utility companies and their customers the power to directly communicate with thermostats and other smart appliances. This profile defines clusters, which are groups of information with a similar function. These clusters consist of attributes and commands. Attributes store a single value, e.g. the power source of the device. The application can query and manipulate these attributes using the standard command set provided by the ZigBee Cluster Library (ZCL).

JN-AN-1135 (v1.0) 6-Jul-2009

© Jennic 2009

1

Jennic

ZigBee PRO Smart Energy Demo

Before commencing a Smart Energy development, you are recommended to familiarise yourself with the following documents: [R1]

ZigBee Smart Energy Profile Specification

[R2]

ZigBee Cluster Library Specification (ZCL)

[R3]

Jennic ZigBee PRO Stack User Guide [JN-UG-3048]

[R4]

Jennic ZigBee PRO APIs Reference Manual [JN-RM-2041]

[R5]

Jennic ZigBee PRO Smart Energy API Reference Manual [JN-RM-2046]

The latest versions of [R1] and [R2] can be found on the ZigBee Alliance web site (www.ZigBee.org), while [R3] to [R5] can found in the Support area of the Jennic web site.

3 Simple Metering Cluster The Jennic SE Demo exchanges Meter data using the Simple Metering Cluster. The Jennic Simple Metering cluster provides both the Client- and Server-side functionality. In the demonstration software, the IPD is the Client and the Metering Device is the Server. The attributes supported by the Jennic Simple Metering Cluster are detailed in the table below. Attribute

Description

Current Summation Delivered

Represents the most recent summed value of Energy, Gas or Water delivered and consumed in the premise. CurrentSummationDelivered is mandatory and must be provided as part of the minimum data set to be provided by the metering device. CurrentSummationDelivered is updated continuously as new measurements are made.

Instantaneous Demand

Represents the current Demand of Energy, Gas or Water delivered or received at the premise. Positive values indicate demand delivered to the premise where negative values indicate demand received from the premise. InstantaneousDemand is updated continuously as new measurements are made. The frequency of updates to this field is specific to the metering device, but should be within the range of once every second to once every 5 seconds.

Meter Status

The Status attribute provides indicators reflecting the current error conditions found by the metering device. This attribute is an 8-bit field where when an individual bit is set, an error or warning condition exists. The behaviour causing the setting or resetting of each bit is device-specific.

Metering Device Type

MeteringDeviceType provides a label for identifying the type of metering device present. The attributes are enumerated values representing Energy, Gas, Water, Thermal and mirrored metering devices.

Unit of Measure

UnitofMeasure provides a label for the Energy, Gas or Water being measured by the metering device. The unit of measure applies to all summations, consumptions/ profile interval and demand/rate supported by this cluster.

Summation Formatting

SummationFormatting provides a method to properly decipher the number of digits and the decimal location of the values found in the Summation Information Set of attributes.

2

© Jennic 2009

JN-AN-1135 (v1.0) 6-Jul-2009

Jennic

ZigBee PRO Smart Energy Demo

The above table was produced from information in the ZigBee Smart Energy Profile Specification [R1]. Further details on all the attributes and commands that can be supported by the Simple Metering Cluster can be found in this document.

4 Jennic Smart Energy Demonstration This section describes different aspects of the Jennic SE demonstration.

4.1 Network Architecture The network consists of two ZigBee PRO nodes - a Co-ordinator and a Router. The Metering Device is the Co-ordinator - when started, it will form a Zigbee PRO network. The IPD is a Router - when started, it will execute a scan to find a compatible ZigBee PRO network to join. The Extended PAN ID has been configured in the ZPS Configuration Editor and, therefore, the IPD will only join a network with a matching Extended PAN ID.

4.2 Smart Energy Network Architecture The Metering Device will also be the Energy Service Portal (ESP). This enables the Meter to be the Co-ordinator and form the ZigBee network.

ESP with integrated Metering Device In Premise Display

C

S

C

JN-AN-1135 (v1.0) 6-Jul-2009

= Client

S

© Jennic 2009

= Server

3

Jennic

ZigBee PRO Smart Energy Demo

4.3 Meter Software The Meter application registers a structure with the Jennic SE library using the eSE_RegisterEspMeterEndPoint() function. This structure is updated by the application, and read by SE Library when a ‘Read Attributes’ command is received (this structure is protected by a mutex). typedef struct PACK { zuint48

u48CurrentSummationDelivered;

zbmap8

u8MeterStatus;

teSE_UnitOfMeasure

eUnitOfMeasure;

zbmap8

u8SummationFormatting;

teSE_MeteringDeviceType

eMeteringDeviceType;

zint24

i24InstantaneousDemand;

} tsSE_SimpleMetering;

Each time the Metering Device receives a ‘Read Attributes’ command, the Meter attribute u48CurrentSummationDelivered is incremented. It is incremented when a callback event is generated by the ZCL in app_zcl_task.c. case E_ZCL_CBET_READ_REQUEST: DBG_vPrintf(TRACE_APP_VERBOSE, "EP EVT: Read request\r\n"); sMeter.sSimpleMeteringCluster.u48CurrentSummationDelivered++; break;

Updating this attribute provides a new value for the IPD to read on each attribute read. A real Metering Device would also update the u8MeterStatus and i24InstantaneousDemand attributes for the IPD to query.

4.4 IPD Software The IPD application registers a structure with the Jennic SE library using the eSE_RegisterIPDEndPoint() function. This structure is updated by the SE library and read by the application (this structure is protected by a mutex). Once the IPD has joined the network, the IPD software calls the function eSE_ReadMeterAttributes() to read the Metering Device’s attributes. This calls the ZCL ‘Read Attributes Command’ to request the attributes from the Metering Device. The IPD sends this command every 10 seconds after the expiry of a JenOS software timer. The state of the software timer is checked in the main state machine in app_ipd_node.c. /* Restart timer has expired, query the Meter again */ if (OS_E_SWTIMER_RUNNING != OS_eGetSWTimerStatus(APP_RestartTimer)) { APP_ZCL_RefreshIPDData(); OS_eStartSWTimer(APP_RestartTimer, METER_READ_TIME, NULL); }

4

© Jennic 2009

JN-AN-1135 (v1.0) 6-Jul-2009

Jennic

ZigBee PRO Smart Energy Demo

4.5 On-Air Captures This section shows on-air captures of the eSE_ReadMeterAttributes() function request and the subsequent response. The screenshots were captured using the Daintree 802.15.4 Network Analyser, provided with the Jennic evaluation kits. For information on getting started with the Daintree software, see: http://www.daintree.net/downloads/appnotes/appnote_006_sna_jennic_jn51xxek.pdf

4.5.1 eSE_ReadMeterAttributes() Capture The ZCL information, in green, shows the details of the ‘Read Attributes’ command. The Attribute Identifier List displays the attributes that have been requested, along with their attribute number. The two most significant bytes of this number define the attribute set, and the two least significant bytes identify the attribute within that set – for example, ‘Metering Device Type’ has the attribute number 0x0306, where the attribute set is 0x03 (the Simple Metering Formatting attribute set) and the identifier is 0x06.

JN-AN-1135 (v1.0) 6-Jul-2009

© Jennic 2009

5

Jennic

ZigBee PRO Smart Energy Demo

4.5.2 Response to eSE_ReadMeterAttributes() The ZCL information, in green, shows the response to the ‘Read Attributes’ command. The ‘Read Attributes Status’ list details the success of each attribute query and its value. The list is in the same order as the request. In the capture below, all the requested attributes were successfully delivered.

6

© Jennic 2009

JN-AN-1135 (v1.0) 6-Jul-2009

Jennic

ZigBee PRO Smart Energy Demo

4.6 Operating Instructions 1.

Program a Jennic Controller board with the IPD_NODE binary (the IPD will be a ZigBee Router).

2.

Program a Jennic Sensor board with the METER_NODE binary (the Meter will be the ZigBee Co-ordinator).

3.

Reset the IPD - LED D1 will now flash every second and the LCD panel will display the Jennic logo and “ZigBee Pro SE IPD”.

4.

Reset the Metering Device - LED D1 will now flash every second.

5.

Press SW1 on the Meter board - this will enable the Co-ordinator to accept children for 5 seconds (LED D1 will stop flashing).

6.

Press SW1 on the IPD board - the IPD will attempt to join the network and the LCD panel will display “Joining Network” (LED D1 will stop flashing). • If the IPD joins the network within the 5-second period, the LCD will display “Joined Network”. • If the IPD does not find a network, the LCD will display “Network Join Failed”. In this case, repeat Steps 5 and 6 until the IPD joins the network.

7.

On the IPD, when the LCD panel is displaying “Joined Network “, press SW1 to start the IPD requesting SE data from the Metering Device.

The LCD panel will display the following information:

ZigBee Pro Smart Energy IPD Status:

000

Demand:

00000000

Summation:

00000012

SW1 – Read Meter

The IPD will now query the Meter using the SE ‘Read Attributes’ command every 10 seconds and the summation value will increment on the LCD panel. A ‘Read Attributes Command’ can also be triggered manually be pressing SW1 on the board. This is labelled on the LCD screen.

JN-AN-1135 (v1.0) 6-Jul-2009

© Jennic 2009

7

Jennic

ZigBee PRO Smart Energy Demo

5 Compatibility The software provided with this Application Note has been tested with the following Jennic kits and SDK (Software Developer’s Kit) versions: Product Types

Part Numbers

Version

Supported Networking Protocols

Evaluation Kit

JN5148-EK010

1.0

JN5148 ZigBee PRO SDK Libraries

JN-SW-4040

1.0

ZigBee PRO

JN5148 ZigBee PRO SDK Toolchain

JN-SW-4041

1.0

ZigBee PRO

ZigBee PRO

6 Building and Downloading the Application In order to build the software provided with this Application Note, the application’s folder must be placed directly under \Application\, where is the path into which the JN5148 ZigBee PRO SDK was installed (by default, this is C:\Jennic). The Application directory is automatically created when you install the SDK. You can obtain the latest versions of the JN5148 ZigBee PRO SDK libraries and toolchain from the Support area of the Jennic web site (http://www.jennic.com/support). The relevant part codes are JNSW-4040 for the libraries and JN-SW-4041 for the toolchain.

Note: This application uses the ZigBee PRO wireless network protocol, which is only supported on the JN5148 wireless microcontroller. Eclipse project files for the JN5148 device are provided. To build the application and load it into the JN5148 boards, follow the instructions below: 1.

Ensure that the project directory is located in \Application where is the path into which the SDK was installed.

2.

3.

Start the Eclipse platform and import the relevant project files (.project and .cproject) as follows: a)

In Eclipse, follow the menu path File>Import to display the Import dialogue box.

b)

In the dialogue box, expand General and select Existing Projects into Workspace.

c)

Enable Select root directory and browse to the Jennic Application directory.

d)

In the Projects box, select the project to be imported.

in Build the project. To do this, use the drop-down list associated with the hammer icon the Eclipse toolbar to select the relevant build configuration – once selected, the project will automatically build. The binary files will be created in the relevant build configuration directory.

8

© Jennic 2009

JN-AN-1135 (v1.0) 6-Jul-2009

Jennic

ZigBee PRO Smart Energy Demo

4.

Load the resulting binary files into the boards from the appropriate build configuration directory. You can do this directly from Eclipse or using the Jennic JN51xx Flash Programmer (described in the JN51xx Flash Programmer User Guide (JN-UG-3007)).

JN-AN-1135 (v1.0) 6-Jul-2009

© Jennic 2009

9

Jennic

ZigBee PRO Smart Energy Demo

Revision History Version 1.0

10

Notes First release

© Jennic 2009

JN-AN-1135 (v1.0) 6-Jul-2009

Jennic

ZigBee PRO Smart Energy Demo

Important Notice Jennic reserves the right to make corrections, modifications, enhancements, improvements and other changes to its products and services at any time, and to discontinue any product or service without notice. Customers should obtain the latest relevant information before placing orders, and should verify that such information is current and complete. All products are sold subject to Jennic’s terms and conditions of sale, supplied at the time of order acknowledgment. Information relating to device applications, and the like, is intended as suggestion only and may be superseded by updates. It is the customer’s responsibility to ensure that their application meets their own specifications. Jennic makes no representation and gives no warranty relating to advice, support or customer product design. Jennic assumes no responsibility or liability for the use of any of its products, conveys no license or title under any patent, copyright or mask work rights to these products, and makes no representations or warranties that these products are free from patent, copyright or mask work infringement, unless otherwise specified. Jennic products are not intended for use in life support systems/appliances or any systems where product malfunction can reasonably be expected to result in personal injury, death, severe property damage or environmental damage. Jennic customers using or selling Jennic products for use in such applications do so at their own risk and agree to fully indemnify Jennic for any damages resulting from such use. All trademarks are the property of their respective owners.

Jennic Ltd Furnival Street Sheffield S1 4QT United Kingdom Tel: +44 (0)114 281 2655 Fax: +44 (0)114 281 2951 E-mail: [email protected] For the contact details of your local Jennic office or distributor, refer to the Jennic web site:

JN-AN-1135 (v1.0) 6-Jul-2009

© Jennic 2009

11

Suggest Documents