Citect Trends

Jayden

Member
Join Date
Dec 2007
Location
camperdown
Posts
41
Hi all. Im learning Citect and trying to setup a trend page. I have a Single Trend page setup and working with a digital tend tag. I access this page via a button on my Menu page with pagetrend("trend_page_name","Tag_name") in the command box. This works fine but I cannot figure out how to set the scale for this page. It is currently always 32000 unless I change it when I open the page. Can I set it so its at 1.5 for 100% and -.5 for 0% when I open the page without having to change it manually? I have found some info about Trdsetscale but cant figure where to put this code.

Any help appreciated
 
I have found that - values in scaling do not work.
You may have to write some Cicode.
 
After more reading I found that scaling does not work with digital tags. Ill have to learn some cicode as you said. Thanks.
 
There is a work around in the knowledge base.
How to trend digital variables and Cicode expressions

Article number: Q1337
Created on: 17/6/94
For Citect versions: 1.00 1.01 1.10 1.11 1.20 2.00 2.01
[SIZE=+]Summary[/SIZE]
If you try to trend a Cicode expression or a digital tag, Citect will set the trend scale to 0 - 32000. This is because Citect would normally get the scaling from the tag definition (in the VARIABLE.DBF database), but digitals and simple Cicode expressions do not have a scale. (Also if an expression returns a Real value, this value may get rounded.)
[SIZE=+]Solution[/SIZE]
The following example illustrates how you can trend an expression. The example uses a REAL value with a scale of 0 to 4.
First, define a real tag to use for scaling as follows.
Variable Tag Name : REALTAG
Data Type : REAL
Unit Name : PLC_1
Address : V496
Raw Zero Scale : 0
Raw Full Scale : 4
Eng Zero Scale : 0
Eng Full Scale : 4
Note : the above tag will use two words, ie V496 and V497. (In this example, the PLC type is TIWAY.)
Next, write a Cicode function for the expression as follows. The return type is a REAL (You can use INT if required.):
REAL
FUNCTION
TrendReal(Real temp)
/* the temp variable would not normally be used, scaling only */
REAL value; /* real, to temporally store expression result */
value = Sqrt(9.5); /* your expression */
RETURN value; /* function return, real value */
END
Third, define a Trend tag as follows:
Trend Tag Name : TRENDTAG1
Expression : TrendReal(REALTAG)
Sample Period : 2
File Name : [Data]:TREND1
(You can use the format and other fields if required.)
When Citect finds a variable tag name in the expression field, it will use the scaling of this tag to Scale the trend. This is the only use for the tag. If you need to trend several expressions, you can use the same variable tag for the scaling, providing the Scale is the same.
The following example trends a digital variable
Digitals in Citect do not have scales. If a digital is trended, the Scale would be set to 0 - 32000 and it would need to be rescaled at runtime. If you use an INT type tag in the trend expression field, Citect can then use the Scale of this tag for the trend. A 2 - 2 Scale is a suitable Scale to use.
First, define the Digital Tag as normal, and an Integer Tag as follows:
Variable Tag Name : DIGITALSCALE
Data Type : INT
Unit Name : PLC_1
Address : V498
Raw Zero Scale : -2
Raw Full Scale : 2
Eng Zero Scale : -2
Eng Full Scale : 2
Next, write a Cicode function (that will be used in the Trend expression field) as follows.
INT
FUNCTION
TrendDigital(INT scalevar, INT trendedvar)
/* scalevar is not used in the function */
RETURN trendedvar; /* function return, digital value */
END
Third, define a Trend Tag as follows:
Trend tag Name : TRENDTAG2
Expression : TrendDigital(DIGITALSCALE, BIT_1)
Sample Period : 2
File Name : [Data]:TREND2
Format : #
(You can use the format and other fields if required.)
BIT_1 is the digital to be trended. The value of the digital is simply passed to the function and returned without any manipulation. When Citect finds the first variable tag name in the expression field (DIGITALSCALE), it will use the scaling of this tag, to Scale the trend. This is the only use for the Tag.
 
Last edited:

Similar Topics

Hi all I'm new to citect and I'm trying to get me head around a trend issue, if you can assist it would be greatly appreciated. I'm told the...
Replies
4
Views
1,783
Hello, I want to change the default scale limits in the vijeo citect which is currently (-55 to 55). I want to change it to (0 to 10000) but when...
Replies
0
Views
1,267
I have upgraded Citect from 5.4 to 7.4 following the upgrade path, the program compiles and runs fine but a super genie that displays 3 trends...
Replies
7
Views
7,269
Hi Dears i want to fill gaps between Trend's Graph. i referd to Citect Help And I tried Some Trend Parameters such as...
Replies
8
Views
2,314
I wonder how to solve this issue in Citect 7.30 The trends are configured and working correctly. But the scales after launch are horrible. Is...
Replies
2
Views
1,762
Back
Top Bottom