User Tools

Site Tools

한국어

comfilehmi:hmieditor_function:index

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
comfilehmi:hmieditor_function:index [2023/09/25 14:05]
COMFILE Technology [System Functions]
comfilehmi:hmieditor_function:index [2024/03/13 17:05] (current)
COMFILE Technology [System Functions]
Line 1: Line 1:
 ====== System Functions ====== ====== System Functions ======
  
-The functions listed here can be used in expressions in the ComfileHMI editor.+The functions listed here can be used in expressions in Comfile Studio.
  
  
Line 142: Line 142:
   * ''​bitwise_not(value)'':​ Returns the binary complement of ''​value''​.   * ''​bitwise_not(value)'':​ Returns the binary complement of ''​value''​.
   * ''​change_screen(screen_number)'':​ Transitions to the screen identified by ''​screen_number''​.   * ''​change_screen(screen_number)'':​ Transitions to the screen identified by ''​screen_number''​.
-  * ''​cpu_usage()''​ : Returns the current CPU utilization as a percentage.+  * ''​cpu_usage()''​ : Returns the current CPU utilization as a percentage.  This function always returns ''​0''​ when running in the simulator or on a PC.
   * ''​enable_modbus_batching(enable = 1)'':​ Enables or disables the Modbus optimization feature that batches adjacent Modbus addresses into a single Modbus query. ​ The feature is enabled by default and is recommended for best performance,​ but there are limited situations where it may not be needed, such as a device that only supports processing one address per query. ​ In such a case, ''​enable_modbus_batching(0)''​ can be used to make the Modbus queries compatible. ​ Typically this function does not need to called. ​ The ''​enable''​ argument is optional and defaults to ''​1''​.   * ''​enable_modbus_batching(enable = 1)'':​ Enables or disables the Modbus optimization feature that batches adjacent Modbus addresses into a single Modbus query. ​ The feature is enabled by default and is recommended for best performance,​ but there are limited situations where it may not be needed, such as a device that only supports processing one address per query. ​ In such a case, ''​enable_modbus_batching(0)''​ can be used to make the Modbus queries compatible. ​ Typically this function does not need to called. ​ The ''​enable''​ argument is optional and defaults to ''​1''​.
   * ''​exit_project()'':​ Causes the current project to exit.  This is the same effect as touching the upper right corner of the screen 5 times in quick succession.   * ''​exit_project()'':​ Causes the current project to exit.  This is the same effect as touching the upper right corner of the screen 5 times in quick succession.
   * ''​enable_status_monitoring(enable = 1)'': ​ Enables status monitoring messages to appear overlaid on the panel PC's screen. The ''​enable''​ argument is optional and defaults to ''​1''​.   * ''​enable_status_monitoring(enable = 1)'': ​ Enables status monitoring messages to appear overlaid on the panel PC's screen. The ''​enable''​ argument is optional and defaults to ''​1''​.
-  * ''​free_memory_bytes()'':​ Returns the amount of free system memory in bytes.+  * ''​free_memory_bytes()'':​ Returns the amount of free system memory in bytes.  This function always returns ''​0''​ when running in the simulator or on a PC.
   * ''​firmware_version()''​ : Retrieves the firmware version running on the panel PC.  For example ''​273''​ corresponds to v2.73.   * ''​firmware_version()''​ : Retrieves the firmware version running on the panel PC.  For example ''​273''​ corresponds to v2.73.
   * ''​idle_seconds()''​ : Returns the number of seconds since the screen was last touched.   * ''​idle_seconds()''​ : Returns the number of seconds since the screen was last touched.
   * ''​idle_minutes()''​ : Returns the number of minutes since the screen was last touched. ​ Note: Calling ''​set_backlight_state(1)''​ will reinitialize the idle timer.   * ''​idle_minutes()''​ : Returns the number of minutes since the screen was last touched. ​ Note: Calling ''​set_backlight_state(1)''​ will reinitialize the idle timer.
 +  * ''​is_pc()'':​ Returns ''​1''​ if the project is currently running on a PC or ''​0''​ if not.
   * ''​is_status_monitoring_enabled()'':​ Returns ''​1''​ if status monitoring is enabled or ''​0''​ if it is not enabled.   * ''​is_status_monitoring_enabled()'':​ Returns ''​1''​ if status monitoring is enabled or ''​0''​ if it is not enabled.
   * ''​keypad_state()'':​ Returns whether the current keypad is opened. ''​1''​ if opened, ''​0''​ if not.   * ''​keypad_state()'':​ Returns whether the current keypad is opened. ''​1''​ if opened, ''​0''​ if not.
