cicode help

zd83

Member
Join Date
Feb 2008
Location
Ankara
Posts
5
Hi all
i have a problem with cicode. i want to take average of 50 values with a cicode cycle. i want to read 50 valus and add them then find the average value of them. how can i do this? also is here any cicode notes,help,samples,etc?

best regards.
 
This is fairly easy to do

AverageTag = Value1 + Value2 + Value3 ......... +Value50 /50

Read the citect help files there are chapter after chapter of help on Cicode
 
i don't know anything about cicode, so your answer is not clear for me. i think i need to write a function which will do the addition. but i don't know even how i can idetify the tags. i need a complete cicode example. also there is nothing about average or mean value in the help topics.

thanks.
 
If you know how to work out the average of a value in basic mathematic terms then you should be able to translate that into Cicode very easily.

To write a function start a piece of cicode and declare the function at the top i.e. FUNCTION Average() this creates the function which can be used anywhere in Citect

Below the function write your mathematics to work out your average from the tags required.

It really is that simple, have a look at the CSV_Include project for examples of Cicode, you should be able to work out what you need to do from there.
 
i know basic mathematics, i meant that i don't know anything about cicode programming. i can do this in siemens win cc with vbs or c both but cicode is different. i will try what you said. thanks.
 
Well you NEED to know and identify which tags you are working with or how are you even going to start ?

There is lots of ways to do this but in its simplest terms:

FUNCTION Average()

AverageTag = Tag1 + Tag2 + Tag3 + Tag4......Tag50 /50

END

Now call that function with the Cicode object on the page you want to display it on.
 
there are table functions available in cicode which will operate on an array of values, search the help for table array
 

Similar Topics

Hi Everyone I'm a CITECT noob and am currently doing a SCADA class to increase my skills. However, I'm having trouble getting my head around some...
Replies
2
Views
1,236
in the past i have only been doing small mods to existing cicode and coping sections to reuse and modify to suit. Now i have been tasked to write...
Replies
5
Views
2,771
Some cicode help required Please. i am by no means a cicode expert. i have a tag "D2_WESP_TRA_Op_stat" which depending on its returned integer...
Replies
6
Views
3,270
Hello, Any one no below function, i do not how to make it in Cicode. Please advise me. FUNCTION MyTagWrite(TagName, NewValue, Message) STRING...
Replies
0
Views
1,346
Hi all, I need your help in finding a way to display a Variable tag in a page ( pop up ) which is created by using CICode ---> hForm16 =...
Replies
1
Views
2,261
Back
Top Bottom