Defining a string array in Citect

Johnny T

Member
Join Date
Jul 2003
Location
Fife, Scotland
Posts
642
Hi

I'm trying to define a string array using Citects SCADA package and I've got an error that I can't shift.

I've defined a variable of the data type ARRAY and given it the address S22[25]. However, when I come to compile the project I get an "Array Size Exceeded" error.

Has anyone any ideas how to define a string array in Citect. I was wondering if maybe its a different pnemonic for an array ie. another letter instead of an 'S'??

Thanks in advance for any help you can give me

Cheers

JT :)
 
You can changes the size of the array but it is not advisable because if you get a service pack, the array size will be changed back to normal and you will be in trouble again.

You can define 2 arrays and place them side by side. You can also write to the disk PLC. That will give you a range of words sizes but may not be long enough.
 
BobB,

Thanks for the response mate. Interesting stuff about the service packs, I didn't realise that.

I was really just making sure that S22[25] was the correct format to make a 25 part array at address S22.

Do you know if this is correct? Or do arrays have to be written differently?

Thanks for your help

JT :)
 
Sorry, can't help you there. Have never used arrays. The problem with the service packs is that usually thaey overwrite the citect.ini file. This is where you would define the array length. I got caught years ago changing the length of tag and alarm descriptions. I now use both fields in the alatms and there is never a problem.

I can only suggest ringing or e-mailing Citect support. They are really very good.

I am based in Sydney, Australia, and know many of the Citect higher ups personally from my years in the electrical industry as a tradesman, sales rep, company CEO, systems integrator etc. In fact, I went to tech with some of these guys would you believe. YES!!!! I am an old b*****d!!!! Both comments are relevant.

I have also been a beta tester for some of their drivers over the years. BOY!!! Have they caused me some problems, but, at the end of the day, it makes for a better product for everyone.
 
BobB

I've just spoke to Tom Sabitzer (who you may know cos he's originally from Sydney) and he says that you can't define a string array. The official response was: The maximum size of a variable tag array is limited to the maximum block size of the protocol in use. Looks like you are using the GENERIC protocol with maximum block size of 2048 bits (or 255 characters), the maximum array size for STRING's is therefore 1. Probably worth noting that the maximum block size can never be greater than 2048 bits for any protocol.

However, it is possible by defining it in CiCode. So I'm going to try that now.

Thanks for your response mate.

All the best

JT :)
 
I do not remember Tom but there have been so many from Sydney. They have gone all over the world. I still get e-mails from China, Netherlands etc etc. I guess a lot of us "grew up together". There are also a lot who went elsewhere and came back to Citect. FIX, Wonderware etc etc. There are also a lot of VERY knowledgable people there. Early AB was also re-badged Citect (DOS days).

Cicode is really great stuff but you can also use VB. Not much you cannot do with both of those. Good luck.
 
Hi, Quite a bit of info you have been told so far is to put it mildly is ****. If Tom Sabitzer works for Citect then he needs to go back to his books and read his own help files.

Bob, the array size he is talking about is defined in his tag database, it has nothing to do with the citect.ini file or service packs.

A string array needs to be defined as an integer array with 1 ints per 2 string character + 1 int for overhead.


From the citect help files

NOTES: 1) You should not define large arrays, because each time an array element is requested, CitectHMI/SCADA reads the entire array from the I/O Device. With large arrays, system performance could be reduced.
The size of the array must be less than the maximum request length of the protocol. The I/O Device Description help topic (for your I/O Device) displays the maximum request length of the protocol.
2) You should declare all digital arrays on a 16 bit boundary. CitectHMI/SCADA rounds each digital array down to the nearest 16 bit boundary. Consequently, all elements in the array are changed. For example, if you declare an array Test to start at bit 35, and CitectHMI/SCADA starts the array at bit 32. The index to the array also starts at bit 32 - Test[0] refers to bit 32, not bit 35.

String Arrays
If you are using a CitectHMI/SCADA string data type, you must specify an array of integer data types. One INT register stores two STRING characters.
To calculate the size of an array (for string data types), use the following formula:
The last element of the array is always used to store the null character '\0'. This character marks the end of the string.
To store the word "Recipe", you must specify an array with 4 elements, for example:
Variable Tag Name Recipe_Tag
Address V500[4]


End help files


To try this
a) create a memory device
b) Make a tag called Test_Array of

data type int
Address I2[20]

Regards Alan Case
 
Alan

Thanks for the help. I got around the problem in the end by using a suggestion from Tom. The suggestion he gave (in case it helps anyone else out in the future) is to use Cicode to define a string array and then load elements in and out of it with functions... eg:

GLOBAL STRING myArray[25];

STRING
FUNCTION
GetProgNo(INT iIndex)

RETURN myArray[iIndex];
END

INT
SetProgNo(INT iIndex, STRING sValue)

myArray[iIndex] = sValue;
RETURN 0;
END
I've adapted this example and got over the hurdle I had.

Still I appreciate the info. Many thanks

JT :)
 
Hi. One small thing, it is only cosmetic, but when you define a global string, call it gsMyArray to let people know if they see it in the body of the code that it is a global string.
Regards Alan Case
 
Bob, the array size he is talking about is defined in his tag database, it has nothing to do with the citect.ini file or service packs.
Fair enough Alan. I have changed lengths of descriptions etc before in the citect.ini file and that has caused me problems when installing a service pack. Obviously made the wrong assumption.
 
Alan

Thanks for the tip. I appreciate it. I'm new to the Cicode side of things so any tips like that you have are very very gratefully received.

Cheers

JT :)
 

Similar Topics

Non-PLC guys asking me to explain all the interlocks of my system in a document. Problem is for this system its a little complicated (OR...
Replies
16
Views
5,444
Hi Everyone, I have a somewhat silly question. I've primarily programmed with Beckhoff PLCs in the past. In those, we can assign the string TRUE...
Replies
8
Views
2,411
Hello all. I am working on a project where there are 7 vents which have a cooling function with a S7-1200 station and a KTP Basic panel (1st.gen)...
Replies
6
Views
2,586
Hi guys, I asked this question on the Codesys website and didn't have much success with it. I'm looking at a way of defining arrays for real...
Replies
8
Views
5,544
hi to everyone, we are using ISaGRAF for programming our PLC. The problem is that we want to change the IO boards of the computer that we use...
Replies
0
Views
1,883
Back
Top Bottom