ControlLogix scan time & efficency question

CroCop

Member
Join Date
Aug 2005
Location
Utah
Posts
1,050
I've got quite a few UDTs that I pass portions of to quite a few subroutines. Is it more efficent & faster to pass the entire UDT, or to pass the nessecary portions of the UDT?

Thanks,

Marc
 
I am not 100% sure, but.

IF your UDT's are built properly they will be contigious memory with no voids. They should move pretty efficiently.

You should always try and move 32 bit words. CLX is designed on 32 bit words. It can manipulate Dints and Reals faster than lots of bools. 16 bit integers execute much slower also. You should convert them to Dints before doing lots of data manipulation on them.

If you are passing words and only need portions of a large UDT then I would only pass the portion needed. If there are some Bools mixed in and you need them I would probably pass the whole structure.

Unless the UDT's are large and you only need small peices of them I doubt you will see a difference?

I usually build my UDT's so that I can pass the entire structure. It keeps it a lot cleaner. Maybe you could break up your UDT into several smaller ones so you can pass the whole structure?

There are a lot of variables to consider. If we knew more exactly what you were doing a better answer might be possible.

CLX is VERY fast. Unless your application is massive or will be massive someday I doubt you will ever be able to tell a difference.

Is that as clear as mud? That is my understanding of data in CLX's.

Maybe someone can tell us more, or correct me?

RSL
 
My app is an overhead crane moving point to point.
I have a Crane UDT, which consists of:
Drive - Fault, Setpoint Speed
Position Feedback - Real Number
Virtaul Limit - A couple of BOOLS and real numbers
I believe the Crane UDT is 2048 bytes, and that doesn't seem that big off the top of my head.
I believe that the larger members (5) UDTs make up roughly 400 bytes a piece, so that doesn't seem to be a ton of data to pass to the subroutine.
 
Although there are better and worse ways to organize data, I would not lose any sleep over this.

This is a crane it will always be a crane. It will not be 10 cranes only 1 right? Meaning the application will not grow much if at all after you commision it.

CLX has more than ample horsepower for this. I think you will find your scantimes to be VERY fast if all you are doing is operating a crane.

It is always best to do things as if the application was very demanding for the controller. This keeps us from forming bad habits. But I really doubt you will see any difference no matter how you code it for this application. I am sure others will disagree though.

RSL
 
If its the one I think it is, its a little more than a basic crane.

---------------------------------

Marc, hows it going?

Have you considered nesting your UDTs and passing only the data you need that way. Its no different as far as the CLX is concerned than nesting a Timer in a UDT.
 
I did not mean to belittle the size or complexity of the project. I am just saying that even an awfully elaborate crane should not be a problem.

The qty. of data we are talking about moving around is fairly small. I still think we are splitting hairs in this case. I think he can implement this anyway he wants. It would be difficult to measure a performance gain or loss with arrays of this size.

It all depends on how much code there really is. If you have a performance problem (scantime etc.) then I doubt the size of these arrays being passed several times will make much difference.

The only way I have ever seen a CLX with poor scantimes is when a LOT of For next loops are used to execute files repeatedly, or a LOT of code is executed every scan that does not need to be, or a LOT of communications load like HMI's, MSG's etc.

Yes, I realize poor scantime is all relative to the task at hand.

This is just an opinion. I did not mean to offend anyone if I did.

RSL
 
Last edited:
Alaric said:
If its the one I think it is, its a little more than a basic crane.

---------------------------------

Marc, hows it going?

Have you considered nesting your UDTs and passing only the data you need that way. Its no different as far as the CLX is concerned than nesting a Timer in a UDT.

Troy,

It's good. Busy, but good.

I've nested the UDTs, so as to use inheritance, but I wondered if it were better to pass an entire level of nested UDT or the individual parts to be worked on.

And the crane is over a half dozen cranes, with 2 in 1 bay (upper & lower) which must be interlocked so as to not try to occupy the space at the same time.

With the crane, the power of UDT that I'm looking for is the hoists, bridge, and trolleys all operate the same way, with a slightly different input. This makes changing one thing an entirely too long of process, and if I UDT it properly, it's relatively simple to slightly modify the process.
 
How about creating an array of the UDT?

i.e. cranes[6] of type crane_udt

Then you would only have to pass an index to your subroutine.

If you need to reference the individual cranes outside of the subroutine you can alias e.g. upper_crane_bay_1 alias to cranes[0].

Sheldn said:
Be aware of the asynchronous scan of the communications and other logic tasks that are running in your controller if you do decide to send the entire UDT to the subroutine.
Bear in mind that CLX moves data around in memory one byte at a time. The transfer of 2K bytes is likely to be interrupted mid-stream if you have periodic tasks. If other tasks operate on the UDT data then its integrity can be compromised for the subroutine.
 
I did not understand what was said about nesting the UDT's. I thought you had an array of UDT's. My mistake.

I agree with Gerry, creating an array is likely the best way.

You can pass the entire array element for Crane[0],[1] etc. as needed. I do not use element [0] most of the time. It makes the numbering a little more sensible when referring to real world devices.

I think Jerry is right about the periodic tasks interupting this data transfer too. If you have scan dependant logic you can get in trouble.

I still try and keep it simple when possible. I do not use periodic tasks unless it is absolutely needed. I keep everything in the continuous task then you don't have to worry about anything except buffering the I/O when needed.


RSL
 
I use Periodic Tasks for communications that aren't dependent on the functions that the crane motion depends on.

I did a test where I passed the entire UDT & just specific parts, and it made no difference on the scan time as far as I could tell.

Then again, 2K isn't a lot of information.
 

Similar Topics

Hi everyone: I have a doubt about postscan in RSLogix 5k, for example in help file for OTE instruction, says that in Postscan The rung...
Replies
2
Views
1,204
Hi Gents, I am here with an 1756-L73 with a partner 1756-L7SP. This is for an hydraulic press machine, with an very critical scan. I need your...
Replies
2
Views
2,984
My new friend Ron Beaufort got me thinking about the issues with using OTL's in regards to a power cycle. While you can use a first scan bit...
Replies
10
Views
4,731
Hi Guys, Quick Question... Is there a method or instruction to purposely delay the scan time of a ControlLogix processor? We're looking at...
Replies
12
Views
4,058
Let's say... A_DINT = 100 In some subroutine: rung 1 : A_DINT = A_DINT + 1 rung 2 : A_DINT = A_DINT + 2 rung 3 : A_DINT = A_DINT + 3 After a...
Replies
2
Views
1,427
Back
Top Bottom