Cicode Error: Incompatible types (Vijeo Citect 7.10)

AndrewStarz

Member
Join Date
May 2012
Location
Angono, Rizal
Posts
20
Please Help guys, i've been looking for this Function for days. The Function is TrnGetTable, but i'm having issues on it, when i Compile my Project, it gives me Errors.

Error: Incompatible types
Context: Line[805]: 0, 60, 10, {TTable123} [0], 2);

This is the Cicode:

{CICODE}
REAL TTable123 [100];
TrnGetTable("ACS1_AH_7301_CWT_HMI_in", 0, 60, 10, TTable123 [0], 2);
{END}


i Placed it on a Report File which is on a request basis period.

I dunno what's wrong with it, and i can't Compile it. Hope you Guys Help me.
 
I think you will find array's can not be decalared within a function. Try creating a memory i/o device and adding an array tag to the variable tags.
 
I think you will find array's can not be decalared within a function. Try creating a memory i/o device and adding an array tag to the variable tags.

Thanks so much chelton! this will be a big help, i'll try this one out. and might ask again if i got another question! (y)
 
So this was my Problem now. i already created a Disk I/O Device. my problem is how to make it Memory. and the new tag that i have defined on this new i/o device got an error.

Error: Bad IO Device variable
Context: TTable123[100] (this was also the address of the variable that i have defined)

here i have attached the screen shots for easy identification:

This was the IO Device i made:
MemoryIODevice.jpg


This was the Array that i have defined:
VariableArray.jpg


This is the Error Code after Compiling:
Error.jpg
 
So this was my Problem now. i already created a Disk I/O Device. my problem is how to make it Memory. and the new tag that i have defined on this new i/o device got an error.

Error: Bad IO Device variable
Context: TTable123[100] (this was also the address of the variable that i have defined)

here i have attached the screen shots for easy identification:

This was the IO Device i made:
MemoryIODevice.jpg


This was the Array that i have defined:
VariableArray.jpg


This is the Error Code after Compiling:
Error.jpg


The problem here is that generic i/o device has a maximum request lenght of 2048 bits. 2048/32 (32 number of bits for real) = 64.
So the maximum array size for a real would be 64.

If you write the function as a cicode function and declare the real array as a module or global variable you can overcome this limitation.

I'm not sure what you are trying to achieve with the TrnGetTable function in the report file? This function only populates the defined array tag data from the trend tag data for the period defined.

The return data for the function is the number of samples read or an error code.
 
Thank you Very much again chelton for that input. though i'm still figuring it out.

i have already fixed that problem. and defined a variable array. oh i didn't use the GENERIC protocol, i used modnet20 instead, and mimic the addressing of Analog Tags. which i used is 404000[60] as address.

BTW, i'm using this because i need to put the Trend Data into my Report. and i need 60 samples from the Trend Database. because right now, i'm using the TrnExportCSV as a way to get the Trend Data. but i can't call it as a kind of Report which is Needed because it Only indicates the Variable Name, Time and Date of the Values recorded. If i could only Customize the Output File of the said Function (TrnExportCSV), then i wouldn't bother to use the TrnGetTable at all. what i'm trying to achieve here is to Make a Report including the Trend Data. Which could also give me the ability to get the Average, Min and Max of a Trend Variable for the Specified Time. Well Thanks you so much for the Inputs right there, it's giving me hope, because I've been searching for some kind of tutorial or sample codes of this function through the net but nothing really helped me. that's why i asked here.

If Someone could just give me a sample code of a real working one using the function "TrnGetTable" then i would most appreciate it. i don't know why but the example from the Help menu, i can't really figure it out.

By now, i'm making a Cicode Function for this one. but i can't figure out what global variable is, so i might do a research about that. well thank you very much for all the help chelton! i hope you could help me more. by this time, i'm already realizing some problems that might occur, hehe. but i hope to make solutions for that.
 
EXAMPLE..

