Table of Contents

Dynamic Changes

Dynamic changes are advanced functions that allow us to change either the configuration of the PLC or the properties of the communication channels uploaded to the PLC. Therefore, it is not necessary to perform configuration directly in the IDE; individual configuration variables can be extracted, for example, to an HMI.

Using the functions described below, it is possible to program custom functional blocks in ST according to the project's requirements.

dynpar.setdynamicparamstr

Description

The function is used to write string values.

Usage in ST

WriteResult := dynpar.setdynamicparamstr(id := ParamId, value := ParamToWrite);

Inputs

Outputs

Return Values

dynpar.setdynamicparamint

Description

The function is used to write integer values.

Usage in ST

WriteResult := dynpar.setdynamicparamint(id := ParamId, value := ParamToWrite);

Inputs

Outputs

Return Values

dynpar.setdynamicparambool

Description

The function is used to write boolean values.

Usage in ST

WriteResult := dynpar.setdynamicparambool(id := ParamId, value := ParamToWrite);

Inputs

Outputs

Return Values

dynpar.setdynamicparamtime

Description

The function is used to write time values.

Usage in ST

WriteResult := dynpar.setdynamicparamtime(id := ParamId, value := ParamToWrite);

Inputs

Outputs

Return Values

dynpar.setdynamicparamdt

Description

The function is used to write date and time values.

Usage in ST

WriteResult := dynpar.setdynamicparamdt(id := ParamId, value := ParamToWrite);

Inputs

Outputs

Return Values

dynpar.trygetdynamicparamstr

Description

The function is used to read string values.

Usage in ST

ReadResult := dynpar.trygetdynamicparamstr(id := ParamId, value => ReturnValue);

Inputs

Outputs

Return Values

dynpar.trygetdynamicparamint

Description

The function is used to read integer values.

Usage in ST

ReadResult := dynpar.trygetdynamicparamint(id:= ParamId, value => ReturnValue);

Inputs

Outputs

Return Values

dynpar.trygetdynamicparambool

Description

The function is used to read boolean values.

Usage in ST

ReadResult := dynpar.trygetdynamicparambool(id:= ParamId, value => ReturnValue);

Inputs

Outputs

Return Values

dynpar.trygetdynamicparamtime

Description

The function is used to read time values.

Usage in ST

ReadResult := dynpar.trygetdynamicparamtime(id:= ParamId, value => ReturnValue);

Inputs

Outputs

Return Values

dynpar.trygetdynamicparamdt

Description

The function is used to read date and time values.

Usage in ST

ReadResult := dynpar.trygetdynamicparamdt(id:= ParamId, value => ReturnValue);

Inputs

Outputs

Return Values

dynpar.deletedynamicparam

Description

The function is used to delete a dynamic parameter. Dynamic parameters can be deleted in bulk when uploading a configuration.

Usage in ST

DeleteResult := dynpar.deletedynamicparam(ParamToDelete);

Inputs

Outputs

Return Values

dynpar.commithwconfiguration

Description

The function is used to save the entire HW configuration tree to the PLC memory. It has no parameters.

Usage in ST

CommitResult := dynpar.commithwconfiguration();

Return Values

ReloadApplication

The function is used to restart the PLC. You can specify the type of restart based on the given flag. If no flag is set, the PLC restarts in the standard way (Warm Restart).

Usage in ST

RestartResult := reloadapplication(Flag);

Input Parameters - Flags (udint)

Outputs

Return Values

Keys for PLC Configuration

These keys can be found in the project directory in the bin directory, where there is a file with the .XML extension that can be opened in a text editor. This file is created by uploading the configuration to the PLC.

The prefix “hwcfg” is added before the keys for PLC configuration. In the XML file, we navigate through individual nodes, where for example, to set the PLC's IP address, we must write the key in the format “hwcfg.hwconfiguration.runtime.lwip.ipv4.@ipaddress”.

Table of Keys for PLC Configuration

Networking

Key Type Key
IP Address hwcfg.hwconfiguration.runtime.lwip.ipv4.@ipaddress
Network Mask hwcfg.hwconfiguration.runtime.lwip.ipv4.@mask
Gateway hwcfg.hwconfiguration.runtime.lwip.ipv4.@gateway
DNS hwcfg.hwconfiguration.runtime.lwip.ipv4.@nameserver
Static/DHCP hwcfg.hwconfiguration.runtime.lwip.ipv4.@mode
Network Interface Controller Counthwcfg.hwconfiguration.runtime.advanced.@niccount
Enable Configuration over UDP hwcfg.hwconfiguration.runtime.configservice.@enabled
Config Service Port hwcfg.hwconfiguration.runtime.configservice.@port
Enable HTTP hwcfg.hwconfiguration.runtime.httpservice.@enabled
HTTP Port hwcfg.hwconfiguration.runtime.httpservice.@port
Enable HTTPS hwcfg.hwconfiguration.runtime.httpsservice.@enabled
HTTPS Port hwcfg.hwconfiguration.runtime.httpsservice.@port
Redirect HTTP to HTTPS hwcfg.hwconfiguration.runtime.httpservice.@redirect

