Type
Simulated
Connection String Options
Name |
Default Value |
Required |
Description |
|
Name |
Simulated PLC4X Datasource |
|||
Code |
|
|||
Maven Dependency |
<dependency> <groupId>org.apache.plc4x</groupId> <artifactId>plc4j-driver-simulated</artifactId> <version>0.12.0</version> </dependency> |
|||
Supported Transports |
||||
Config options: |
Name | Value | Description |
---|---|---|
Supported Operations |
||
|
Supports all standard IEC 61131 data types outlined below. |
|
|
Supports all standard IEC 61131 data types outlined below. |
Individual Resource Address Format
Connection String
The simulated driver has the following connection string format:-
simulated:{transport}://{ip-address}:{port}
An example connection string would look like:-
simulated://127.0.0.1
Note the transport and port fields are optional.
General Format
The simulated addresses have this format:
{simulation-type}/{alias}:{data-type}[{array-size}]
If the array-size part is omitted, the default size of 1
is assumed.
If the data-type part is omitted, it defaults to STRING.
Simulation Types
The simulation device supports 3 different simulation types
-
STATE - This holds in memory a value for a given alias. This value can be read or written to, however this should only be used in conjunction with a persistent connection. Once the connection is closed the memory area is cleared.
-
RANDOM - This provides a new random value for each read. When writing, a log message is recorded and the value is discarded.
-
STDOUT - Always returns a null value when reading. When writing, a log message is recorded and the value is discarded.
Alias
Aliases are used to identify the different field addresses. They should only contain alpha-numeric and the full stop (.) character. For readability and language specific technical purposes they should be less than 256 characters.
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 (254 bytes)
Some useful tips
The simulation driver uses a lot of the same logic templates that is used for the other drivers. It is a good way to test PLC4X functionality without having a device to connect to.
Examples
All of these address formats are valid:-
-
RANDOM/foo:INT
-
RANDOM/foo:UDINT
-
RANDOM/device1.machineA.sensor1:UINT
-
RANDOM/device1.machineA.sensor1:STRING
-
STATE/device1.machineA.sensor1:INT
-
STDOUT/device1.machineA.sensor1:INT