Using the TwinCAT 3 Usermode Runtime
TwinCAT 3.1 Build 4026 provides a Usermode Runtime. To be able to use TwinCAT Vision with the TC170x | TwinCAT 3 Usermode Runtime, the configurations described below must be observed. The basic description of the installation, functionality and limitations of the TwinCAT 3 Usermode Runtime can be found in the associated documentation.
Starting the Vision service
TwinCAT 3 Vision uses the Vision service for all interactions with the hard disk. If, for example, the loading or saving of images is required, which also applies to the use of the FileSource, the Vision service must be started by the TwinCAT 3 Usermode Runtime.
To do this, the file StartManConfig.xml with the following content must be created in the 3.1\Target directory of the Usermode Runtime or extended if available, default path: "C:\ProgramData\Beckhoff\TwinCAT\3.1\Runtimes\UmRT_Default\3.1\Target".
<StartMan>
<TwinCATServers>
<TwinCATServer Enabled="1">
<Name>TcVnService</Name>
<Path>C:\Program Files (x86)\Beckhoff\TwinCAT\3.1\Components\Vision\TcVision\TcVnService.exe</Path>
</TwinCATServer>
</TwinCATServers>
</StartMan>
Using a camera
To integrate a camera via the RT Ethernet adapter, the Usermode Runtime must be started with administrator rights:
- 1. For example, start the Windows PowerShell as administrator
- 2. Change to the Usermode Runtime folder, default path "C:\ProgramData\Beckhoff\TwinCAT\3.1\Runtimes\UmRT_Default" and execute the "Start.bat":
cd C:\ProgramData\Beckhoff\TwinCAT\3.1\Runtimes\UmRT_Default
.\Start.bat
- The camera can then be integrated via the RT Ethernet adapter.
As the TwinCAT 3 Usermode Runtime is not guaranteed to have deterministic runtime behavior, problems may occur with the camera connection depending on the hardware used. Please refer to the diagnostic options at Camera communication.
If problems occur, the following parameters of the TcCOM parameters module may need to be increased:
TransmissionTimeout
HeartbeatRate
DiscoveryTimeout
Please note that if the timeouts in the GVCP module are increased, the ADS communication timeout in Actions & settings may also need to be increased. This timeout should be greater than the product of MaxTimeouts and TransmissionTimeout.
Increasing the router memory
The router memory of the TwinCAT Usermode Runtime can be set in the TwinCAT system configuration. However, the adjustable size is limited by the configured heap memory of the Usermode Runtime. Therefore, the heap memory must be selected larger than the router memory to be set. The heap memory can be adjusted in the TcRegistry.xml in the \3.1 directory of the Usermode Runtime, default path: "C:\ProgramData\Beckhoff\TwinCAT\3.1\Runtimes\UmRT_Default\3.1\TcRegistry.xml"
To do this, the XML file must be adapted as follows:
- 1. Stop the Usermode Runtime.
- 2. Open the TcRegistry.xml.
- 3. Adjust the
<Value Name="HeapMemSizeMB" Type="DW">{size in MB}</Value>
entry in the XML file. - 4. The size is set in megabytes. In this sample, these are 1024 MB.
---snipped---
<Key Name="System">
<Value Name="RunAsDevice" Type="DW">1</Value>
<Value Name="AmsNetId" Type="BIN">C0A804010101</Value>
<Value Name="HeapMemSizeMB" Type="DW">1024</Value>
---snipped---