SSCP Parameters

Key Type Key
SSCP Address hwcfg.hwconfiguration.runtime.sscp.@slaveid
Number of Registrable Groups hwcfg.hwconfiguration.runtime.sscp.@groupscount
Number of Variables in Group hwcfg.hwconfiguration.runtime.sscp.@groupvariablecount
Enable TCP Server hwcfg.hwconfiguration.runtime.sscp.tcp.@enabled
TCP Server Port hwcfg.hwconfiguration.runtime.sscp.tcp.@port
Enable SSCP Serial hwcfg.hwconfiguration.runtime.sscp.serial.@enabled
SSCP Serial Port hwcfg.hwconfiguration.runtime.sscp.serial.@port
SSCP Serial Baudrate hwcfg.hwconfiguration.runtime.sscp.serial.@baudrate
SSCP Serial Mode (Server/Router)hwcfg.hwconfiguration.runtime.sscp.serial.@mode
Enable SSL Server hwcfg.hwconfiguration.runtime.sscp.ssl.@enabled
SSL Server Port hwcfg.hwconfiguration.runtime.sscp.ssl.@port

Users Definition

Key Type Key
Engineeringhwcfg.hwconfiguration.runtime.sscp.users.user[1].@name
Full Controlhwcfg.hwconfiguration.runtime.sscp.users.user[2].@name
Read Only hwcfg.hwconfiguration.runtime.sscp.users.user[3].@name
First User hwcfg.hwconfiguration.runtime.sscp.users.user[first()].@name
Last User hwcfg.hwconfiguration.runtime.sscp.users.user[last()].@name

Database Parameters

Key Type Key
Enabled hwcfg.hwconfiguration.runtime.rcwaredb.@enabled
Protocol hwcfg.hwconfiguration.runtime.rcwaredb.urls.url[1].@protocol
Host hwcfg.hwconfiguration.runtime.rcwaredb.urls.url[1].@host
Path hwcfg.hwconfiguration.runtime.rcwaredb.urls.url[1].@path
Port hwcfg.hwconfiguration.runtime.rcwaredb.urls.url[1].@port
User Name hwcfg.hwconfiguration.runtime.rcwaredb.urls.url[1].@username
Password hwcfg.hwconfiguration.runtime.rcwaredb.urls.url[1].@password
Certificate Validationhwcfg.hwconfiguration.runtime.rcwaredb.urls.url[1].@certificatevalidation
Communication Periodhwcfg.hwconfiguration.runtime.rcwaredb.@updateperiod

Proxy Parameters

Key Type Key
Enabled hwcfg.hwconfiguration.runtime.proxy.@enabled
Proxy ID hwcfg.hwconfiguration.runtime.proxy.@id
Protocol hwcfg.hwconfiguration.runtime.proxy.urls.url[1].@protocol
Host hwcfg.hwconfiguration.runtime.proxy.urls.url[1].@host
Path hwcfg.hwconfiguration.runtime.proxy.urls.url[1].@path
Port hwcfg.hwconfiguration.runtime.proxy.urls.url[1].@port
Certificate Validationhwcfg.hwconfiguration.runtime.proxy.urls.url[1].@certificatevalidation
Keep-alive Period hwcfg.hwconfiguration.runtime.proxy.@keepalive

Date/Time Settings

Key Type Key
UTC Offset hwcfg.hwconfiguration.runtime.sscp.users.user[1].@name
Daylight Offsets Numberhwcfg.hwconfiguration.runtime.sscp.users.user[2].@name
Year 1 hwcfg.hwconfiguration.timetransformation.daylights.daylight[1].@year
Year 20 hwcfg.hwconfiguration.timetransformation.daylights.daylight[20].@year
First Year hwcfg.hwconfiguration.timetransformation.daylights.daylight[first].@year
Last Year hwcfg.hwconfiguration.timetransformation.daylights.daylight[last].@year
Offset Start hwcfg.hwconfiguration.timetransformation.daylights.daylight[1].@start
Offset End hwcfg.hwconfiguration.timetransformation.daylights.daylight[1].@end
Daylight Offsets hwcfg.hwconfiguration.timetransformation.daylights.daylight[1].@daylightoffset

NTP Server

Key Type Key
Protocol hwcfg.hwconfiguration.timetransformation.ntp.urls.url[1].@protocol
Host hwcfg.hwconfiguration.timetransformation.ntp.urls.url[1].@host
Path hwcfg.hwconfiguration.timetransformation.ntp.urls.url[1].@path
Port hwcfg.hwconfiguration.timetransformation.ntp.urls.url[1].@port
Certificate Validationhwcfg.hwconfiguration.timetransformation.ntp.urls.url[1].@certificatevalidation
Keep-alive Period hwcfg.hwconfiguration.timetransformation.ntp.@keepalive

