We always have our eyes out for new error situations that DBDOC can detect and protect you from.
At a training session recently, we happened to notice a FC 111 rung block with mysterious output  (blue). This made no sense, because the logic is OUTPUT = (S13 OR S14 OR S15 OR S16) AND S17, but none of S13-16 are  (blue), so the output shouldn't be , but it is. We verified the specifications, which matched what the CLD showed.
There are actually two different reported errors on this particular block, as you can see from the presence of two error markers. There is also an unreported error, which we will describe for completeness.
Rung block spec is wired but unusedThe first (reported) error is reported as follows:
Rung block spec is wired but unused [ERROR 124]Rung block Module 9,25,05 Block 7660 S12 is wired (block 3006) but unused by S2 value 000[92505F2A.CAD]
S2 is the operation that acts on input S12, but S2 is 0, which means ignore the input, and instead use the value from the top of the stack. It may well be unintentional that S2's value be ignored.
Operation on an unwired inputThere is actually another error which is not reported, because it makes no difference to the output:
The specs S2-S11 are operations on inputs S12-S21. Some of these inputs (S16, S18-21) are unwired, and their corresponding operations are 0, as expected, except for S16. S16 is unwired, but S6 is 12, not 0. So to correct this error, S6 should be changed from 12 to 0. However, the outcome is the same whether or not this "error" is corrected, so DBDOC doesn't report it.
New in 10.7: Rung stack not initializedThere is also another problem, the second reported error, which is the one causing the unexpected  output:
This is a type of error newly detected in DBDOC 10.7. It is capable of causing a significant system error.
Rung stack not initialized [ERROR 306]Rung block Module 9,25,05 Block 7660 logic invalid because S3 is an OR operation[92505F2A.CAD]
How these rung blocks work is that each operation is carried out in order, and the result of each operation is placed on the stack. The next operation is typically an AND or OR with the current input and whatever is on the stack (i.e. the result of the previous operation).
- In this case, the first operation is S2 (0) performed on input S12. 0 means use the value from the stack, i.e. ignore the actual input value S12. As it happens, the uninitialized stack value is ! But in any case S2 accomplishes nothing.
- The next operation is S3 (12) performed on input S13. This means OR the input S13 with the value on top of the stack. Well, the value on top of the stack is , so the result of this operation is always , regardless of whatever S13 is. So this operation is also pointless.
- Similarly, S4 and S5 also OR their corresponding inputs with , yielding  on top of the stack.
- Finally, S7 is 11, which means AND the input ( in this case) with the top of the stack (current top of stack is guaranteed to be ), for an inevitable  final output, regardless of the values of S2-S5.
The basic problem here is that the stack was not initialized. The logic would make sense if S2 was 10 (PUT) instead of 0. S2=10 would mean put the value of S12 () onto the stack. Then the next operation, S3 (12), would OR  with the value of S13, yielding the value of S13, instead of a guaranteed .
(Technically, S3 could be 10 (PUT) instead (if S2 was actually meant to be ignored), hence the error message complaining that S3 is OR. And either S2 or S3 could also be an 11 (AND) with no change in result).
Enjoy these examples from real systems. DBDOC Version 10.7 and beyond will detect this uninitialized stack problem if you happen to have it lurking in your system.
Some details for those not familiar with DBDOC:
- Blue lines show a signal that carries the quality attribute.
- A white box shows value  whereas a blue box shows value .
- DBDOC presents the rung logic as a little ladder diagram.
- The little "top hat" symbol means a change from  to , triggering a  for one cycle.
- Specs can be moved in DBDOC to get them out of the way.
- The warning triangle shape is an Error Marker, informing you of a DBDOC message.
- The yellow box is a data tip telling you about the Error Marker.