Plant Model (CNS) Nodes in a Query

You can use plant model (CNS) nodes in the FROM part of an SQL query. This chapter shows how to use a plant model and its nodes for a query. Note that all SQL keywords can be used for queries.

The following view is used for this example. It contains two wind parks and the nodes Anemometer and Wind vane.

  1. Open the Plant Model Editor via Graphics Editor GEDI > Module Menu > Plantmodel editor or via the icon in GEDI.
    Figure 1. Plant Model (CNS)
  2. Create the nodes as shown above - see also the Plant model editor help.
  3. Create data points for your nodes via the PARA module and add alert handlings to your data points.
  4. Add the data points to your plant model nodes via drag&drop from the DP view on the right. Drag a data point to the Datapoint field.
  5. Open the SQL query via System Management > Reports > SQL Query.
  6. Check the check box Alert:
    Figure 2. Alert Tab
  7. Open the Select tab and select the elements _alert_hdl.._value, _alert_hdl.._text and _alert_hdl.._alert_color:
    Figure 3. Select Tab
  8. Open the From tab and select System1.Windpark1:WindResource.WindVane.WindDirection. Since the node WindDirection has sub elements, add .*: (dot asterisk) before the colon.
    Note: Note that the colon must be the last character of the FROM statement.
    Figure 4. From Tab
  9. Open the Where tab and select the Data-point level from the Keywords for WinCC OA check box. Select then the comparison = (equals). For the Comparison value select the data point southerly:
    Figure 5. Where Tab
    Note: The timerange tab must not be used for plant model (CNS) queries since historical queries are not supported.
  10. Open the Sort/Group tab, enable the radio button DP element and select the _alert_hdl_..value from the drop-down menu:
    Figure 6. Sort/Group Tab
  11. Open the Data tab and click the button Create query. Save the query via the disk symbol and click on Start query button. The following query is created:
    SELECT ALERT '_alert_hdl.._value', '_alert_hdl.._text', '_alert_hdl.._alert_color' FROM 'System1.Windpark1:WindResource.WindVane.WindDirection.*:' WHERE _DP = "southerly"
    The query is executed and the alert of the data point node southerly is shown. The time, color and text of the alert are shown:
    Figure 7. Data Tab