Skip to main content

HMI System

The HMI (Human-Machine Interface) node is where the visual project screens are developed. This system creates a functional interface between the operator and the Virtual PLC, allowing for message display, variable monitoring, data entry, and manual process control.

HMI Editor Interface

The programming environment integrates a drag-and-drop editor to build screens efficiently:

  • Screen Creation Area: The main canvas where controls are placed, moved, and resized.
  • Controls Tools: Divided into two tabs:
    • Standard Windows Controls: Common UI elements like buttons and labels.
    • Specialized Graphical Controls: Gauges, switches, and industrial indicators.
  • Property Grid: Used to modify the attributes (color, size, name) of the currently selected control.
  • HMI Tool Bar: Provides quick access to Copy/Paste, Delete, Control Properties (to manage events), and the Test HMI Page button to preview the results in test mode.
  • Script Programming Window: A dedicated area to write C# code for screen behavior.
Driver Configurator

Page Management

EasyPLC allows for flexible screen organization through the Page List system:

  • Copy & Paste: Right-click a page node to copy it within the same project.
  • Cross-Project Transfer: Use Copy Page To List to store multiple screens in a temporary buffer, then use Paste Pages From List to import them into a different project.
  • Clear Page List: Select to clear all the pages from the list.
Driver Configurator

Advanced Customization (Scripting)

For behaviors that exceed standard control properties, the HMI supports C# Scripting. This allows for total customization of screen logic, including event handling and timer management.

  • Script Programming Window: A dedicated area to write C# code for screen behavior.
  • External HMI Controls: Users can extend the library by adding custom .dll files into the EasyPLC\ and HMILib\ folders. These external controls must be programmed directly via script.
  • Script Wizard: Pressing F2 in the Script Window opens a wizard that allows you to double-click and insert available functions automatically.
Driver Configurator

Configuration & Communication

The HMI behavior and its link to the PLC are defined in the configuration settings:

Driver Configurator
  • HMI Container Window:
    • Maximized (Default): The HMI occupies the entire monitor.
    • Normal: Allows setting specific window dimensions and screen positions.
  • Communication Modes:
    • Local: HMI and Virtual PLC CPU run on the same machine.
    • Remote: HMI connects in the same net to Virtual PLC CPU on a different computer via IP Address and Port.
Driver Configurator

HMI Scripting Reference

HMI Script Methods

EasyPLC provides a comprehensive library of C# methods to manage screens, data, and user interaction within the HMI. These functions are accessible through the Script Programming Window or by using the Script Wizard (F2).

FunctionParametersReturnDescription
ShowHMIstring screenNamevoidLoads the specified HMI screenName as parameter.
ReadVariablestring variableNameobjectReturns the current value of the specified variable.
WriteVariablestring variableName, object valuevoidWrites the specified value to the variableName.
ReadDBint num, int elementobjectReturns the value of a specific element from Data Block num.
KeyPadnonedoubleOpens a numeric keypad and returns the value typed by the user.
KeyboardnonestringOpens a virtual keyboard and returns the string typed by the user.
ChartPointstring variableName, string chartName, bool legend, int chartTypevoidDraws a variable value in the specified Chart control (Types 0-9).
ChartPoint (Overload)string serieName, double value, string chartName, bool legend, int chartTypevoidDraws a specific value for a series in the Chart control.
ChartFIFOstring variableName, int numElements, string chartName, bool legend, int chartTypevoidDraws values in FIFO mode with a fixed number of X-elements.
ChartPointsstring serieName, double[] values, string chartName, bool legend, int chartTypevoidDraws an entire array of values for a specific series in the Chart.
ClearChartstring chartNamevoidClears all data from the specified Chart control.
MessageBox.Showstring textvoidDisplays a standard Windows message box with the specified text.

Control Events

CategoryEventDescription
CommonClickLaunched when the user clicks on any standard control.
Form (Screen)LoadTriggered when the form is initialized for the first time.
Form (Screen)Form ClosingTriggered when the user closes the HMI window.
Form (Screen)Key DownTriggered when a key is pressed while the form is in focus.
Form (Screen)ClickTriggered by a click on the form.
Form (Screen)Double ClickTriggered by a double-click on the form.
Check BoxChecked ChangedTriggered when the check mark state changes.
Combo BoxSelected Index ChangedTriggered when a different value is selected.
Data GridCell Content ClickTriggered when a specific cell inside a grid is clicked.
Scroll BarsScrollTriggered as the user moves the scroll bar thumb.
TimerTickTriggered repeatedly based on the defined Interval property.
note

On Form (Screem) Common: Although located within the events management, is not a triggered event. It is a dedicated space to write C# code that is globally accessible by all controls on the screen, making it the ideal place for global variable declarations.