Siemens S7 execution speed...

Borte

Member
Join Date
Feb 2004
Location
Norway
Posts
238
Hello All!

I have a question regarding execution speed of commands on a Siemens 315 DP2 PLC (Step 7).

I need to know which one of these SFC's thats fastest:

SFC20 "BLKMOV" or SFC21 "FILL"

They are basically doing the same function execpt from that SFC21 can fill a larger memeory area with a small one and SFC20 will copy a memory block from one area to another area.

Can anyone help me with this?

Regards
Borte
 
There are some Siemens documents (I can't put my finger on them right now) that give you exact execution times for various instructions and SFCs, and they are quite accurate. But, what I usually do is determine the execution time myself with a real PLC using a loop. For instance:

Code:
     L     #OB1_PREV_CYCLE

      L     1000
Top:  T     #LoopCounter

      CALL  SFC   20
       SRCBLK :=#Source
       RET_VAL:=#Return
       DSTBLK :=#Dest

      L     #LoopCounter
      LOOP  Top

If you put that code in OB1 with nothing else running (you will have to format the any pointers to make it work), you will be able to get a very accurate measurement of the execution times. I'm pretty sure you will find that SFC20 is effiecient for large amounts of data, but there are better ways to do it for small amounts. In any event, you should be able to compare SFC20 and 21 quite easily.
 
I forgot to mention something. I used 1000 for the LoopCounter, but that will probably blow up a 315, so I would suggest that you instead use a variable and force it to different values until you get a sufficient scan time (i.e., if the loop is set at 100, and the scan time is 120ms, then you know that SFC20 took about 1.2ms to execute).
 
H

According to Siemens' data, SFC20 executes more quickly than SFC21. But what makes much more difference is the CPU they're executed in.

For any of the standard S7-31x CPUs the figures I've got are -

SFC20 : 75uS + 1.6uS per byte
SFC21 : 75uS + 2.2uS per byte

However, in an S7-317 this comes down to -

SFC20 : 16uS + 0.05uS per byte
SFC21 : 16uS + 0.08uS per byte

Can't you just hear those bits rattling around in the 317?!

Regards

Ken.
 
Thanks for the replys guys!

I didn't have a test plc available so i tried to simulate it on my computer (using s7 simulation) with the program that S7GUY wrote and it seems like SFC20 is slightly faster than SFC21.
Even though the difference between the two was very small (I'm running it on my computer), just 1 ms at a rate of 1000 repetitions.

So I'll try to use the SFC20 instead of 21 in my programs.

Btw: Will SFC20 be faster than writing multiple Load and Transfer commands?

Thanks again for the help!

Regards
Borte
 
Borte,

You can not trust PLC-SIM (the Siemens PLC simulation package) to replicate accurate timing issues. Remember, it is running under Windows, not the S7 operating system. Try monitoring a simple timer in PLC-SIM as it runs. Now do the same while rapidly moving the mouse about. Windows keeps having to service the mouse movement interrupts so it can dedicate less time to running PLC-SIM. If you get it right, you can find a perceptible slowing of the timer under these conditions. It's OK (no, it's great) for testing logic and calculations etc. Just don't try to prove the unproveable.

A LOAD instruction in standard S7-31x (not the C version) varies tremendously according to the quantity of data addressed (bit, byte, word, double-word), where it is located (input, peripheral input, m-bit, data block, timer, counter, literal numeric value etc), whether you use direct or indirect addressing etc. Similarly for the corresponding TRANSFER. As a basic guideline, the following -

L DBW2
T DBW4

would be quoted as 1.8uS and 1.6uS respectively. (This is using the same source that gave the 75uS+1.6uS/byte for the 31x. I haven't seen any equivalent data for the current 31xC's but they are believed to be faster overall.) If you then add in the possibility of the addresses being in two different data blocks you have -

OPN DB1 - 0.7uS
L DBW2 - 1.8uS
OPN DB2 - 0.7uS
T DBW4 - 1.6uS

On this basis, it doesn't take many L and T operations before SFC20 is quicker overall.

Regards

Ken
 

Similar Topics

Another daft question coming up... In the picture, suppose "Data_block_1.Calculate Diff" is TRUE. What's the order of execution of the...
Replies
3
Views
719
HI everyone, i am new to Siemens plc programming and i am in need of some help. yesterday we had an S7-1200 CPU 1214C fail to turn on an output to...
Replies
7
Views
161
Hi PLC people, think about this scenario: The PLC is somehow connected to the same network with the facilities` network. Then someone connects to...
Replies
2
Views
84
Hello everyone, I've had this issue for the last 2 days where I try to assign the profisafe address to an IO block (6ES7 146-6FF00-0AB0) but when...
Replies
5
Views
152
Hello, good morning, I have been having two problems with the Tia Portal software. The first is that I have installed it on my computer and...
Replies
5
Views
184
Back
Top Bottom