Diagnostics
Diagnostics shows how the server sees the equipment. There is one row per connection, with:
- a colored marker, the name and the state;
- the poll cycle time;
- the number of communication failures since the server started;
- how many tags lack good quality;
- the text of the last error.
It fits a service screen or a header, so the person on duty sees at once which controller is gone and why.
The marker colors:
- Green: connected.
- Yellow: connected, but some tags are bad (wrong address, unavailable memory area).
- Red: no communication.
- Grey: no data yet.
“Connections” is a list of name masks separated by “;” (PLC*; Meters). “Only with problems” keeps only connections without communication or with bad tags, so an empty table means everything is fine.
The data comes from the server’s system tags @Connection.<name>.Connected, .CycleMs, .Errors, .BadTags and .LastError. Ordinary elements can show them too. A “No communication” alarm on .Connected already exists for every connection.
The cycle time updates at most once a second. Errors and changes in the number of bad tags arrive at once.
Properties
Section titled “Properties”Besides the properties of every element — name, position, size, tooltip, rotation, transparency and the operate right:
| Property | Values | Default | Description |
|---|---|---|---|
Connections |
text | * |
Connections. Connection name masks separated by “;”: * — all, PLC* — starting with PLC |
OnlyProblems |
true / false |
false |
Only with problems. Show only connections without communication or with bad tags |
ShowCycle |
true / false |
true |
Cycle time. “Cycle, ms” column |
ShowErrors |
true / false |
true |
Errors. “Errors” column — communication failures since the server started |
ShowBadTags |
true / false |
true |
Bad tags. “Bad tags” column — tags without good quality in the last cycle |
ShowLastError |
true / false |
true |
Last error. Column with the text of the last communication error |
FontSize |
number | 12 |
Font size |
From scripts
Section titled “From scripts”Item.Type = Diagnostics. Any property is read and changed by name: Item.FontSize = 10. The common element members (Visible, Enabled, Value, Raise, Apply…) are described in Elements from scripts.
Actions of this element:
| Member | Description |
|---|---|
Connections() |
Connections — Name, State, Connected, CycleMs, Errors, BadTags, LastError |
Problems() |
Connections without communication or with bad tags |
Events
Section titled “Events”Mouse, hover, focus and keyboard — as for any element (see Events and functions).
Examples
Section titled “Examples”Check when the screen opens, and report if something is wrong.
var bad = Screen.Items("Diagnostics").Problems();if (bad.length > 0) HMI.ShowMessage("No communication or bad tags: " + bad.join(", "));The slowest connection.
var slow = Screen.Items("Diagnostics").Connections() .filter(function (c) { return c.CycleMs != null; }) .sort(function (a, b) { return b.CycleMs - a.CycleMs; })[0];if (slow) HMI.ShowMessage(slow.Name + ": cycle " + slow.CycleMs + " ms");