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.
The function is used to write string values.
WriteResult := dynpar.setdynamicparamstr(id := ParamId, value := ParamToWrite);
The function is used to write integer values.
WriteResult := dynpar.setdynamicparamint(id := ParamId, value := ParamToWrite);
The function is used to write boolean values.
WriteResult := dynpar.setdynamicparambool(id := ParamId, value := ParamToWrite);
The function is used to write time values.
WriteResult := dynpar.setdynamicparamtime(id := ParamId, value := ParamToWrite);
The function is used to write date and time values.
WriteResult := dynpar.setdynamicparamdt(id := ParamId, value := ParamToWrite);
The function is used to read string values.
ReadResult := dynpar.trygetdynamicparamstr(id := ParamId, value => ReturnValue);
The function is used to read integer values.
ReadResult := dynpar.trygetdynamicparamint(id:= ParamId, value => ReturnValue);
The function is used to read boolean values.
ReadResult := dynpar.trygetdynamicparambool(id:= ParamId, value => ReturnValue);
The function is used to read time values.
ReadResult := dynpar.trygetdynamicparamtime(id:= ParamId, value => ReturnValue);
The function is used to read date and time values.
ReadResult := dynpar.trygetdynamicparamdt(id:= ParamId, value => ReturnValue);
The function is used to delete a dynamic parameter. Dynamic parameters can be deleted in bulk when uploading a configuration.
DeleteResult := dynpar.deletedynamicparam(ParamToDelete);
The function is used to save the entire HW configuration tree to the PLC memory. It has no parameters.
CommitResult := dynpar.commithwconfiguration();
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)
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 Count | hwcfg.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 |
---|---|
Engineering | hwcfg.hwconfiguration.runtime.sscp.users.user[1].@name |
Full Control | hwcfg.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 Validation | hwcfg.hwconfiguration.runtime.rcwaredb.urls.url[1].@certificatevalidation |
Communication Period | hwcfg.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 Validation | hwcfg.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 Number | hwcfg.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 Validation | hwcfg.hwconfiguration.timetransformation.ntp.urls.url[1].@certificatevalidation |
Keep-alive Period | hwcfg.hwconfiguration.timetransformation.ntp.@keepalive |
Key Type | Key |
---|---|
Use for History | hwcfg.hwconfiguration.memorylayout.sdcard.@useforhistory |
History Size | hwcfg.hwconfiguration.memorylayout.sdcard.@historysize |
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 Enable | image.“channel_name”>Enable |
Device Address | image.“channel_name”.“device_name”>Address |
Device Enable | image.“channel_name”.“device_name”>Enable |
Key Type | Key |
---|---|
Channel Enable | image.“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 Instance | image.“channel_name”.“device_name”>DeviceInstance |
Key Type | Key |
---|---|
IPv4 | image.“channel_name”.“device_name”>Ipv4 |
Port | image.“channel_name”.“device_name”>Port |
Device Instance | image.“channel_name”.“device_name”>DeviceInstance |
Management Password | image.“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 Address | image.“channel_name”.“device_name“>Address |
Key Type | Key |
---|---|
Channel Enable | image.“channel_name”>Enable |
IPv4 | image.“channel_name”.“device_name”>Ipv4 |
Port | image.“channel_name”.“device_name”>Port |
Device Address | image.“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 Validation | image.“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 |