OT - Multiplication and PLCs

RMA

Member
Join Date
Sep 2004
Location
North of Hamburg, Germany
Posts
2,052
In my last year at Glasgow Uni in 1966 I indulged myself by taking the newly introduced course in "Computing". This allowed us a few seconds access to the newly installed English Electric KDF9 each week, in its day, also quite a big step forward in computer design (Apart from speed, one of it's main advantages over the EE DEUCE, which it replaced, was that being transistorised it didn't need to be shut down for an hour every night to change a bunch of thermionic valves (tubes, for our friends across the pond) according to a pre-defined maintenance rota!).

In those days, were I to have been daft enough to do a multiply by 2 (or 4, 8, etc.) instead of using Left Shift, I'd have been hung, drawn and quartered by the Prof.

Things seem to have changed! According to the OPs List for my S7 317-2 DP CPU, the operation times for the respective commands are as follows:

Code:
SLW 0,19 µs
SLD 0,26 µs
*I  0,22 µs
*D  0,17 µs

Thinking about it for a couple of seconds, it's not so surprising that the DWORD multiplication is faster than WORD, but who would have guessed that a DWORD multiplication would be 30% faster than Shift Left!

Does this apply to other PLCs as well?
 
Last edited:
It's got to be a typo somewhere, surely ? my (relatively old) booklets for the 416 gives:

SLW = 0.08 microseconds
*I = 0.64 microseconds

and for a 315-2

SLW = 0.7 microseconds
*I = 2.4 microseconds

ok things may now have speeded up, but surely the relative times would stay about the same ?
 
My list is from 12/2003 (also not absolutely brand new) and it lists the 315 (actually 31x apart from 312 and 317)as follows:

Code:
SLW 1.0/0.3 µs (depending on whether number of places is in AKKU1 or as parameter)
SLD 1.2/1.3 µs
*I 1.1 µs
*D 3.5 µs

That seems to hole my theory - that *D is faster than *I because the operation is always done as a DWORD and then for INT there's an extra step to clear the MSWord - below the waterline! The timing differences between SLW and SLD also seem a bit odd, to say the least.

Anybody got any more concrete, or up to date, information?
 
From the latest list of instructions on Siemens support site:
SLW 1.0/0.3 µs (31x) 0.19/0.19 µs (317)
SLD 1.1/1.3 µs (31x) 0.22/0.26 µs (317)
*I 1.1 µs (31x) 0.22 µs (317)
*D 3.5 µs (31x) 0.17 µs (317)

So there doesnt seem to be any rule or consistency as to when the times go up or down (a double multiply is slower on a 315 than a single multiply, on the 317 it is the opposite).
 
I've found the catalogue for 05/2005 on the Siemens web site and the figures are unchanged - which could, of course, just mean that nobody's pointed out the error. However, when you look at the figures more closely (and the 312 figures are almost exactly twice the 31x times), it looks as though the 317 must have a completely different CPU structure. This is even more evident in the Shift instructions:

Code:
Operand 312	31x,147,151 317
SSI -	1.8 µs	 0.9 µs 0.22 µs
 " 0...15 0.6 µs	 0.3 µs 0.33 µs
 
SSD -	2.5 µs	 1.2 µs 0.24 µs
 " 0...32(?)2.5 µs 1.3 µs 0.28 µs
 
SLW -	1.9 µs	 1.0 µs 0.19 µs
 " 0...15 0.6 µs	 0.3 µs 0.19 µs
 
SLD -	2.5 µs	 1.2 µs 0.22 µs
 " 0...32 2.5 µs	 1.3 µs 0.26 µs
 
SRW -	1.9 µs	 0.9 µs 0.23 µs
 " 0...15 0.6 µs	 0.3 µs 0.33 µs
 
SRD -	2.5 µs	 1.2 µs 0.24 µs
 " 0...32 2.5 µs	 1.3 µs 0.28 µs
 
however, when we look at the Rotate operations, which one 
might expect to be similar, we get:
 
RLD -	2.2 µs	 1.1 µs 0.18 µs
 " 0...32 3.2 µs	 1.6 µs 0.24 µs
 
RRD -	2.2 µs	 1.1 µs 0.23 µs
 " 0...32 2.4 µs	 1.2 µs 0.28 µs

All very peculiar somehow!
 
Last edited:

Similar Topics

I've got a Q68DAIN (Mitsubishi Q series analogue output module). On the HMI, Basically on the screen, the user types in a value as a percentage...
Replies
11
Views
2,221
Hi, I am trying to do this calculation in structured text with studio 5000: (2147483647/ (117 / 241.23 *20)) all the numbers are stored in...
Replies
31
Views
7,545
I'm at a new job as the sole control engineer and trying to piece together where my predecessor left off. One machine I'm trying to get online...
Replies
2
Views
99
Or there is an alternative to this? I suppose there are many but I've only seen put/get Can you for example set up a new plc and connect it to an...
Replies
5
Views
305
Back
Top Bottom