SLC compute scan time

garym4569

Member
Join Date
Sep 2011
Location
TN
Posts
14
SLC 5/04
Does anyone know what the typical scan time is for the Compute instruction?
The manual states
"The execution time of a CPT instruction is longer
than a single arithmetic operation and uses more
instruction words."

I am doing simple math such as... (1|(T4:0.ACC|N7:0))*60

Thanks in advance
gm
 
Create a program that includes your CPT instruction. Also create a timer that keeps track of the time required for 1000 program scans. Compare the times for 1000 scans with the CPT statement enabled and with it disabled. Divide the difference by 1000.
 
Oh no - 11 posts compared to 5,083 posts (if that's any measure). Peter is one of the most advanced here mathematically - at least in my view.

I recommend that you apologize profusely then ask for help and suggestions on how to make your math better.
 
Wow Gary,

Peter: 5000+ posts
Gary: 11 posts

Peter has never been a member of the Dale Carnegie School of how to win friends and influence people but I think you are jumping way to conclusions with that one. He could probably write the OS in your PLC to be more efficient than AB did.

Perhaps you should pay attention and learn something before striking out at the regulars.
 
OK, let me minimize the pain - the first two optimizations

your statement - (1|(T4:0.ACC|N7:0))*60

Minimize constants - 60 * 1 = 60

60|(T4:0.ACC|N7:0)

multiplies are more efficient than divides

60|X|N7:0 = 60 * N7:0

(N7:0 * 60) | T4:0.ACC
 
Why is it that most programmers seem to be too lazy to convert even the simplest of formulas? In my schooldays it surely paid off to do so. Why don't you try if 60*N7:0|T4:0.ACC doesn't calculate faster without giving a different answer?

I can understand Peter's reaction.

Edit: Damn, Bernie beat me to it. But then I'm sure in Bernie's schooldays this brain warmup was normal day-to-day business, just as it was in my days (maybe around the same time?)
 
Last edited:
I thank my teacher, though not at the time, who insisted that the first week in high school Physics be spent on learning the slide rule. Though high school Physics was the highest math I had (1965), that was the best wek of education I had.
 
SLC 5/04
The manual states
"The execution time of a CPT instruction is longer
than a single arithmetic operation and uses more
instruction words."

All the manual is telling you (admittedly in a roundabout way), is that a CPT, although friendly, readable, concise, etc., is always going to be slower, and use more memory, than the same maths done using sequential "standard" maths instructions.

The first thing a CPT will have to do is parse the expression to determine the evaluation order (BODMAS), then it will do the individual maths in the expression in that order, storing temporary results on the way, (for which it will have to use internal scratchpad memory locations that it may have to create first, then destroy later), to arrive at the final result.

When you code the expression as a series of simpler maths instructions, you have done all of the hard work, and the processor can just wade through them.
 
I thank my teacher, though not at the time, who insisted that the first week in high school Physics be spent on learning the slide rule. Though high school Physics was the highest math I had (1965), that was the best wek of education I had.

High (very high) up on a wall at the college i went to in Rugby, England, were painted (obviously by a member of the mountaineering club), these immortal words....

Slide Rules OK

:ROFLMAO:
 
As a newbie ST compiler writer I can now say that the parse tree has been optimized thanks to Bernie. The execution time should be about half now because the number of divides have reduced in half and they are the operations that take the longest in that compute block.

Garym4569 is much further ahead now than he would have been if someone simply answered his question. Getting the best answer quickly should be the goal. A combination of Steve's and Bernie's answers are the best soltution.

I wasn't being arrogant. To be arrogant I would have to be taling about how good I am, but I didn't mention me. I even let other have a chance to shine. I could have easily optimized the compute instruction myself.

The bit about 11 posts compared to 5000+ makes no difference. If the numbers were reversed I would still make the same post if I now I am right.

I thank my teacher, though not at the time, who insisted that the first week in high school Physics be spent on learning the slide rule.
This is 8th grade algebra.

However, you can't believe how hard it is to have a compiler optimize the parse tree.
 
All the manual is telling you (admittedly in a roundabout way), is that a CPT, although friendly, readable, concise, etc., is always going to be slower, and use more memory, than the same maths done using sequential "standard" maths instructions.
I think they are simply interpreting the test each time the compute block is execute. You have raised a very good point. It would be better yet to implement the compute block in ladder.
 

Similar Topics

How can i get (N7:31 * 6 / 5) to work in compute instruction? This is very annoying. I know i am missing something?? Please help. Thanks, Ven
Replies
6
Views
2,240
I’m attempting to send a temperature from a SLC-5/02 to an EZiMarquee display. The vendor said to use a MSG instruction to send the data to the...
Replies
1
Views
83
Hello all. I have a few SLCs in my plant and of late we've seen a weird issue: The system will be running normally and then randomly the outputs...
Replies
2
Views
97
I am working on setting up a Prosoft Datalogger model PLX51-DLplus-232. This unit will be collecting data from a SLC 5/05 on the DB9 port set to...
Replies
3
Views
103
I have a redundant ControlLogix being set up. This program reads a value from a remote site which happens to be SLC PLC. Rockwell mentions SLC...
Replies
2
Views
96
Back
Top Bottom