ToolBlockReferenceTool

With the ToolBlockReferenceTool it is possible to reuse the same program flow in different places. For this purpose, a Vpp file is created within the project folder (example for project P0XXXX: C:\GEFASOFT\Viper.NET_P0XXXX\Data\ReferenceToolBlocks), which contains the sequence as CogToolBlock. Using the ToolBlockReferenceTool, this Vpp can be loaded in any BV job and used as often as desired. If changes are made within a Vpp, the user can decide via a query using a MessageBox whether all ToolBlockReferenceTools that use the same Vpp should be reloaded.

../../../_images/ReferenceToolBlock.png
  1. CogToolBlock Editor: Window in which the program flow is implemented and in which images are visualized.

  2. Toolblock status: Display which vpp was successfully loaded, and whether it is already in use elsewhere:

    • red: no file loaded / file not available

    • green: File loaded successfully and used only at this point

    • yellow: File loaded successfully and used multiple times

  3. Synchronize in/out params: This button can be used to display newly created inputs and outputs to the tool as terminals.

  4. Save Reference ToolBlock: Used to save the vpp. Changes are applied to all created references.

  5. Reload: If a vpp was changed elsewhere, the tool can be updated here

  6. Reference mode: See ReferenceMode

Within the CogToolBlock Editor, the program flow to be referenced by the ReferenceTool is implemented. Input and output terminals can be added, which are automatically updated in the corresponding tool blocks. Synchronization can also be forced with Synchronize in/out params. Other ToolblocksReferenceTools that reference the same Vpp will not be updated until the Vpp is saved. If inputs or outputs are deleted in a ReferenceToolblock, but they were linked as terminals, this is indicated in the terminal name (adding MISSING_INNER_TERMINAL before the terminal name).

Hint

The ToolBlock InputBlock cannot be used in a ReferenceToolBlock.

Load a Vpp file

../../../_images/ReferenceToolBlock-vpps.png
  1. Directory: Selection of the path in which the desired Vpp is located.

  2. Apply: Apply a change to the path

  3. Update Icon: Updating the Explorer structure (necessary if a Vpp was manually added or deleted in Windows Explorer).

  4. Current Path: Display of the current path

  5. Vpp Overview: Display of all Vpp’s that are in the current path. With the check mark a desired Vpp can be selected for referencing.

  6. Plus icon (left): A folder is added at the selected position (See graphic below)

  7. Minus icon (left): The selected folder will be deleted.

  8. Plus icon (right): Adding a new Vpp (See graphic below)

  9. Minus symbol (right): Delete the selected Vpp

Adding a Vpp

../../../_images/ReferenceToolBlock-addVpp.png
  1. Name: The new name of the Vpp must be selected here.

  2. Directory: Display of the current path in which the Vpp is stored.

  3. Copy From: Here you can select whether an existing Vpp is to be copied.

ReferenceMode

Starting with Viper.NET 6.5.3 the referenced CogToolBlock can be loaded either Exclusive (as before) or as a so called SharedInstance.

Exclusive

Each ToolBlockReferenceTool reloads the CogToolBlock from the VPP file. The individual tools are therefore independent of each other and can also be executed in parallel.

SharedInstance

All ToolBlockReferenceTools in SharedInstance mode share the same instance (per VPP).

The SharedInstance mode was introduced to reduce loading times for Jobs with many similar ToolGroupItems in certain constellations.

Warning

The SharedInstance mode has some dangers and pitfalls. Please use only after reading the following paragraph in detail!

For ToolBlockReferenceTools in SharedInstance mode that reference the same VPP file, the following rules apply:

  • A SharedInstance must not be used in multiple jobs.

  • A SharedInstance must not be used more than once in a ToolGroupItem.

  • The only permissible use is to use exactly one SharedInstance at a time in multiple ToolGroupItems of the same Jobs.

  • Misconfiguration is therefore detected and prevented as far as possible during execution, i.e. a RunError is generated if one of the previous error cases is detected.

  • The results of the referenced CogToolBlock, do not match the last execution of the ToolGroupItems if the CogToolBlock has been used elsewhere in the meantime.

  • To save further time, CogToolBlock instances loaded in SharedInstance mode are not unloaded during type-switching, but reused if possible. This in turn means that temporary changes to a SharedInstance are not undone by reloading the same types. In this case, the SharedInstance must be explicitly reloaded using the Reload button in the tool editor.

Warning

The checks can be deactivated via Shared interference handling. It must then be ensured on a higher level, e.g. in the PLC, that parallel execution is not possible.

Use at your own risk!