Optional
allowOptional: If set, connecting to the target will success, even if there is no PLC runtime available or if the target TwinCAT system is in CONFIG mode (default: false
)
This can be useful if the target might not yet have a PLC software downloaded when connecting and client needs to be connected in advance.
Optional
autoOptional: If set, the client tries to reconnect automatically after a connection loss (default: true
)
The connection loss is detected by
rawClient
setting is set)NOTE: when using rawClient
setting, the client might not detect the connection loss
Optional
connectionOptional: Interval (milliseconds) how often the client checks if the connection if working (default: 1000
ms)
The client checks connection by reading the target TwinCAT system state.
See setting connectionDownDelay
.
NOTE: This is not available when using the rawClient
setting.
Optional
connectionOptional: Time (milliseconds) how long after the target TwinCAT system state is not available, the connection is determined to be lost (default: 5000
ms)
*
See setting connectionCheckInterval
.
NOTE: This is not available when using the rawClient
setting.
Optional
convertOptional: If set, PLC date types are converted to Javascript Date
objects (default: true
)
If true
, DATE_AND_TIME (DT) and DATE are converted to Date
objects
If false
, DATE_AND_TIME (DT) and DATE are converted to numbers (epoch time, seconds)
Optional
deleteOptional: If set, the client automatically deletes ADS notifications for unknown subscriptions (default: true
).
Otherwise, when a notification for an unknown subscription is received, the client will emit a warning.
Unknown subscriptions can occur, if a previous subscription wasn't unsubscribed (using the unsubscribe()
method)
and the target keeps sending notifications.
As default, the client automatically deletes unknown subscriptions on the PLC to conserve resources. A warning will be emitted when an unknown subscription is deleted.
Optional
disableOptional: If set, the client never caches symbols and data types (default: false
)
If set, the client always reads data type and symbol information from target. This slows the communication but guarantees up-to-date data in all cases.
As default, the client caches the results after reading them from the target.
Optional
forceOptional: If set, the client always uses UTF-8 for encoding/decoding ADS symbols (default: false
).
Otherwise, the client detects target system encoding automatically. TwinCAT 4026 and newer always use UTF-8.
When connecting to a non-PLC system with UTF-8 encoded ADS symbols, this setting needs to be set.
Optional
hideOptional: If set, no warnings are written to console using console.log()
(default: false
)
As default, the client writes warnings to the console, such as
The exact same warnings are emitted using the warning
event. See AdsClientEvents.
If this setting is set, the client never writes anything to the console.
Optional
localOptional: Local IP address to use (default: (empty string)
-> automatic)
Can be used to force using another network interface
See https://nodejs.org/api/net.html#socketconnectoptions-connectlistener
Optional
localOptional: Local ADS port to use (default: 0
-> automatic)
Can be used to set used ADS port manually. If not set, a free ADS port is received from the target router.
Optional
localOptional: Local AmsNetId to use (default: (empty string)
-> automatic)
Can be used to set used AmsNetId manually. If not set, AmsNetId is received from the target router.
This is needed for example when connecting directly to the PLC without local router.
Optional
localOptional: Local TCP port to use for outgoing connection (default: 0
-> automatic)
Can be used to force using specific local TCP port for outogoing connection
See https://nodejs.org/api/net.html#socketconnectoptions-connectlistener
Optional
monitorOptional: If set, client detects target PLC symbol version changes and reloads symbols and data types (default: true
)
Symbol version changes when PLC software is updated with download (no online change). By detecting it, the client should work when dealing with a target that has software updated.
NOTE: This is not available when using the rawClient
setting.
Optional
objectifyOptional: If set, enumeration (ENUM) data types are converted to objects (default: true
)
If true
, ENUM is converted to an object:
{
name: 'enumValue',
value: 5
}
If false
, ENUM is converted to a plain number (5
)
Optional
rawOptional: If set, only a direct raw ADS connection is established to the target (default: false
)
As default, the client always assumes the target has a TwinCAT system and a PLC runtime.
However, in some cases only a direct ADS communication is required or a better choice:
Optional
readOptional: If set, all data types from target are read and cached after connecting. (default: false
)
This is an intensive operation (symbol data is a large object).
Can be useful when needing a fast response (client already knows all PLC datat types) - for example when using subscriptions with high cycle times or when dealing with larger amount of ADS data.
If not set, the client reads and caches data types only on demand.
NOTE: This is not available when using the rawClient
setting.
Optional
readOptional: If set, all symbols from target are read and cached after connecting. (default: false
)
This is an intensive operation (symbol data is a large object).
Can be useful when needing a fast response (client already knows all PLC symbol data) - for example when using subscriptions with high cycle times or when dealing with larger amount of ADS data.
If not set, the client reads and caches symbol information only on demand.
NOTE: This is not available when using the rawClient
setting.
Optional
reconnectOptional: Interval (milliseconds) how often the lost connection is tried to re-establish (default: 2000
ms)
Value can be lowered if a very fast response if required, however usually getting the connection back on takes a while (TwinCAT system restart takes a while etc.)
Optional
routerOptional: Target ADS router IP address/hostname (default: 127.0.0.1
)
This is usually ´127.0.0.1` (local machine), as the TwinCAT system is usually running on the same machine.
However, if connecting from a system without router (such as Linux), this needs to be changed to be the router/PLC address.
Optional
routerOptional: Target ADS router TCP port (default: 48898
)
This is usually 48898
, unless using port forwarding (e.g. in docker) or separate TwinCAT router.
NOTE: Router needs to have firewall open for this port, TwinCAT PLC has as default.
REQUIRED: Default target ADS port
Examples:
851
- TwinCAT 3 PLC runtime 1852
- TwinCAT 3 PLC runtime 2801
- TwinCAT 2 PLC runtime 110000
- TwinCAT system serviceNOTE: This is not a TCP port (no firewall config needed).
REQUIRED: Default target AmsNetId address
Examples:
localhost
or 127.0.0.1.1.1
- Local (same machine as Node.js)192.168.1.5.1.1
- PLC (example)192.168.1.5.2.1
- EtherCAT I/O device (example, see also rawClient
setting)Optional
timeoutOptional: Time (milliseconds) after a command is timeouted if no response received (default: 2000
ms)
This is used for AMS and ADS commands.
If using a slow connection, it might be useful to increase this limit.
Client settings