FUNCTION
ProdRep_Monthly(STRING sTrendTag_Primary,STRING sTrendTag_Secondary);
INT iDay = 1
INT iMonth;
INT iYear;
INT iEndTime;
INT iError;
INT iCount;
INT Pri_AccTonnes = 0;
INT Sec_AccTonnes = 0;
REAL Pri_Total;
REAL Sec_Total;
STRING sDate;
iMonth = DateMonth(Report_Date);
iYear = DateYear(Report_Date,1);
WHILE iMonth = (DateMonth(Report_Date)) DO
sDate = IntToStr(iDay)+"/"+IntToStr(iMonth)+"/"+IntToStr(iYear);
iEndTime = DateAdd(StrToDate(sDate),StrToTime("18:00:00"));
ErrSet(1)
iCount = TrnGetTable(sTrendTag_Primary,iEndTime,60,720,TrendTable1[0],2,"");
iCount = TrnGetTable(sTrendTag_Secondary,iEndTime,60,720,TrendTable2[0],2,"");
iError = IsError()
Pri_Total = TableMath(TrendTable1,720,1,0)
Sec_Total = TableMath(TrendTable2,720,1,0)
Print(sDate+"^t "+RealToStr(Pri_Total,6,0)+"^t^t^t "+RealToStr(Sec_Total,6,0))
Print("\Par ")
iEndTime = DateAdd(iEndTime,86400);
iMonth = DateMonth(iEndTime);
iDay = DateDay(iEndTime);
Pri_AccTonnes = Pri_AccTonnes + Pri_Total;
Sec_AccTonnes = Sec_AccTonnes + Sec_Total;
END//
Print("Total Prodution:"+IntToStr(Pri_AccTonnes)+"^t^t^t "+IntToStr(Sec_AccTonnes));
Print("\Par ");
END//


 
Wow! thats Huge. thanks for that. i can't see the relevance of the Function you Posted. i only know that its some sort of report, due to the Words that you used. and hey i already fixed the error. and its working now. i just dont know if its right but the report already has the Trend data i needed. and i just don't exactly know if it was right due to the value given to me by Array1 is 0.00. hehe oh but from this on, i know what i'm going to do. i did what you told me, to make a global variable and a function and it worked! this is really great! thanks you very much chelton! i'll be looking on to that function you posted above, but its going to get some time before i could digest that one! i'm looking forward to making this one workout! thank you for all the inputs.
 
OOPSS! i didn't analyze you Post Carefully. there it is! i saw how you've done it. but i can't seem to understand other commands like the "/Par" ant those "t^t^t^".

and how about the defined variables? could you point them out? hehe thanks for that one! i'm gonna try some of them. so... you've used strings for those two. the primary and secondary. i just can't get yet the formatting of those dates and times. you must've been a very great programmer to be able to formulate that. sorry i'm just very new to Vijeo Citect. i don't even have any form of training. i just self study it. so kindly unsderstand me. thanks!
 
I have some Questions in mind. just wanna ask if
-First, could i just use a Local Variable for the Variable Array to be used on the TrnGetTable?
-Second, Could i Display the Value of an Array? like for Example my Variable Array is TTable and array size is 60, which has a Real Data Type. what if i used an object with an expression of TTable[5] on Value Display. would it display the current value inside that array?
-Third, i Can't seem to understand where (Report_Date) from example above came.

Those we're my current Questions. Thanks!
 
I have some Questions in mind. just wanna ask if
-First, could i just use a Local Variable for the Variable Array to be used on the TrnGetTable?
-Second, Could i Display the Value of an Array? like for Example my Variable Array is TTable and array size is 60, which has a Real Data Type. what if i used an object with an expression of TTable[5] on Value Display. would it display the current value inside that array?
-Third, i Can't seem to understand where (Report_Date) from example above came.

Those we're my current Questions. Thanks!


1 - An array cannot be declared local to the cicode function, only module or global, or as a variable tag. As a variable tag the array size is limited by the maximum request length of the protocol used.

2- You could display the value of the array in the graphics builder if the array is in the variable tags. However this array will only be updated when your cicode function that uses "TrnGetTable" is called.

3- I Just did a copy and paste from an old project, Report_Date is a local variable that allows is set from a pop-up that allows an operator to choose the month of report.
 

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,246
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,352
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
89
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
273
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
507
Back
Top Bottom