Controlling a SFC child program

Controlling a child program can be simply achieved by specifying the name of the child program as an action block in a step of its parent program. Below are possible qualifiers that can be applied to an action block for handling a child program:

Child (N);

Starts the child program when the step is activated and stops (kills) it when the step is deactivated.

Child (S);

Starts the child program when the step is activated
(Initial steps of the child program are activated)

Child (R);

Stops (kills) the child program when the step is activated
(All active steps of the child program are deactivated)

Alternatively, you can use the following statements in an action block programmed in STClosed"Structured text" A high-level language that is block structured and syntactically resembles Pascal language. In the following table, "prog" represents the name of the child program:

GSTART (prog);

Starts the child program when the step is activated
(Initial steps of the child program are activated)

GKILL (prog);

Stops (kills) the child program when the step is activated
(All active steps of the child program are deactivated)

GFREEZE (prog);

Suspends the execution of a child program

GRST (prog);

Restarts a program suspended by a GFREEZEcommand.

You can also use the "GSTATUS" function in expressions. This function returns the current state of a child SFCClosed"Sequential function chart" It can be used to program processes that can be split into steps. The main components of SFC are: - Steps with associated actions - Transitions with associated logic conditions - Directed links between steps and transitions program:

GSTATUS (prog)

Returns the current state of a child SFC program:
0: program is inactive
1: program is active
2: program is suspended

  • When a child program is started by its parent program, it keeps the "inactive" status until it is executed (further in the cycle). If you start a child program in an SFC chart, GSTATUS will return 1 (active) on the next cycle.