openTrendCurves()

Opens a trend with a configuration trendName and replaces the curves that contain a dollar parameter.

Synopsis

void openTrendCurves(string trendName, int trendType, dyn_string Curves, string sModuleAndPanel="");

Parameters

Parameter Description
trendName Name of the trend group
trendType Integer number for characterizing the trend type. Use the following parameters:
-1 Last view
0 Undefined
1 Trend of today open
2 Trend of today closed
3 Trend of the selected day closed
4 Trend of the current week closed
5 Trend of the last week closed
6 Trend of the selected time range closed. A panel for the selection of the time range opens.
7 Trend of the last 24 hours open
8 Trend of the last 3 day open
Curves The return value of makeDynString("$CURVE1:dp1", "$CURVE2:dp2", "$CURVE3:dp3 ".. ,"$CURVE8:dp16). A single display can contain up to 16 curves. The used data points will be dp1 to dp16.
Anmerkung: If you configure a non-numeric data point, the non-numeric data point is skipped and the next available numeric data point is used.
You can also use a CNS name instead of a DP. In this case the CNS name is shown unless the DPE linked to a CNS node does not have a description.
sModuleAndPanel A module and a panel in which the trend is opened.

Return value

void

Error

Description

Opens the trend with the configuration trendName and replaces the curves that contain a dollar parameter. For easy working with the Variable Trend, there are 2 curves predefined by default. The function call is according "$CURVE1:[DP].C?+1.MIN" meaning that the compressing level is not fixed. You can also use:

"$CURVE1:[DP].C?-1.MIN"

The function with C? automatically selects the best display for the values.

The function openTrendCurves replaces the dollar parameters of a trend curve. The curve that is open must not contain a data point. The DP is passed with the Curves parameter of the openTrendCurves() function. See also the chapter Panel Trendkonfiguration erstellen und verändern.

Anmerkung: If you specify the same curve more than once, the duplicates are not shown and the following error message is shown: "CURVE is used multiple times in trend ["name"]". Also, if you configure an invalid curve or if the data point configured for a curve is not numeric or the data point does not exist, the curve is not shown and an error message is shown:
  • For an invalid / not existing curve: "Curve does not exist".
  • For a not numeric curve: "["DP name"] There is not data point available in this trend configuration".
  • For a not existing data point: "["DP name"] There is no data point available in this trend configuration".
  • This occurs when the user wants to display more $curves than are available: "There are too few curves to display '$CURVE["DP name"]' in trend '[Trend name]'"

    "CURVE is used multiple times in the ["Name"] trend" because there are no curve numbers, if you call it with "$CURVEdp1" or "$CURVE:dp1". You are allowed to call it multiple times without a number, but it is still limited to the available curves in the Trend configuration.

Example

The trend group "MIN-MAX" opens, for example, a trend display with a black curve of a measured value, a red curve for a maximum value and a green curve for a minimum value. In this case, the function for a compressed data point would be:

main()
{
  openTrendCurves("MIN-MAX", -1, makeDynString("$CURVE1:TEST.C1.AVG", "$CURVE2:TEST.C2.MIN",
                  "$CURVE3:TEST.C2.MAX"));
}

Automatically, the Variable Trend displays in a new module.

Example

In this example, the trend "ExampleTrend2" opens in the type "last view" and the values of the DP "ExampleDP_Result" will be shown.

main()
{
  openTrendCurves("ExampleTrend2", -1,
                   makeDynString("$CURVE1:ExampleDP_Result."));
}       

Example

CNS names can be used for a trend curve:

main(mapping event)
{
  openTrendCurves("VarTrend_0002",1,makeDynString("$CURVE1:System1.Windpark:WindWane.WindDirection.Easterly", "$CURVE2:System1.Windpark:WindWane.WindDirection.TrueNorth"));
}            

Example

When adding trend curves with the function openTrendCurves(), you do not need to specify the number of a curve and the sequence in which the curves were created in the variable trend panel is used automatically. Therefore, you can add curves as follows:

Using the curve number:

main()
{
 openTrendCurves("MIN-MAX", 1, makeDynString("$CURVE1:Analog_DP.C1.AVG_WT0", "$CURVE2:Analog_DP.C2.MIN",
 "$CURVE3:Analog_DP.C2.MAX"));
}
or without the curve number and colon:
main()
{
 openTrendCurves("MIN-MAX", 1, makeDynString("$CURVEAnalog_DP.C1.AVG_WT0", "$CURVEAnalog_DP.C2.MIN",
 "$CURVEAnalog_DP.C2.MAX"));
}
Anmerkung: Note also that an error message is displayed if a curve is not available.

Example

You can also use the function openTrendCurves() without specifying the number of a curve followed by a colon and the DP name.

main()
{
    openTrendCurves("VarTrend_0003", 7, makeDynString("$CURVE:dp1.response.actvalue.value",
                   "$CURVE:dp1.command.setpoint",
                   "$CURVE:dp1.command.setpoint")
                    );                
}          

Assignment

Dialog functions

Availability

UI