Introduction

The Maintain output links on disabled EF (EN=0) project setting allows you define the behavior of link values, connected to output pins of EFs, in case an EF is called conditionally (EN input connected).

The default value of this project setting for new applications is deactivated (unchecked).

NOTE: After changing this setting you have to make a Rebuild All Project of the application.
NOTE: The behavior of the application will change after modifying this project setting that has an impact on the code execution.

Changing this Project Setting

You can change the Maintain output links on disabled EF (EN=0) project setting in Control Expert under Tools > Project Settings > Program > Languages > Common .

Behavior in Case of Deactivated Project Setting

In case of a falling edge of EN input, the values of output variables stay unchanged, whereas output links are reset to 0.

For the example shown in the graphic below:

  • EN -> 0

  • save_out_val = 1

  • link = 0 (red)

Behavior in Case of Activated Project Setting

In case of a falling edge of EN input, the values of output variables and output links stay unchanged.

For the example shown in the graphic below:

  • EN -> 0

  • save_out_val = 1

  • link = 1 (green)

Compatibility Unity Pro 4.0 and 4.1 or later

NOTE:

Unity Pro is the former name of Control Expert for version 13.1 or earlier.

The following table describes the compatibility of Unity Pro 4.0 (or earlier) and Unity Pro 4.1 or later regarding:

  • transferring from PLC to PC (upload)

  • opening XEF file on PC (import)

  • opening STA file on PC (archived project)

The compatibility depends on whether the project setting Maintain output links on disabled EF (EN=0) is activated or deactivated.

Prerequisite

Unity Pro ≤4.0

Unity Pro 4.1 or later

Generated with Unity Pro ≤4.0.

Project setting not available in Unity Pro 4.0.

possible

possible

Generated with Unity Pro 4.1 or later for an application 4.0.

Project setting deactivated.

possible (1)

possible

Generated with Unity Pro V4.1 or later for an application V4.0

Project setting activated.

not possible

possible

Generated with Unity Pro V4.1 or later for an application V4.1 or later, using M340 V2.1 PLC, …)

Project setting deactivated.

not possible

possible

Generated with Unity Pro V4.1 or later for an application V4.1 or later (using M340 V2.1 PLC, …)

Project setting activated.

not possible(2)

possible

(1) importing a 4.1 XEF file into Unity 4.0 may require the external tool XEFDowngrader

(2) PLC is not recognized

Project Settings after Upload, Open XEF, Open STA File

NOTE:

Unity Pro is the former name of Control Expert for version 13.1 or earlier.

The following table describes the status of the Maintain output links on disabled EF (EN=0) project setting after

  • transferring from PLC to PC (upload)

  • opening XEF (or ZEF) file on PC (import)

  • opening STA file on PC (archived project)

Prerequisite

Unity Pro ≤4.0

Unity Pro 4.1 or later

Generated with Unity Pro ≤4.0.

Project setting not available in Unity Pro 4.0.

not available

not activated

Generated with Unity Pro 4.1 or later for an application 4.0.

Project setting deactivated.

not available

not activated

Generated with Unity Pro V4.1 or later for an application V4.0

Project setting activated.

not available

activated

Generated with Unity Pro V4.1 or later for an application V4.1 or later, using M340 V2.1 PLC, …)

Project setting deactivated.

not available

not activated

Generated with Unity Pro V4.1 or later for an application V4.1 or later (using M340 V2.1 PLC, …)

Project setting activated.

not available

activated

In case of uploading, importing or opening a Unity Pro application with Unity Pro 4.1 or later, created with Unity Pro 4.0 or earlier, the Maintain output links on disabled EF (EN=0) project setting is deactivated.

After a Rebuild All Project and download the behavior is the same as the application had in the environment of the earlier version of Unity Pro.

If you want to use the Maintain output links on disabled EF (EN=0) project setting, you must:

  • open or upload an application,

  • activate the project setting,

  • Rebuild All Project .

Undoing EF Deletion

If the Maintain output links on disabled EF (EN=0) project setting is activated and an EF is called conditionally, static memory will be allocated for each output pin of the EF, to save the output values during runtime.

In case you delete this EF in the editor the static memory will be released.

If you perform an UNDO later on, the EF will be re-created and new static memory will be allocated.

