Sign in to follow this  
Followers 0
slcman

Scan time and programming language

5 posts in this topic

Hi all, I want to do a large amount of math operation with a compactlogix processor. I wrote to Rockwell support and they told me the ladder is the faster programming language, second is statement list & sequential and the slowest is function block. I'm surprise...I was thinking statement list will be faster than ladder! Anyone have some experience with different programming language? Ladder is really the faster ?

Share this post


Link to post
Share on other sites
I haven't done a bench test to really know. However, ST should be the fastest language IF the code gets compiled down to machine code but if ST gets compiled down to ladder then ladder should be faster. Ladder spends too much time loading parameters and storing the results for each block to be efficient.

Share this post


Link to post
Share on other sites
I've had a reasonable look into it.. the answer isn't as simple as language alone. It also has a fair bit to do with what you're programming. LAD might be faster in some respects but mostly people don't use conditional execution with it (jumps, ends etc). When your program has a significant amount of conditional execution (state machines, different code executing depending on what's happening) then ST starts to look really good because things like the CASE construct limit unnecessarily executing logic. I wrote a few test programs where ST ended up faster than LAD to do the same thing. SFC is slower and more memory hungry comparatively but it does give you a lot for free as it removes a lot of the effort required to build/modify state machines. It depends how much performance you need.. I've seen it quite happily run high speed motion applications. For heavy maths, I would suggest ST for your own sanity.. it's much nicer to write maths in especially if you're working with cases, loops and arrays. Edited by MikeSmith

Share this post


Link to post
Share on other sites
ST is "structured text". Roughly speaking in terms of PC languages, it's most similar to Pascal/Modula/VHDL/Ada. There is another language called something similar to "statement list" that resembles machine code that is popular in Europe. I believe it is stack-based, and it looks very similar to most assembly codes. It is the 5th out of the 5 IEC languages. Rockwell does not support it, since structured text is pretty close to a superset.

Share this post


Link to post
Share on other sites
Well structured ST should be the fastest. It is however the least visual - which might be an issue for Bubba. I ran a test some time ago for linearizing a non-standard thermocouple using six different fifth order polynomials. ST kicked Ladder's butt. The disadvantage ladder has for large computations is the necessity of storing every intermediate result in memory and then fetching that result again just to continue the computation. ST allows you to craft equations that don't need intermediate storage. Granted, ladder has the CPT instruction. Another advantage is branching control and comparisons. IF (A>B) THEN do_this ELSE do_that END_IF requires only one comparison. In ladder two comparison would be required. GRT A B and LEQ A B.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0