Consumption Data Archive (‘Get Profile’)

Devices that support the Simple Metering cluster can maintain and exchange historical consumption (profiling) data using the ‘Get Profile’ feature. A consumption data archive, which is distinct from the data of the Simple Metering cluster attributes, is maintained in a circular buffer on the cluster server. A cluster client can make a ‘Get Profile’ request to the server to obtain data from this archive. Normally, the cluster server is implemented on a Metering Device and the cluster client is implemented on an IPD. Typically, the IPD requests a consumption history from the Metering Device in order to display this information to the consumer.

The consumption data in the archive corresponds to a series of consecutive time intervals with their corresponding consumption values. Thus, the archive consists of the last few consumption measurements - it is the responsibility of the application running on the server device to update the archive (see Section 42.6.1).

If the ‘Get Profile’ feature is required, it must be enabled in the compile-time options as described in Section 42.12. These options include the maximum number of consumption intervals that can be archived on the server (and therefore requested).

Updating Consumption Data on Server

The consumption archive is held on the Smart Metering cluster server in a circular buffer operating on a FIFO basis. This buffer provides storage space for a sequence of entries containing consumption data for consecutive time intervals, where each buffer entry is a structure of the type tsSEGetProfile consisting of:

  • End-time of consumption interval (as UTC time)

  • Units delivered to the customer

  • Units received from the customer (when customer sells units to utility company)

The maximum number of entries that can be stored in the buffer is determined at compile-time (see Section 42.12). When a new entry is added to a full buffer, this entry replaces the oldest entry currently in the buffer.

The application must keep the buffer up-to-date by adding a new entry using the function eSM_ServerUpdateConsumption(). Before this function is called, the relevant consumption data must be updated in one or both of the following Simple Metering cluster attributes:

u24CurrentPartialProfileIntervalValueDelivered

  • Contains the number of units delivered to the customer over the last interval

u24CurrentPartialProfileIntervalValueReceived

  • Contains the number of units received from the customer over the last interval

An attribute only needs to be updated if the corresponding consumption has been implemented (for example, the utility company often only delivers units to the customer and does not receive any from the customer).

eSM_ServerUpdateConsumption() takes the current time as an input and then adds an entry containing the consumption data (in the above attributes) to the buffer, where the supplied current time becomes the end-time in the entry (thus, the duration of the consumption intervals is dictated by the frequency at which this function is called - see below).

Note: The current time can be obtained by the application using the function u32ZCL_GetUTCTime(), described in Section 18.7.

eSM_ServerUpdateConsumption() must be called periodically by the application. The period must match the value to which the Simple Metering eProfileIntervalPeriod attribute has been set (see Section 42.2). Standard periods, ranging from 2.5 minutes to one day, are provided as a set of enumerations (see Section 42.10.10).

Parent topic:Consumption Data Archive (‘Get Profile’)

Sending and Handling a ‘Get Profile’ Request

The application on a device which supports the Simple Metering cluster as a client, such as an IPD, can send a ‘Get Profile’ request to the cluster server by calling the function eSM_ClientGetProfileCommand(). This function allows consumption data to be requested from the archive for one or more intervals.

The inputs for this function include:

  • A value indicating whether the units delivered or units received (by the utility company) are being requested (see Section 42.6.1)

  • An end-time (as a UTC time) - the most recent consumption data will be reported which has an end-time equal to or earlier than this end-time (a specified end-time of zero will result in the most recent consumption data)

  • The number of consumption intervals to report (this number will be reported only if data for sufficient intervals is available) - the end-time rule, specified above, will be applied to all the reported intervals

On receiving the request, the event E_CLD_SM_SERVER_RECEIVED_COMMAND containing the command E_CLD_SM_GET_PROFILE is generated on the server, causing the callback function on the device to be invoked (for a Metering Device, this is the callback function registered through eSE_RegisterEspMeterEndPoint() or eSE_RegisterMeterEndPoint()). The callback function only needs to be concerned with this event if the archive data needs to be modified before the ZCL automatically sends the requested data in a ‘Get Profile’ response. The response indicates the number of consumption intervals reported and contains the consumption data for these intervals, as well as the end-time of the most recent interval reported.

On receiving the response, the event E_CLD_SM_CLIENT_RECEIVED_COMMAND containing the command E_CLD_SM_GET_PROFILE_RESPONSE is generated on the requesting client, causing the callback function on the device to be invoked (for an IPD, this is the callback function registered through eSE_RegisterIPDEndPoint()). The callback function should extract the requested data from the event using the function u32SM_GetReceivedProfileData() in order to process or store the data. This function should be called for each consumption interval reported in the event - the code fragment below illustrates repeated calls to the function until all the reported data has been obtained:

for (i =0 ;i < sGetProfileResponseCommand.u8NumberOfPeriodsDelivered; i
++)
{
    //Read data from event
X(i)= u32SM_GetReceivedProfileData(tsSM_GetProfileResponseCommand *psSMGetProfileResponseCommand)
}

Alternatively, the function can be called repeatedly until it returns 0xFFFFFFFF, which indicates that there is no more data to be extracted from the event.

Parent topic:Consumption Data Archive (‘Get Profile’)

Parent topic:Simple Metering Cluster