Professional Documents
Culture Documents
How To : Expose Custom Measurements For Use in Web Applications
How To : Expose Custom Measurements For Use in Web Applications
Schneider Electric provides the resources specified in this document. These resources can be used to minimize
engineering efforts, but the use, integration, configuration, and validation of the system is the user’s sole
responsibility. Said user must ensure the safety of the system as a whole, including the resources provided by
Schneider Electric through procedures that the user deems appropriate.
Notice
This document is not comprehensive for any systems using the given architecture and does not absolve users of
their duty to uphold the safety requirements for the equipment used in their systems, or compliance with both
national or international safety laws and regulations.
Readers are considered to already know how to use the products described in this document.
Intention
This document is intended to describe how to expose your custom measurements for use in Web Applications
especially in energy-related Dashboard gadgets and reports
1. Introduction 4
1.1. Purpose 4
1.2. Dashboard Gadgets and Custom Measurements 4
1.3. Before You Begin 5
1.4. About this Document 5
1.1. Purpose
StruxureWare Power Monitoring (SPM) 7.0 and 7.0.1 are installed with a default set of measurements. The
Customer’s application may require additional custom measurements to represent non-typical data, such as
energy price, energy costs, etc. Custom measurements are created using the Logical Device Type Editor tool.
These measurements are available throughout the application; however additional database configuration is
required to expose custom measurements to Dashboard Gadgets.
All measurements in SPM 7.0 and 7.0.1 are defined by an internal set of characteristics called metadata. This
metadata is used only by Web Applications and it describes:
• The measurement type;
• How the measurement is processed; and
• How the measurement is displayed.
When a custom measurement is created in the Logical Device Type Editor, it is defined with a default set of
metadata which requires manual definition to reflect the proper the measurement definition and to expose the
measurement to Dashboard Gadgets.
In SPM 7.0 or 7.0.1, this metadata is only accessible via a direct connection to the ApplicationModules database;
Users do not have access this data through the Application user interface.
The purpose of this document is to guide you through how to update the metadata for a custom measurement
so that it is available for use by energy-related Dashboard Gadgets.
Dashboard Gadgets are designed to display data for specific applications. For example, the Period over Period
gadget is designed to display consumption totaled at specified intervals (daily, weekly, monthly) between two
similar time intervals (this week over last week, this month over last month, etc). With this design, only
measurements that are configured for the intended application are available for selection during gadget
configuration. In the Period over Period example, only measurements defined as consumption measurements
will be available for use in this gadget.
The only case where you must apply this document is when the custom measurement:
1. Should be exposed to energy gadgets/reports;
2. Will contain cumulative data;
In this case, you must define its metadata appropriately via data configuration directly in the system databases.
The background knowledge and instructions for configuring your custom measurements are described in this
document.
To follow the instructions in this document, you must have knowledge and experience with the following:
• SQL Server Management Studio
• How to write T-SQL queries
• How to connect to the Application databases
• How to locate specific tables and view its data
• How to update records in these tables
It is strongly recommended that you backup the database before you implement any changes described in this
document.
This document contains the information to configure custom measurements for proper use and exposure in
energy-related items in SPM Web Applications. It does not provide an explanation of the database structure or
how a measurement’s metadata configuration affects the how the measurement is handled by Web
Applications. The intention of this document is only to provide the steps to expose the custom measurement
to energy-related gadgets.
The steps involved in each part are outlined in the sections below.
To expose the custom measurement to energy-related dashboard gadgets, you need to change the
measurement’s metadata for the following two measurement characteristics:
1. Set APPLICATION to CONSUMPTION and
2. Set UTILITY to a value that is not N/A. For example: ELECTRICITY, GAS, etc.
To designate the custom measurement as a cumulative measurement, you need to change the measurement’s
Accumulation Type characteristic:
1. Set ACCUMULATION_TYPE to CUMULATIVE.
In order to change the custom measurement’s metadata, you will need to know three IDs for each characteristic
(Note: the MetadataValueId represents both the characteristic and metadata):
1. The measurement’s MetadataItemId;
2. The MetadataValueId for the measurement’s current metadata; and
3. The MetadataValueId for the target metadata.
This section provides steps that will guide you on how to get the Ids and update the metadata. Follow the step-
by-step instructions below.
Log onto the SQL Server instance and connect to the ApplicationModules database with read and write access
at minimum.
First identify the Metadata currently assigned to your custom measurement by running the following query or
reviewing the CommonDataModel.TopicMetadataView view :
Figure 1: TopicMetadataView
Take note of the measurement’s TopicId and MetadataItemId for use in following steps. Note: A negative
TopicId indicates a custom measurement. Measurements supplied by the factory have a positive TopicId
number.
Measurement TopicId
To expose the custom measurement to energy-related dashboard gadgets, you need to change the metadata for
the APPLICATION and UTILITY characteristics and to designate the custom measurement as cumulative, you
need to change the measurement’s ACCUMULATION_TYPE characteristic. This step walks through how to get
the MetadataValueId for current metadata assigned to these characteristics.
To get the measurement’s MetadataItemId and current MetadataValueIds, run the following query in a new
Query window and replace the <TopicId> text with the number found in the previous step.
Measurement MetadataValueId
To expose the custom measurement to energy dashboard gadgets, you will set:
1. APPLICATION to CONSUMPTION and
2. UTILITY to a value that is not N/A. For example: ELECTRICITY, GAS, etc.
This step involves find the target MetadataValueIds for each of the new metadata assignments:
For the APPLICATION characteristic, run the following query to get the MetadataValueId for CONSUMPTION:
-- Find the MetadataValueId for CONSUMPTION
SELECT a.[MetadataValueId], a.[Value]
FROM [ApplicationModules].[Metadata].[MetadataValue] a
INNER JOIN [ApplicationModules].[Metadata].[MetadataName] b
ON b.[MetadataNameId] = a.[MetadataNameId]
WHERE b.[Name] = 'CDM.MdName.APPLICATION'
AND a.[Value] = 'CDM.MdValue.CONSUMPTION'
For the UTILITY characteristic, run the following query to get the MetadataValueIds for available utilities:
-- Find the MetadataValueId for desired UTILITY
SELECT a.[MetadataValueId], a.[Value]
FROM [ApplicationModules].[Metadata].[MetadataValue] a
INNER JOIN [ApplicationModules].[Metadata].[MetadataName] b
ON b.MetadataNameId = a.MetadataNameId
WHERE b.[Name] = 'CDM.MdName.UTILITY'
AND a.[Value] <> 'CDM.MdValue.N/A'
ORDER BY a.[Value]
You should see results similar to that in Figure 3 below perhaps with different MetadataValueIds. Select one
utility that best represents your custom measurement, and note the corresponding MetadataValueId.
For the ACCUMULATION_TYPE characteristic, run the following query to get the MetadataValueId for the
CUMULATIVE metadata:
-- Find the MetadataValueId for CUMULATIVE
SELECT a.[MetadataValueId], a.[Value]
FROM [ApplicationModules].[Metadata].[MetadataValue] a
INNER JOIN [ApplicationModules].[Metadata].[MetadataName] b
ON b.MetadataNameId = a.MetadataNameId
WHERE b.[Name] = 'CDM.MdName.ACCUMULATION_TYPE'
AND a.[Value] = 'CDM.MdValue.CUMULATIVE'
In the end, you should have 2 or 3 target MetadataValueIds depending on whether your custom measurement
represents cumulative data or not
With the necessary data gathered from the previous steps, update the necessary metadata assignments. Run
the following query once for each measurement characteristic that will change (APPLICATION, UTILITY, and
ACCUMULATION_TYPE):
-- Update Measurement metadata
UPDATE [ApplicationModules].[Metadata].[MetadataItemValue]
SET MetadataValueId = <Target MetadataValueId>
WHERE MetadataItemId = <Measurement MetadataItemId>
AND MetadataValueId = <Current MetadataValueId>
10
Step 7: Review
Review a summary of the assigned metadata by re-running the query in Step 2. Ensure:
1. CDM.MdName.APPLICATION is set to CDM.MdValue.CONSUMPTION; and
2. CDM.MdName.UTILITY is set to a value that is not CDM.MdValue.N/A.
3. CDM.MdName.ACCUMULATION_TYPE is set to CDM.MdValue.CUMULATIVE, if the custom
measurement represents cumulative data.
Step 8: Done
11
By default, a custom measurement is defined as DIMENSIONLESS (UnitId = 0). To ensure custom measurement
data is displayed with the proper unit of measurement, you need to update the UnitId field in two tables in the
ApplicationModules database with the proper UnitId for your measurement:
• DataSourceBus.DataSourceTopic, and
• CommonDataModel.Topic
Follow these steps to assign the proper unit of measurement to your custom measurement:
1. Log onto the SQL Server instance and connect to the ApplicationModules database with read and write
access at minimum, if not connected already.
2. Review the list of available units of measurement. Query the CommonDataModel.Unit table in a new
Query window. Note the UnitId of the appropriate unit of measurement.
Target UnitId
3. Update the assigned unit of measurement using your custom measurement’s TopicId (obtained in Part 1 –
Step 2). Run the following Update query in a new Query window:
12
UPDATE [ApplicationModules].[CommonDataModel].[Topic]
SET [UnitId] = <Selected UnitId>
WHERE [TopicId] = <TopicId>
4. Confirm the assignment. Run the following two queries using the measurement’s TopicId in a new Query
window.
13
14
If you do not see a measurement that you expect in the data series list, it is probably due to one of the
following:
• The cache needs to be updated. To view newly added measurements, click “Refresh List”.
• The measurement is not logged. Only logged measurements are available in the data series list.
• The measurement is an advanced measurement, and “Common Only” is selected in the Measurements
drop-down list.
o “Common Only” displays a selection of the most commonly used measurements.
o Select “All” in the Measurements drop-down list to display all available measurements.
• The measurement is not available for the utility selected in the Utility drop-down list.
o Select a different utility from the Utility drop-down list, and see if the measurement appears in
the data series list.
• The measurement type cannot be displayed in the selected gadget.
o For example, some gadgets only display consumption measurements, such as energy or volume.
o The data series list only displays measurement types available for the selected gadget.
o To find out which measurement types are available for a specific gadget, click the gadget help
icon.
• The measurement is a custom measurement for which the metadata is not set up correctly.
o The metadata defines the measurement type, as well as how a measurement is presented in the
Measurements and Utility drop-down lists.
o Metadata for a measurement supplied with the software is defined by the factory.
o Metadata for an application-specific measurement created in the field (i.e. a custom
measurement) must be defined by the person creating the custom measurement.
15
www.schneider-electric.com
Version 3.0.1 – Sep 2013