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

The function is used to write string values.

WriteResult := dynpar.setdynamicparamstr(id := ParamId, value := ParamToWrite);
  • id: string_ref - parameter name
  • value: string_ref - value of the parameter to write
  • No output parameters
  • 0 - no error
  • -1 - record does not exist
  • -2 - unknown requested type (cannot occur in practice)
  • -3 - size mismatch between stored record and requested record (e.g., stored as bool and read as int)
  • -4 - internal code error

dynpar.setdynamicparamint

The function is used to write integer values.

WriteResult := dynpar.setdynamicparamint(id := ParamId, value := ParamToWrite);
  • id: string_ref - parameter name
  • value: int - value of the parameter to write
  • No output parameters
  • 0 - no error
  • -1 - record does not exist
  • -2 - unknown requested type (cannot occur in practice)
  • -3 - size mismatch between stored record and requested record (e.g., stored as bool and read as int)
  • -4 - internal code error

dynpar.setdynamicparambool

The function is used to write boolean values.

WriteResult := dynpar.setdynamicparambool(id := ParamId, value := ParamToWrite);
  • id: string_ref - parameter name
  • value: bool - value of the parameter to write
  • No output parameters
  • 0 - no error
  • -1 - record does not exist
  • -2 - unknown requested type (cannot occur in practice)
  • -3 - size mismatch between stored record and requested record (e.g., stored as bool and read as int)
  • -4 - internal code error

dynpar.setdynamicparamtime

The function is used to write time values.

WriteResult := dynpar.setdynamicparamtime(id := ParamId, value := ParamToWrite);
  • id: string_ref - parameter name
  • value: time - value of the parameter to write
  • No output parameters
  • 0 - no error
  • -1 - record does not exist
  • -2 - unknown requested type (cannot occur in practice)
  • -3 - size mismatch between stored record and requested record (e.g., stored as bool and read as int)
  • -4 - internal code error

dynpar.setdynamicparamdt

The function is used to write date and time values.

WriteResult := dynpar.setdynamicparamdt(id := ParamId, value := ParamToWrite);
  • id: string_ref - parameter name
  • value: dt - value of the parameter to write
  • No output parameters
  • 0 - no error
  • -1 - record does not exist
  • -2 - unknown requested type (cannot occur in practice)
  • -3 - size mismatch between stored record and requested record (e.g., stored as bool and read as int)
  • -4 - internal code error

dynpar.trygetdynamicparamstr

The function is used to read string values.

ReadResult := dynpar.trygetdynamicparamstr(id := ParamId, value => ReturnValue);
  • id: string_ref - parameter name
  • value: string - returned value of the parameter
  • 0 - no error
  • -1 - record does not exist
  • -2 - unknown requested type (cannot occur in practice)
  • -3 - size mismatch between stored record and requested record (e.g., stored as bool and read as int)
  • -4 - internal code error

dynpar.trygetdynamicparamint

The function is used to read integer values.

ReadResult := dynpar.trygetdynamicparamint(id:= ParamId, value => ReturnValue);
  • id: string_ref - parameter name
  • value: int - returned value of the parameter
  • 0 - no error
  • -1 - record does not exist
  • -2 - unknown requested type (cannot occur in practice)
  • -3 - size mismatch between stored record and requested record (e.g., stored as bool and read as int)
  • -4 - internal code error

dynpar.trygetdynamicparambool

The function is used to read boolean values.

ReadResult := dynpar.trygetdynamicparambool(id:= ParamId, value => ReturnValue);
  • id: string_ref - parameter name
  • value: bool - returned value of the parameter
  • 0 - no error
  • -1 - record does not exist
  • -2 - unknown requested type (cannot occur in practice)
  • -3 - size mismatch between stored record and requested record (e.g., stored as bool and read as int)
  • -4 - internal code error

dynpar.trygetdynamicparamtime

The function is used to read time values.

ReadResult := dynpar.trygetdynamicparamtime(id:= ParamId, value => ReturnValue);
  • id: string_ref - parameter name
  • value: time - returned value of the parameter
  • 0 - no error
  • -1 - record does not exist
  • -2 - unknown requested type (cannot occur in practice)
  • -3 - size mismatch between stored record and requested record (e.g., stored as bool and read as int)
  • -4 - internal code error

dynpar.trygetdynamicparamdt

The function is used to read date and time values.

ReadResult := dynpar.trygetdynamicparamdt(id:= ParamId, value => ReturnValue);
  • id: string_ref - parameter name
  • value: dt - returned value of the parameter
  • 0 - no error
  • -1 - record does not exist
  • -2 - unknown requested type (cannot occur in practice)
  • -3 - size mismatch between stored record and requested record (e.g., stored as bool and read as int)
  • -4 - internal code error

dynpar.deletedynamicparam

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

DeleteResult := dynpar.deletedynamicparam(ParamToDelete);
  • id: string_ref - parameter name
  • No output parameters
  • 0 - no error
  • -1 - record does not exist
  • -2 - unknown requested type (cannot occur in practice)
  • -3 - size mismatch between stored record and requested record (e.g., stored as bool and read as int)
  • -4 - internal code error

dynpar.commithwconfiguration

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

CommitResult := dynpar.commithwconfiguration();
  • 0 - no error
  • -1 - record does not exist
  • -2 - unknown requested type (cannot occur in practice)
  • -3 - size mismatch between stored record and requested record (e.g., stored as bool and read as int)
  • -4 - internal code error

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).

RestartResult := reloadapplication(Flag);

Input Parameters - Flags (udint)

  • 0x00 - Warm Restart
  • 0x01 - Cold Restart
  • 0x02 - Full system restart (reboot)
  • No output parameters
  • 0 - no error
  • -1 - record does not exist
  • -2 - unknown requested type (cannot occur in practice)
  • -3 - size mismatch between stored record and requested record (e.g., stored as bool and read as int)
  • -4 - internal code error

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”.

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
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
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
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
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
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
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
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”.

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
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
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
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
Key Type Key
IPv4 image.“channel_name”.“device_name”>Ipv4
Port image.“channel_name”.“device_name”>Port
Host image.“channel_name”.“device_name”>Host
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
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
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
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
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
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
  • © Energocentrum Plus, s.r.o. 2017 - 2024