sudo setcap cap_net_raw,cap_net_admin=eip /usr/lib/jvm/jdk-19/bin/java
Profinet (In Development)
The PROFINET driver implements a class 3 real time controller. Which is able to communicate with multiple devices on the same network segment.
Connection String Options
On linux as the Java executable won’t have permission to capture raw packets, this needs to be enabled via:-
The executable will change based on the jdk and OS you are using.
Name | Value | Description |
---|---|---|
Code |
|
|
Name |
Profinet |
|
Maven Dependency |
<dependency> <groupId>org.apache.plc4x</groupId> <artifactId>plc4j-driver-profinet</artifactId> <version>{current-last-released-version}</version> </dependency> |
|
Default Transport: |
|
|
Compatible Transports: |
|
|
Supported Operations |
||
|
Only the subscription service is currently supported. |
|
Options |
||
|
(Required) Allows you to specify the devices you would like to communicate to, their device access module (Taken from the GSD file) as well as a list of submodules. This parameter has the format [[{device-1},{device-access},({submodule-1},{submodule-2})],[{device-2},{device-access},({submodule-1},{submodule-2})],....] For each available slot specified in the GSD file a submodule needs to be in the connection string, however it can be left blank e.g. [[{device},{device-access},({submodule-1},)]] If there is no submodule configured. |
|
|
The directory that is used to store any GSD files. This is used to look up the GSD for device found. |
|
|
(Default 32) This is used to scale the frequency in which cyclic packets are sent. Increasing this slows down communication |
|
|
(Default 4) Is also used to scale the frequency. The formula to calculate the overall cycle time is Cycle Time = SendClockFactor * Reduction Ratio * 31.23us |
|
|
Used to specify the maximum number of cycles that is allowed to be missed by a device. An alarm is generated if this is exceeded |
|
|
Specifies the number of cycles a device will keep its outputs in a non-safe state when it hasn’t received a cyclic packet. This must be equal to or be greater than the watchdog factor |
Connection String
The Profinet driver uses the connection string
profinet:raw://{ip-address}:{port}?{options}
Where the {ip-address}, unlike other PLC4X driver, uses the local IP address of the network interface you would like to bind to. This allows us to connect to multiple devices at once via the devices parameter.
An example of this connection string which has two devices test-device-1 and test-device-2, connected on the localhost interface would be:-
profinet:raw://127.0.0.1?gsddirectory=/Profinet/GSD&devices=[[test-device-1,MOD_1,(SUBMOD_1,,SUBMOD_1,)],[test-device-2,MOD_1,(SUBMOD_1,,SUBMOD_1,)]]
Note the transport, port fields shouldn’t have to be changed
Address Format
The format of address will be in the format.
device.slot.id.module_name.channel.bit:format
An example would be
device-1.1.1.DIGITAL_INPUT.0.1:BOOL
Note:-
Data Types
The following data types are supported
-
BOOL (boolean)
-
SINT (int 8)
-
USINT (uint 8)
-
BYTE (uint 8)
-
INT (int 16)
-
UINT (uint 16)
-
WORD (uint 16)
-
DINT (int 32)
-
UDINT (uint 32)
-
DWORD (uint 32)
-
LINT (int 64)
-
ULINT (uint 64)
-
LWORD (uint 64)
-
REAL (float)
-
LREAL (double)
-
CHAR (char)
-
WCHAR (2 byte char)
-
STRING (utf-8)
-
WSTRING (utf-16)
Some useful tips
Although the GSD file contains all the information needed to configure which data will be available from a device. The easiest approach is to use the browsing function of the Profinet driver to return a list of all available tags. Then only the addresses of interest can be selected.