Blog

Siemens S7 Graph Tips and Tricks

Siemens S7 Graph Tips and Tricks

SIMATIC S7 Graph is used for programming sequence logic in a graphical, flow chart representation. For those of us who have been programming sequences in ladder logic or SCL, Graph presents an alternative method that includes some built-in functionality. For those that haven’t used Graph (and maybe those who have!), I’ve put together some tips and tricks to help you develop quickly and efficiently.

Pre/Post Instructions

Pre and post-instructions run cyclically, before and after the main sequence. As the name suggests, pre-instructions run before the sequencer and post-instruction run after the sequencer. I often use these for variables that need to be continuously monitored, regardless of the step that I am in.

Pre and post-instructions can be programmed in ladder, which allows some flexibility if you are trying to program something like integer comparisons.

Integer comparisons can get a little messy in the Graph environment. I recommend setting up a comparator in ladder and utilizing the output from a pre/post instruction.
 Siemens S7 Pre-Instructions
Figure 1: Pre-Instructions

Desync Button

If you’ve spent a bit of time in Graph, you may have noticed that the whole environment shifts when you click on a Graph block. But what if you want to see your pre-instructions on the left, and the graph block on the right?

The desync button located to the right of the zoom in/out buttons allows for the desynchronization of the left and right windows to allow you to view different information in the left and right windows.   

Siemens S7 Desynchronization

Figure 2: Desynchronization

Changing Between Interface Types

Another trick for Graph is changing between interface types.  This can be accomplished by having the sequencer open, clicking “Edit” in the top toolbar, and then “Interface Parameters”.

It is important to note that changing the interface parameters will reset the “accessible from HMI” checkbox. To make the variables accessible again, go to Edit > Internal parameters visible/accessible from HMI.

Changing Steps

Externally changing steps in Graph can be a bit tricky if you haven’t done it before. To change steps, you’ll want to follow this procedure:

  1. Select the step to which you want to change (S_SEL)
     
  2. Change the sequencer to manual mode (SW_MAN = TRUE, SW_AUTO = FALSE)
     
  3. Display all steps (DISP_SALL = TRUE)
    • This will allow you to jump to any step (as opposed to just the current one).
       
  4. Clear active step (DISP_SACT = FALSE)
    • This allows the sequencer to output the current step. This needs to be false so you can jump to any step.
       
  5. Write the requested step to step number (S_SELOK = TRUE)
     
  6. Activate the step (S_ON)
     
  7. Display the current step (DISP_SALL = FALSE, DISP_ACT = TRUE)
     
  8. Change the sequencer to auto mode (SW_AUTO = TRUE, SW_MAN = FALSE)

Since pseudocode only gets you so far, see this example to view the finished “change step” block.

(In this example, I have added a requirement that you can only jump steps if you are paused first. Make sure to trigger the pause before you attempt to switch steps!)

Learn more about DMC's Siemens expertise.

Comments

There are currently no comments, be the first to post one.

Post a comment

Name (required)

Email (required)

CAPTCHA image
Enter the code shown above:

Related Blog Posts