Line 158: Line 159:
   * ''​queries_per_sec()''​ : Returns the number of external device queries sent per second.   * ''​queries_per_sec()''​ : Returns the number of external device queries sent per second.
   * ''​rand()''​ : returns a random number in the range of 0~32767 (0x7FFF)   * ''​rand()''​ : returns a random number in the range of 0~32767 (0x7FFF)
-  * ''​reboot_system()''​ : Reboots the panel PC+  * ''​reboot_system()''​ : Reboots the panel PC.  This function is not supported when running in the simulator or on a PC.
   * ''​restore_field_resource_color (resource number)'':​ Restores the color field resource to the original color set by the editor. Example) ''​restore_field_resource_color(3)''​   * ''​restore_field_resource_color (resource number)'':​ Restores the color field resource to the original color set by the editor. Example) ''​restore_field_resource_color(3)''​
   * ''​scale(input,​ minimum input, maximum input, minimum output, maximum output)''​ : Scales ''​input''​ proportionally to (''​maximum input''​ - ''​minimum input''​) / (''​maximum output''​ - ''​minimum output''​).   * ''​scale(input,​ minimum input, maximum input, minimum output, maximum output)''​ : Scales ''​input''​ proportionally to (''​maximum input''​ - ''​minimum input''​) / (''​maximum output''​ - ''​minimum output''​).
   * ''​screen_id()''​ : Returns the id of the current screen.   * ''​screen_id()''​ : Returns the id of the current screen.
-  * ''​self_ip_addr()''​ - Returns the IP address of the panel PC as a string (for example: 192.68.0.50). Note: This function returns a null string in the simulator.+  * ''​self_ip_addr()''​ - Returns the IP address of the panel PC as a string (for example: 192.68.0.50). Note: This function returns a null string ​when running ​in the simulator ​or on a PC.
   * ''​set_backlight_state(value)'': ​ Sets the state of the LCD backlight on or off.  If ''​value''​ is ''​1''​ the LCD backlight turns on, if ''​value''​ is ''​0''​ the LCD backlight is turns off.   * ''​set_backlight_state(value)'': ​ Sets the state of the LCD backlight on or off.  If ''​value''​ is ''​1''​ the LCD backlight turns on, if ''​value''​ is ''​0''​ the LCD backlight is turns off.
