GDataExchange¶
Starting with Viper.NET 6.5.1, data can be stored and retrieved across stations and equipments. Thus, for example, results generated in the first processing station can be used in the last image processing application without the data being passed through by the PLC. GDataExchange uses the command interface for this purpose, which means that data can be exchanged between applications and equipments via network.
To use GDataExchange, any Viper.NET application must serve as the central data store. Both a dedicated line computer and an existing vision application can be used.
Operating principle¶
In GDataExchange, several independent memories can be created. A memory stands for a certain category, e.g. part or equipment data.
Within a memory, in turn, any number of buffers are stored. The data is then stored in the buffer as key/value pairs. GDataExchange only supports strings, i.e. numbers etc. must be converted beforehand.
Each memory and each buffer within a memory is identified by a unique name.
Store and retrieve data¶
Currently, the data can only be stored, deleted and retrieved via the command interface and the CommandInterfaceTool. The client thus requires a Cognex VisionPro license. The server, i.e. the Viper.NET application that provides GDataExchange, does not need it.
GDataExchange provides the following command functions:
SetData: Store individual data value and optionally save.
SetDatas: Store multiple data values and optionally save them.
GetData: Get single data value.
GetDatas: Get multiple data values.
GetAllData: Get all data values of a buffer.
CreateBuffer: Create buffer explicitly. Is done implicitly with SetData/SetDatas.
DeleteBuffer: Delete buffer.
IsBufferExisting: Query whether a buffer exists.
ChangeBufferName: Rename buffer, e.g. if the serial number of a component changes.
Add/RemoveChildBuffer: Create/delete parent/child relation between buffers.
GetChildBufferNames: Get all allocated child buffers.
SetEnabled: Enable/disable GDataExchange.
SaveData: Explicit saving of a buffer.
Data storage¶
The data is held in memory and optionally stored in the file system. For each memory, can be used to define how many buffers are kept in memory. Buffers are automatically saved when they are unloaded from memory, as well as when Viper.NET exits.
A folder is created in the file system for each memory. One .buf
file in ini format is then stored per buffer.
Warning
The buffers are not cleared automatically, but only explicitly via DeleteBuffer. Alternatively WatchDir can be used for monitoring.
Example of a .buf
file: … code block:: ini
[main]
fullName = Test.Part013
nameHistory =
parentBufferName =
childBufferNames = Part013.Station01
[data]
SerialNo = ABC
Hint
Buffers that are no longer in memory are searched for and loaded in the file system, for example, with GetData.
Integrate GDataExchange¶
GDataExchange can be activated and included in several ways.
Embedding as UserTab or LayoutChild¶
Alternatively, similar to the SPS type data, a UserTab can be created in which the GUI for GDataExchange is embedded. This requires changes to the configuration file userTabs.xml
and as well as a matching extAppLayoutChild.xml
:
<!-- userTabs.xml -->
<tab name="DataExchange" type="ControlLayoutExtApps">
<param name="operation" value=""/>
<param name="sortId" value="15" />
<param name="width" value="1" />
<param name="height" value="1" />
<param name="extAppLayoutChildXml" value="Configuration\\gDataExchangeTab.xml" />
</tab>
<!-- gDataExchangeTab.xml -->
<?xml version="1.0" encoding="utf-8" ?>
<extAppLayoutChilds rolesOrder="Admin,Service,Operator,Technican">
<child type="CtlGDataExchangeMemories" >
<childLayout placeHolderId="-1" ptX="0" ptY="0" width="1" height="1" visible="True" user="" role="service|admin|operator|technican"/>
<caption visible="True" height="24" text="DataExchange" backColor="" foreColor="" border="True" />
<param name="backColor" value="LightSteelBlue"/>
<param name="borderStyle" value="FixedSingle"/>
</child>
</extAppLayoutChilds>
Configuration¶
GDataExchange is configured via the GUI:
Enabled: Enable/disable command interface for GDataExchange.
Root directory: Base path for storing the memories or buffers. Relative to the directory Data in the Viper project.
Default MaxBufferCount in RAM Per Memory: Default value for MaxBufCountInRAM for new memories.
Memories can be created in the grid and the MaxBufCountInRAM can be defined (maximum number of buffers in memory).
GUI¶
In the GDataExchange GUI, both the buffers in memory and those in the file system can be displayed.
Memory selection
Selection of the buffer to be displayed. With the button
...
a buffer can be loaded from the file system.Optionally, the data of the child buffers are also displayed.
Updating the data display
Data display of the buffer