S7 - strange coding practice

RMA

Member
Join Date
Sep 2004
Location
North of Hamburg, Germany
Posts
2,052
I'm working in a steel rolling mill at the moment and while digging my way through some existing programs in a 416 cpu I've come across a load of code like the following example.

Strange_code.JPG


I understand the functionality fine, what I don't understand is the need for the final OR gate (the dummy assignment seems to be just there for the benefit of the compiler, since it's not used anywhere. The use of the connector makes me wonder if this was perhaps S5 code which has been simply converted to S7, without being tidied up.

Just for info, the circuit is transferring control from one light fence to another, should the first one be active because there happens to be a billet sitting in front of it at this point in time.
 
Roy,

As you state that the #dummy bit isn't being used as a logic carry, perhaps the original programmer just wanted to display the all the related code on a single network?

Kevin
 
I tend to agree with Kevin.
The only 'bits' written to in that segment are the Timer and the Marker M164.4.

T250 is 'fed into the two AND functions in the M164.4 logic.

They are tied together in one segment by the OR and 'dummy' bit and is probably tied together just to show the interaction of T250 inputs and the AND gates, as Kevin says.

I've done this before, but mainly in STL, using for example..

A I1.1
A I2.3
A F100.0
A Q4.7
=F200.0 (Spare (Dummy))

Just to watch all states in one segment.
Or use a saved 'status variable' table!

On the other hand, he could have been trying to view a 'timing' issue, to see what came 'true' first for example? But I suspect that on-line ladder mode would not be fast enough to see the timing difference if they were happening close together in time.

Better off with a Variable Table or even a temporary bit of code to 'capture' the timing difference or order.

Rich.
 
I don't really think that's the case in this particular example, the signals involved are relatively slow - several seconds or longer. However, this sort of layout is used in loads of other places, so I'll have to have a look at them to see if that could be a plausible explanation.
 
I've seen a lot of German code that does this, but most of the time its some option the machine might have, but didnt, and instead of deleting the code, they just tie the option ouputs to dummy bits instead of addressing non-existant I/O.
 
Kael said:
I've seen a lot of German code that does this, but most of the time its some option the machine might have, but didnt, and instead of deleting the code, they just tie the option ouputs to dummy bits instead of addressing non-existant I/O.

Thinking about what Kael said, look to see if T250 and/or M164.4 are actually used elswhere in the project? If so, are these uses related to any known operations (as opposed to unused options)?

Rich
 
The timer is used in the lower part of the same network and M164.4 is used a few networks later.

@Kael, I'll have to look at that a bit more closely, but I don't think it's the case here - this is the control of the rollers which transport the billets to the ovens at the start of the strip-mill, there's not a lot of options that you can imagine there!
 
RMA said:
The timer is used in the lower part of the same network and M164.4 is used a few networks later.

In that case I can only guess that the original programmer wanted to see both the Timer being controlled, and the the resulting logic where the timer bits are used (M158.1 & T250 -> M164.4 etc) all at the same time, in one network?

(based on your previous answer that T250 is not used elsewhere, but M164.4 is)

Any other ideas anyone?

Rich
 
After looking at some of the other FBs and FCs, I think I've sussed it out. As you've seen in the screen dump, they haven't used symbolic addressing in these programs (or where there are symbols, they just repeat the H/W addressing) instead the name or description is in the comment. By splitting the NW this way they keep it on the left hand side of the screen leaving the right hand side free to display the comments. In some of the bigger NWs it also helps prevent the NW disappearing off the rhs of the screen forcing you to scroll back and forth to see what's going on.

They are also using it in some places to keep functions together in one NW where normally in FB they'd have to be in successive NWs.

However, I have found one other peculiarity, it's not actually done in this particular block, but in most of the other ones I looked at, right down at the end of the block I found this:

Dummy.JPG


Anybody got any idea what that's supposed to achieve? (Once again the #Dummy is purely being used to keep the compiler happy on the output of a load of ORs.)
 

Similar Topics

Hello all, I am facing an issue with my Commander SK that I cannot solve on my own, I am struggling on it since several days :confused: The...
Replies
9
Views
1,040
Hi. I'm doing an upgrade of an old 1400e to a new panel view plus 7 standard using ftv studio v 12,which will be communicating to a slc 5/04 via...
Replies
15
Views
2,623
Can someone explain the jumper between the elements? Does it do anything? See attached jpeg.
Replies
4
Views
686
We have an OPC server getting data from a Compactlogix PLC. The PLC also communicates with a Panelview and a couple VFDs via Ethernet/IP...
Replies
3
Views
1,163
I have a small system controlled by a Siemens S7-1200 PLC. I created a totalizer function block (TIA v17), where I'm counting total revolutions...
Replies
16
Views
3,137
Back
Top Bottom