Skip to main content

Kollmorgen Support Network

KAS Standard SFC Template - State Machine | 30 Nov 2018 | |

KAS Standard SFC Template - State Machine

Introduction

Taking a look at PLC projects, we see that every machine deals with the same functionalities. Generally, machines powered by servo drives, need to follow a sequence of steps during its development:

                I. Start a Network Protocol (if available);

                II. Power on all drives;

                III. Elect a reference method to home each axis;

                IV. Develop a Manual Mode, allowing an operator to Jog an axis and change setup positions;

                V. Finally development of an Automatic Mode, which runs desired machine functionalities;

All the steps described above are the core project parts and contained within the Main program, they establish a pathway for the machine code to be developed. In addition to these steps, the program requires some Auxiliary Programs to deal with Status, Faults, IOs, Recipe and/or any special routine.

This Standard SFC Template proposes a division of known functionalities into modules, organizing them using the high expressive power provided by KAS using SFC language. The objective is to provide a structure capable to control machines of different types and complexity levels, using the same SFC Structure and Auxiliary Programs.

How does Standard SFC Template works?

Standard SFC Template divide KAS Project into "Functionalities Groups", routines related to machine process are located inside of the Main Program and Auxiliary Programs are developed using Standalone Programs.

The biggest advantage of using SFC structure is to translate the machine process in a state diagram. SFC is a good choice because:

1.    Each state of the process can be clearly mapped to a SFC step;
2.    The transition between steps is made using conditions, these are easily identified in the code;
3.    The relation between steps and activity flow from one state to another is visualized/programmed in a graphical manner, is easy to comprehend due conditions and interlocking which relate the evolution of step active states;
4.    SFC structure is a mirror of the controlled process and allows broke software into small parts. With this feature is easy to control what is being executed on each scan cycle of the controller; 
5.    Machines m
ostly have similar state diagrams (Homing, Manual Mode, Automatic Mode…), this characteristic allows scalability of Standard SFC Template into more complex machines;
 
imageThe Main Program is responsible to translate the machine state diagram into PLC software. It responsible to initialize the network, sets up addresses, provides power and reference (homing) to each axis, and runs all functionalities inside the Manual and Automatic Modes. 

Auxiliary Programs provide information to the Main Program. They've established run cycles, without any interlocking conditions. They keep runing all the time. The Template uses these programs to read machine status, deal with fault and reset routines, and manage IOs and recipes.

Template’s Subprograms are sections of code developed to perform a specific function. They’re used inside of Main programs and Auxilary Programs and are called as instances declared on project’s dictionary. 

Besides all PLC Programs structure described above, this project has a section to setup Motion and PLCOpen Axis and to manage EtherCAT Network devices. There are  two different user interfaces, the first using Control Panels inside KAS and the second with a HMI project, developed using KVB (Kollmorgen Visualization Builder).

 

 

 

Variable Naming

Each Program has a group of dedicated variables, related to its functionality. These variables are divided into two groups: 

image

Local Variablesimage
They can be accessed only inside their specific program. In Figure, the number 2 shows Local Variables that belongs to the Main Program. 

Global Variables and Structures
These variables are special, so can be accessed on the entire project. During Template development we establish that each program has a Structure of Variable with his name: "str + Program Name". Adopting this definition is easy to identify from which program the Global Variable came from.
In Figure, the number 3 shows the Structure of Variables that belongs to Main Program and number 1 shows it being declared as a Global Variable.

TIP: During development is recommended to create all program variables as Local and change it to Global only if necessary.

 

 

 

 

How scale this Standard SFC Template to a Machine with more axis?

The template is designed to allow scalability for more complex projects. Making use of the structure, the programmer has a platform to build on that contains all the fundamental parts of a complete machine code.

The division of the machine into functionalities and the organization of development in a state machine, allows the whole project to be structured before the development of logic. The SFC Structure helps the programmer to identify all the needed steps to start and finish the project. It builds all project parts using a graphical and intuitive environment.

Project Breakdown

image