SD Card

Key Type Key
Use for Historyhwcfg.hwconfiguration.memorylayout.sdcard.@useforhistory
History Size hwcfg.hwconfiguration.memorylayout.sdcard.@historysize

Keys for Dynamic Changes in Image

Keys for dynamic changes in image are listed in the “Output” tab in the format “OEM Key “channel>ComPort” → 9698843FC46A2D1A, datatype: SignedInteger32”, where “channel” is the channel name and “ComPort” is the parameter from which we want to read or write. The key is then followed by the data type of the parameter. In this case, we would use the function dynpar.trygetdynamicparamint for reading this key and dynpar.setdynamicparamint for writing.

For keys for changes in image, it is necessary to add the prefix “image” before the listed keys. For example, to change the communication port of a modbus serial channel named “modbus_channel”, the key should be written as “image.modbus_channel>ComPort”.

Table of Keys for Dynamic Changes of Communication Protocol Properties

Modbus Serial

Key Type Key
Port Number image.“channel_name”>ComPort
Baud Rate image.“channel_name”>Baudrate
Data Bits image.“channel_name”>Databits
Parity image.“channel_name”>Parity
Stop Bits image.“channel_name”>Stopbits
Channel Enableimage.“channel_name”>Enable
Device Addressimage.“channel_name”.“device_name”>Address
Device Enableimage.“channel_name”.“device_name”>Enable

Modbus TCP

Key Type Key
Channel Enableimage.“channel_name”>Enable
Device Enable image.“channel_name”.“device_name”>Enable
IPv4 image.“channel_name”.“device_name”>Ipv4
Port image.“channel_name”.“device_name”>Port
Host image.“channel_name”.“device_name”>Host
Address image.“channel_name”.“device_name”>Address

BACnet Client

Key Type Key
IPv4 image.“channel_name”.“device_name”>Ipv4
Port image.“channel_name”.“device_name”>Port
Host image.“channel_name”.“device_name”>Host
Device Instanceimage.“channel_name”.“device_name”>DeviceInstance

BACnet Server

Key Type Key
IPv4 image.“channel_name”.“device_name”>Ipv4
Port image.“channel_name”.“device_name”>Port
Device Instanceimage.“channel_name”.“device_name”>DeviceInstance
Management Passwordimage.“channel_name”.“device_name”>MgmtPassword

Daikin

Key Type Key
IPv4 image.“channel_name”.“device_name”>Ipv4
Port image.“channel_name”.“device_name”>Port
Host image.“channel_name”.“device_name”>Host

IEC

Key Type Key
Port Number image.“channel_name”>ComPort
Baud Rate image.“channel_name”>Baudrate
Data Bits image.“channel_name”>Databits
Parity image.“channel_name”>Parity
Stop Bits image.“channel_name”>Stopbits

Mbus

Key Type Key
Port Number image.“channel_name”>ComPort
Baud Rate image.“channel_name”>Baudrate
Data Bits image.“channel_name”>Databits
Parity image.“channel_name”>Parity
Stop Bits image.“channel_name”>Stopbits
Primary Address image.“channel_name”.“device_name”>Primary
Secondary Address image.“channel_name”.“device_name”>Secondary
Use Secondary Address image.“channel_name”.“device_name”>UseSecondary
Device Enable image.“channel_name”.“device_name”>Enable

Modbus Server Serial

Key Type Key
Port Number image.“channel_name”>ComPort
Baud Rate image.“channel_name”>Baudrate
Data Bits image.“channel_name”>Databits
Parity image.“channel_name”>Parity
Stop Bits image.“channel_name”>Stopbits
Device Addressimage.“channel_name”.“device_name“>Address

Modbus Server TCP

Key Type Key
Channel Enableimage.“channel_name”>Enable
IPv4 image.“channel_name”.“device_name”>Ipv4
Port image.“channel_name”.“device_name”>Port
Device Addressimage.“channel_name”.“device_name”>Address
Device Enable image.“channel_name”.“device_name”>Enable

Table of Keys for Dynamic Changes of Alarm Channel Properties

SMTP

Key Type Key
Server image.“channel_name”.Host
Port image.“channel_name”.Port
Use Authentication image.“channel_name”.UseAuth
Username image.“channel_name”.Username
Password image.“channel_name”.Password
Enable SSL image.“channel_name”.Ssl
Certificate Validationimage.“channel_name”.CertificateValidation

GSM

Key Type Key
Port Number image.“channel_name”.ComPort
Baud Rate image.“channel_name”.Baudrate
Data Bits image.“channel_name”.Databits
Parity image.“channel_name”.Parity
Stop Bits image.“channel_name”.Stopbits