When to use a formal call? When to use a non-formal call?

To brush up your knowledge:

  • Example for a formal call: Inst2 (EN := TRUE,IN1:=10,IN2 := 20,T1 := T#3ms, OUT => result);

  • Example for a non-formal call: Inst2 (10,20,T#3ms)

See "Call of function block instance in ST", "Call of function in ST" and/or "Call of method in ST", if you need more details on formal and non-formal call.

Now to the answer when to use formal call vs. non-formal call: Certainly you will be faster to enter a non-formal call than a formal call. However, the usage rather depends on the decision which parameters you want/must enter within the call.
The following table should make this decision easier as it lists which call is suited for which purpose (= icon (tick)) and which call is not suited (= icon (error)). The table also lists conditions that require just one of the calls (= icon (tick)).

Purpose

Formal call

Non-formal call

The call should not list all →input variables or →output variables.
That means, variables should be omitted within the call.

(tick)

(error)

The call should list all input variables.
(The execution control parameters EN and ENO are excepted.)

(tick)

(tick)

The call should list EN/ENO.

(tick)

(error)

The call should list assignments of output variables.

(tick)

(error)

The call should list variables in any order.

(tick)

(error)

A function block instance should be assigned as parameter to the called function block instance or function and it should be called there.
(This scenario demands →in-out variables in the called function block type or function.)

(tick)

(error)

Condition

Formal call

Non-formal call

In-out variables are declared in the called function block or function.

(tick)

(error)