Cicode Error: Incompatible types (Vijeo Citect 7.10)

Thanks Chelton for those Answers again! i see, so that's how it works.

Mine's got buggy. it doesn't seem to be working at all. can you please tell me how do you call the Function that you posted above? is it via Button or what? i put mine in a button but even pressing it many times, the array doesn't even fill with the trend values that it is supposed to. i placed a display to monitor the value but still it doesn't change. i don't know whats wrong with it. i will post screenshots later to help with analyzing.

Thanks you so much for the replys! i appreciate it!
 
This is my Function on Cicode:

REAL TTable123[60];
FUNCTION
TRENDREP1(STRING sTrendTag, STRING sAverage)
INT iTableRep;
REAL Trn_Total;
iTableRep = TrnGetTable(sTrendTag,0,60,60,TTable123[0],2,"")
Trn_Total = TableMath(TTable123[0],60,1,0)
sAverage = RealToStr(Trn_Total,10,2)
END

And this is how i call the Function:
i placed it in a Button
TRENDREP1 ("ACS1_AH_7304_RAT_HMI_in", "TrendAve")

I tried on defining the array variable as Local Variable, but it doesn't change value.
Tried also defining it on a Disk I/O, still no luck. oh btw, i used modnet20 as the protocol on this config. and used the address 404000[60]

@chelton, what are the settings u used on the memory I/O? and what address. i want to try if that works. thanks!
 
This is my Function on Cicode:

REAL TTable123[60];
FUNCTION
TRENDREP1(STRING sTrendTag, STRING sAverage)
INT iTableRep;
REAL Trn_Total;
iTableRep = TrnGetTable(sTrendTag,0,60,60,TTable123[0],2,"")
Trn_Total = TableMath(TTable123[0],60,1,0)
sAverage = RealToStr(Trn_Total,10,2)
END

And this is how i call the Function:
i placed it in a Button
TRENDREP1 ("ACS1_AH_7304_RAT_HMI_in", "TrendAve")

I tried on defining the array variable as Local Variable, but it doesn't change value.
Tried also defining it on a Disk I/O, still no luck. oh btw, i used modnet20 as the protocol on this config. and used the address 404000[60]

@chelton, what are the settings u used on the memory I/O? and what address. i want to try if that works. thanks!


The problem is not the array tag. You are not returning or updating any variable in your function. I've modified your code with comments to help you. Paste this to a new cicode file save and compile.

You will need a local variable data type "string" called "s1"
"s1" can then be displayed on a graphics page.
Call the function with a button TrendRep1("ACS1_AH_7304_RAT_HMI_in");



//Declare Module variables.
MODULE REAL TTable123[60];
 
 
 
STRING//RETURN data type of TrendRep1
FUNCTION
TrendRep1(STRING sTrendTag) //TrendRep1 function returns the Maximum value of the trend tag passed as an argument for the last 60 minutes..
INT iTableRep; //Number of samples returned
INT iError;
REAL Trn_Total; //Highest value from array.
STRING sAverage = "";
ErrSet(1)//User mode error checking
iTableRep = TrnGetTable(sTrendTag,0,60,60,TTable123[0],2,"")//Get last 60 samples of "sTrendTag" at 60 Second intervals starting from "Now"
IF iTableRep <> 0THEN
Trn_Total = TableMath(TTable123[0],iTableRep,1,0); //Get the maximum from the Array for the number of samples read
sAverage = RealToStr(Trn_Total,10,2); //Convert Maximum real into a string.
ELSE
iError = IsError()//Get error code if error.
sAverage = "Error reading Trend tag"//If error reading trend tag return something.
END;
s1 = sAverage; //Update a local varaible for display on an object.
RETURN sAverage; //Return value for the function
END//
 
Thanks for the Help chelton! its working now. i can now get the Average of the Trend Values. you're so amazing. i dunno how you made that but its very great.

Another problem still remains. i dunno if you tried it already but i can't Display the Values of the Arrays. for example. i want to Display whats inside array number 1 (TTable123[0]). have you treid doing that? mine displays zero, but its supposed to display a value. i don't know if thats right so i need your advice.
 

Similar Topics

Hi all :) , I'm very new to CitectSCADA and Cicode programming, however have good programming experience in most major programming languages...
Replies
0
Views
1,258
I'm currently trying to upgrade a Citect 5.5 project to 7.3. The conversion process seems to work just fine, but I'm getting a few compiling...
Replies
9
Views
7,361
Hi All, Can anyone advise me on how to determine the AN of a genie instance I writing to. I have created a genie to display a valve and some text...
Replies
0
Views
97
I am trying to display a variable within a cicode function onto a graphics page. This function queries a SQL database. I can get the value onto a...
Replies
3
Views
320
Hi guys, its my first time progamming cicode and I need to do popups alarms, there are several digital alarms and in their rising edge transition...
Replies
0
Views
518
Back
Top Bottom