10.3.2 Functions for Trend

In this section, you can find subroutines frequently used for the Trend object. For more detailed information, please refer to the next section.

- Commands except TrendCsvWr are supported in XpanelDesigner versions 2.53 and above.

- The subroutine commands shown below operate a certain action without any value returned, unlike functions, which have a return value.

Command

Description

 

 

 

Trend

Subroutine

TrendCsvWr

Saves the trend data as a CSV file.

Subroutine

SetTrendZoom

Changes the min/max value of pen in the YT trend.

Subroutine

SetTrendRatio

Changes the min/max value ratio of the pen in the YT trend.

Subroutine

ResetTrend

Resets the min/max value of pen to default value in the YT trend.

Function

TrendGetPenVal

Returns set value from the min/max value of pen in the YT trend.

Function

TrendSetPenVal

Sets description or the min/max value of pen in the YT trend.

Subroutine

SetPenStatus

Shows or hides a pen from the YT trend.

TrendCsvWr

Saves the Trend data as a CSV file.

Subroutine

TrendCsvWr(“TrendName”, Location)

 

 

 

Description

Saves the assigned TrendName to the assigned Location in CSV file format.

When you assign 0 at Location, it means local drive. The value 1 means SD/MMC and a value of 2 means USB.

You may also assign the Location as shown below.

0: _LOCAL_

1: _SDMEM_

2: _USBMEM_

The file is saved as “TrendName_MMDDHHmmss.CSV”.

Example

Saves the Trend object named “Trend” as a CSV file in the USB memory.

TrendCsvWr(“Trend”, 2)

SetTrendZoom

Changes the min/max value of pen in the YT trend.

Subroutine

SetTrendZoom(“YT Trend Name”, pen number, min value to set, max value to set)

 

 

 

Description

Changes the minimum and maximum value of a pen by assigned set values. Changed values may be reset by the ‘ResetTrend’ subroutine. Each parameter has the following criteria.

YT Trend Name: The name of the YT trend object.

pen number: Target pen (1~16) to have its min/max changed.

min value to set: A value more than the current min value but less than the current max value.

max value to set: A value more than the current min value but less than the current max value.

 

Example

Changes the min/max value of the first pen in the YT trend object named “Trend” as 30 and 100 respectively.

SetTrendZoom(“Trend”, 1, 30, 100)

SetTrendRatio

Changes the min/max value ratio of the pen in the YT trend.

Subroutine

SetTrendRatio(“YT Trend Name”, pen number, min value ratio to set, max value ratio to set)

 

 

 

Description

Changes the minimum and maximum value ratio of a pen by assigned set values. Changed values may be reset by the ‘ResetTrend’ subroutine. Each parameter has the following criteria

YT Trend Name: The name of the YT trend object.

pen number: Target pen (1~16) to have its min/max value ratio changed.

min value ratio to set: A ratio of the minimum value (0~99).

max value ratio to set: A ratio of the maximum value (1~100).

Min value ratio cannot be bigger than the max value ratio.

 

Example

Changes the min/max value ratio of the first pen in the YT trend object named “Trend” as a 20% increased value of min (1.20 * min = new min) and 80% retained value of max (0.80 * max = new max).

SetTrendRatio(“Trend”, 1, 20, 80)

ResetTrend

Resets the min/max value of the pen to the default value in the YT trend.

Subroutine

ResetTrend(“YT Trend Name”, pen number)

 

Description

You can reset the minimum and maximum value of a specified pen to the default value.

YT Trend Name: The name of the YT trend object.

pen number: Target pen (1~16) to have its min/max value reset to default.

 

Example

Resets the min/max value of the first pen to the default value in the YT trend object named “Trend”.

ResetTrend(“Trend”, 1)

TrendGetPenVal

Returns the set value from the min/max value of the pen in the YT trend.

Function

N = TrendGetPenVal(“YT Trend Name”, pen number, set value)

 

 

 

 

 

 

 

Description

Returns the min/max value of the specified pen.

YT Trend Name: The name of the YT trend object

pen number: Pen number (1~16)to return min/max value.

set value:

 

Example

Returns the maximum value of the first pen in the YT trend object named “Trend”.

N = TrendGetPenVal(“Trend”, 1, 3)

TrendSetPenVal

Sets the description or the min/max value of the pen in the YT trend.

Function

N = TrendSetPenVal(“YT Trend Name”, pen number, set value, value to set according to set value)

 

 

Description

Configure the settings of the specified pen in the YT trend.

YT Trend Name: The name of the YT trend object

pen number: Pen number (1~16) to change the settings.

set value: 1 for description, 2 for minimum value, 3 for maximum value.

value to set according to set value: value to be assigned to pen’s set value.

The function returns 1 when the value set is successful. Otherwise, the function returns 0.

Example

Set the minimum value of the first pen in the YT trend object named “Trend”.

1 = TrendSetPenVal(“Trend”, 1, 2, 10)

SetPenStatus

Shows or hides a pen from the YT trend.

Subroutine

SetPenStatus(“YT Trend Name”, pen number, option)

 

Description

You can show or hide the specified pen on the YT trend.

YT Trend Name: The name of the YT trend object.

pen number: Pen number (1~16) to show or hide.

option: 1 for show, 0 for hide.

Example

Shows the first pen in the YT trend object named “Trend”.

SetPenStatus(“Trend”, 1, 1)