After a following Build Changes , these mechanisms occur:

  • Maintain output links on disabled EF (EN=0) project setting deactivated:

    No static memory is assigned for the output pins as maintaining the last link values is not needed.

    • If EN is 0 the link is reset to 0.

    • If EN is 1 the link is written with the value of the OUT.

  • Maintain output links on disabled EF (EN=0) project setting activated:

    New static memory is allocated for the output pins because the old memory has been released. The link´s new static memory is initialized to 0.

    • If EN is 0 the link's value remains initialized to 0.

    • If EN is 1 the EF is executed and the value of the OUT is written to the link.

Example:

Project setting activated, EN not connected

Conditions before Build Changes :

  • EN = 0

  • save_out_val = 1

  • link = 1

Delete EF.

Perform UNDO and Build Changes .

Result:

  • save_out_val = 1

  • link = 0

With the next activation of the changed EF the link's new static memory will be written and works as expected on the next deactivation.

This behavior is in principle the same by using other EF types (ADD, XOR…).

EN Not Connected

If EN is not connected or not displayed (box Show EN/ENO not checked), no preparation is done to maintain the last link values.

If the EN input is connected later and then Build Changes is performed, the following mechanisms occur:

  • Maintain output links on disabled EF (EN=0) project setting deactivated:

    No static memory is assigned as maintaining the last link values is not needed.

    After falling edge of EN, link is reset to zero, variable save_out_val is unchanged.

  • Maintain output links on disabled EF (EN=0) project setting activated:

    New static memory is allocated in PLC to maintain the last link values for the output links. This static memory is initialized to 0.

    If EN is 1 after a Build Changes , the EF is executed and the output data is assigned to the connected link's static memory.

    The link's static memory will be consistent at the end of the first PLC working cycle after a Build Changes.

NOTE: If the EN is 0 after the Build Changes, the static memory, representing the link, keeps its initialization state (0), which may be different to the value before the download change.

Example:

Option activated, EN not connected

Conditions before Build Changes :

  • EN of first AND is not connected, i.e. EF AND is invoked

  • save_out_val = 1

  • link = 1

Connect enable to EN of first AND, set enable to 0, perform Build Changes.

Result:

  • save_out_val = 1

  • link = 0

With the next activation of the changed EF the link's new static memory will be written and works as expected on the next deactivation.

This behavior is in principle the same by using other EF types (ADD, XOR…).

Use Cases

The following use cases show that

  • replacing EFs by other EFs leads to initialization of output link values due to new memory allocation.

  • changing output links on not changed EFs leads to maintaining the link values due to using of already allocated memory that belongs to the EFs.

The following use cases apply to all EF types.

Replacing AND by AND_BOOL

Preconditions

  • Maintain output links on disabled EF (EN=0) project setting is activated

  • variable enable = 0.

  • output link = 1 (due to enable was 1 in the history)

Replace AND by AND_BOOL and perform Build Changes.

Result: output link = 0

Reason for output link is 0 after Build Changes:

  • The memory to hold the output values of the deleted EF (AND) has been released.

  • Assigning a new EF (AND_BOOL) causes allocation of new memory to hold its output link values.

  • The new memory is initialized to 0.

Replacing ADD by MUL

Preconditions

  • Maintain output links on disabled EF (EN=0) project setting is activated

  • variable enable = 0.

  • output link = 6 (due to enable was 1 in the history)

Replace ADD_INT by MUL_INT and perform Build Changes.

Result: output link = 0

Reason for output link is 0 after Build Changes:

  • The memory to hold the output values of the deleted EF (ADD_INT) has been released.

  • Assigning a new EF (MUL_INT) causes allocation of new memory to hold its output link values.

  • The new memory is initialized to 0.

Deleting Output Link and Performing UNDO

Preconditions

  • Maintain output links on disabled EF (EN=0) project setting is activated

  • variable enable = 0.

  • output link = 6 (due to enable was 1 in the history)

Delete output link.

Undo deletion and perform Build Changes .

Result: output link = 6

Reason for output link is 6 after Build Changes:

  • Deleting an output link and connecting a new output link to the same EF output pin does not cause the allocating of new memory to hold the values of the output link.

  • As this memory belongs to the EF, it will not be released until deletion of the EF.

  • In this use case the new link gets the memory of the deleted link (value = 6).