-  * ''​set_data_processing_period(value)''​ : This function can be used to throttle CPU usage. ​ If the CPU usage for a project is too high, the data processing period can be increased to throttle back the amount of resources that the HMI software dedicates to processing data.  ''​value''​ is in units of milliseconds. ​ This function can be useful when the CPU utilization increases due to an increase in the number of events or actions in the project. ​ Typically, it would only be called once at the start of a project, but it can be called multiple times in a project to adjust the CPU utilization dynamically. ​ Setting this value to 0ms will cause the data processing to run as fast as possible, but will also cause the highest CPU utilization. ​ Values below 50ms should be used with caution. ​ If the CPU utilization is approaching 100%, set this value to approximately 100ms, and the communication interval to 30ms for best results.  Beginning with firmware v3.87, this value defaults to 50ms.  In prior versions the default is 0ms.+  * ''​set_data_processing_period(value)''​ : This function can be used to throttle CPU usage. ​ If the CPU usage for a project is too high, the data processing period can be increased to throttle back the amount of resources that the HMI software dedicates to processing data.  ''​value''​ is in units of milliseconds. ​ This function can be useful when the CPU utilization increases due to an increase in the number of events or actions in the project. ​ Typically, it would only be called once at the start of a project, but it can be called multiple times in a project to adjust the CPU utilization dynamically. ​ Setting this value to 0ms will cause the data processing to run as fast as possible, but will also cause the highest CPU utilization. ​ Values below 50ms should be used with caution. ​ If the CPU utilization is approaching 100%, set this value to approximately 100ms, and the communication interval to 30ms as a reasonable starting point.  Beginning with firmware v3.87, this value defaults to 50ms.  In prior versions the default is 0ms.
   * ''​set_field_resource_color(resource number,​R,​G,​B)''​ : You can change the color of color field resource in real time. (Caution: Only predefined colors can be changed in the editor.) Ex) ''​set_field_resource_color(3,​255,​0,​0)'' ​ Changes color resource number 3 to red.   * ''​set_field_resource_color(resource number,​R,​G,​B)''​ : You can change the color of color field resource in real time. (Caution: Only predefined colors can be changed in the editor.) Ex) ''​set_field_resource_color(3,​255,​0,​0)'' ​ Changes color resource number 3 to red.
   * ''​set_modbus_word_write_always_multi(active_status_flag = 1)'':​ When ''​active_status_flag''​ is `1` or omitted, this function causes all Modbus register (16-bit word) writes to use function code 16 (Write Multiple Registers) even when the number of registers to write is 1.   * ''​set_modbus_word_write_always_multi(active_status_flag = 1)'':​ When ''​active_status_flag''​ is `1` or omitted, this function causes all Modbus register (16-bit word) writes to use function code 16 (Write Multiple Registers) even when the number of registers to write is 1.
Line 173: Line 174:
   * ''​tick_count()''​ : The number of milliseconds since the system was powered on.  This is a 32-bit millisecond timer that will overflow every 49.7 days.   * ''​tick_count()''​ : The number of milliseconds since the system was powered on.  This is a 32-bit millisecond timer that will overflow every 49.7 days.
   * ''​touch_duration()''​ : The number of milliseconds since the last time the screen was touched. ​ If the screen has never been touched -1 is returned.   * ''​touch_duration()''​ : The number of milliseconds since the last time the screen was touched. ​ If the screen has never been touched -1 is returned.
-  * ''​verify_developer_key(value)''​ : Using the ComfileHMI panel PC's runtime configuration screen, a unique key can be assigned to a individual device or group of devices. ​ ''​verify_developer_key''​ can then be used at runtime within a project to test which device a project is running on and dynamically offer a different experience. The developer key cannot be read; one can only check if ''​value''​ matches the developer key assigned to the device. ​ This function returns ''​1''​ if the ''​value''​ matches the developer key assigned to the device or ''​0''​ if it does not.+  * ''​verify_developer_key(value)''​ : Using the ComfileHMI panel PC's runtime configuration screen, a unique key can be assigned to a individual device or group of devices. ​ ''​verify_developer_key''​ can then be used at runtime within a project to test which device a project is running on and dynamically offer a different experience. The developer key cannot be read; one can only check if ''​value''​ matches the developer key assigned to the device. ​ This function returns ''​1''​ if the ''​value''​ matches the developer key assigned to the device or ''​0''​ if it does not.  This feature is only supported on PCs with a software licensing USB dongle. ​ Whether or not this function is supported in the simulator is determined by runtime settings. The PC runtime verifies the given value against the developer key registered to the USB licensing dongle. ​ The developer key can be registered to the USB licensing dongle from within the simulator or PC runtime settings.
   ​   ​
 ===== Action Parameters and Related Functions ===== ===== Action Parameters and Related Functions =====
comfilehmi/hmieditor_function/index.1695618334.txt.gz · Last modified: 2023/09/25 14:05 by COMFILE Technology