Extra features

On this page

The MTConnect module has two extra features: machine state and condition alarm tags. Each is switched on for each connection in the connection dialog, and both need the extra features to be included in your licence or in the trial. Both read the same /sample stream of the agent and write below <connection>/_Extras/<device>/. The first part of this chapter is machine state, the second part is condition alarm tags.

Machine state

Machine state is the first of them. It turns what an agent reports about a machine into one of five states and publishes the state as tags. It is switched on for each connection in the connection dialog, and it needs the extra features to be included in your licence or in the trial.

What you get

For each MTConnect device that the agent of a connection serves, the module keeps these tags below <connection>/_Extras/<device>/:

Tag Type Content
State String Running, Idle, Setup, Alarm or Unavailable.
StateCode String The values that decided it, for example Execution=ACTIVE,ControllerMode=AUTOMATIC.
StateSince DateTime The time the agent gave to the change that started this state (source time).
SecondsInState Int8 Whole seconds since StateSince, updated every second while the stream runs.
Alarm Boolean True while the state is Alarm.

<device> is the name the agent gives the device. A name that a tag path cannot hold has the characters / \ [ ] . { } : ; and quotes replaced by _, a name that starts with _ gets a D in front, and a name that two devices share gets a number appended. A device that reports none of Execution, ControllerMode and EmergencyStop (the agent’s own device, for example) gets no state tags.

The state is read from the agent’s /sample stream. The tags of the connection itself, below <connection>/_Status and the machine tags, are not affected by it.

The state table

The module checks the rows in this order and takes the first that fits.

Row State When
1 Unavailable The stream is not running or the agent cannot be reached, or Availability is UNAVAILABLE, or every Execution of the device is UNAVAILABLE.
2 Alarm EmergencyStop is TRIGGERED, or a Condition is at FAULT on a Controller or Path component of the device.
3 Running Any Execution is ACTIVE.
4 Setup ControllerMode is MANUAL, MANUAL_DATA_INPUT, SEMI_AUTOMATIC or EDIT.
5 Idle None of the above.

The table is the same for every MTConnect version. The module reads the items by their MTConnect names without regard to case, so the names of MTConnect 1.3, 1.4 and 2.x all work: Execution, ControllerMode, EmergencyStop, Availability, and the condition elements Normal, Warning, Fault and Unavailable. A name that only starts like one of them, such as ControllerModeOverride, is a different item.

Several paths: one ACTIVE Execution is enough for Running, and Unavailable by Execution needs all of them to be UNAVAILABLE. Several conditions on one data item are tracked by their native code: a Normal with a native code clears that code, a Normal without one clears the data item, and Unavailable replaces the codes. A fault on an axis, a spindle or another component that is not a Controller or Path does not make an Alarm.

When the stream is not available

  • The agent cannot be reached or does not give a usable answer: State is Unavailable with the StateCode Agent=UNREACHABLE, since the time the module noticed. When the agent answers again, the state comes from its answer.
  • The agent refuses the stream: State is Unavailable with Stream=NOT_RUNNING and stays so until the connection is edited or the gateway restarts. The base polling of the connection continues.
  • The extra features stop being available (licence end, connection stopped, module stopped): the tags keep their last values and their quality becomes Bad. They work again when the stream runs again.
  • Machine state is switched off for the connection: the tags are removed.

Override rows

You can add rows to the table of one connection. A row has a data item type, a value and a state: when a data item of that type has that value, the device is in that state.

  • The type is Execution, ControllerMode, EmergencyStop, Availability or Condition. For Condition the value is the level: FAULT, WARNING or UNAVAILABLE, and any component counts.
  • The value is 1 to 40 letters, digits or underscores. Lower case is accepted and stored in capitals, and a space becomes an underscore.
  • The state is Running, Idle, Setup, Alarm or Unavailable.
  • Up to 50 rows, and one row for each type and value.
  • Your rows are checked in their order before the table, and the first row that fits decides. The two cases of the stream itself, an agent that cannot be reached and a stream that has ended, come before the rows: a row for Availability UNAVAILABLE does not cover them. When no row fits, the table decides. StateCode then names the row’s item and value, for example Execution=INTERRUPTED.
  • A row is data only. A row with an unknown type or state, another field or a value that is not a plain word is refused when you save it, with the number of the row and the reason.

Rows are stored with the connection, are kept while the extra features are not available, and apply again when they are.

Limits of machine state

  • The state of a device comes from the items listed above. A device that reports some of them but not all is decided by the ones it reports; with none of the items that decide Idle or Running it is Idle.
  • StateSince is the agent’s time. If the clock of the agent differs from the clock of the gateway, SecondsInState differs by the same amount, and it is never below 0.
  • The module keeps no history. Tag Historian on State records the states over time.

Condition alarm tags

Condition alarm tags turn the conditions an agent reports (Normal, Warning, Fault, Unavailable) into tags that an Ignition alarm or a script can use. They are a second way to read the conditions: the condition tags that the module has always created from the agent’s probe are not changed, and they still hold the newest condition of a data item as one row. A data item that has two conditions at once, for example two different fault codes, shows only the newer one there. The alarm tags below count both.

Tags

For each MTConnect device that has at least one condition data item, the module keeps these tags below <connection>/_Extras/<device>/, next to the machine state tags of the same device:

Tag Type Content
ActiveConditionCount Int4 The number of active warnings and faults on the device, counted by data item and native code.
WorstCondition String Fault while any fault is active, else Warning while any warning is active, else Unavailable while any condition data item is unavailable, else Normal.
AnyFault Boolean True while any fault is active.
AnyWarning Boolean True while any warning is active.
Conditions/<data item> Boolean One tag for each condition data item, true while a warning or fault is active on it. Attach an Ignition alarm to it.

<data item> is the name the agent gives the data item, and its id when it has no name. A name that a tag path cannot hold has the characters / \ [ ] . { } : ; and quotes replaced by _, and two names that become the same get a number appended. The device folder has the same name as for machine state.

How conditions are tracked

  • A condition is a data item and a native code. When the agent gives no native code, its condition id stands in for it, and a warning or fault with neither counts once for the data item.
  • A Warning or Fault with a native code stays active until a Normal with the same native code arrives. A second Warning or Fault with the same code replaces the first, so a Warning that becomes a Fault counts once.
  • A Normal without a native code clears every condition of that data item and no other data item.
  • Unavailable clears the conditions of the data item and marks it unavailable until the next Warning, Fault or Normal. It is not an active warning or fault, so the Conditions/<data item> tag of it is false.
  • When the stream starts and after every gap, the module reads the agent’s current conditions and replaces what it knew. After a buffer overrun (the agent’s buffer wrapped and observations were lost), the module first reads what is left, then reads the current conditions, so a fault whose Normal was lost clears. A device that the current conditions do not list has no active conditions.

When the stream is not available

  • The agent cannot be reached, or the stream ended on its own: WorstCondition reads Unavailable. The other tags keep their last values and their quality becomes Bad.
  • The extra features stop being available (licence end, connection stopped, module stopped): every condition tag keeps its last value and its quality becomes Bad. They work again when the stream runs again.
  • Condition alarm tags are switched off for the connection: the condition tags below _Extras are removed. Machine state tags of the same device stay while that feature is on.

Limits of condition alarm tags

  • The module keeps no history of conditions. Use the alarm journal of Ignition on Conditions/<data item>.
  • A data item is told apart by its id. Two condition data items with the same name in one device (names that differ only by upper and lower case count as the same) get one tag each; the second and later get _2, _3 after the name, in the order the module first saw them. The number stays with the data item while the module runs.
  • A device that has no condition data item has no condition tags. Its state is still decided from the items listed under machine state.
  • Native codes and messages are not published; read them from the condition tag of the data item that the module has always created.

Last interval and downtime tags

Machine state also publishes what has just ended. Both groups of tags are below <connection>/_Extras/<device>/, next to the state tags, and are written only while machine state is switched on for the connection. They show the last record only: the module keeps nothing, and after a gateway restart the tags have no value until the first interval or event ends.

Last state interval

Every change of state ends one interval. The group LastInterval holds the interval that has just ended:

Tag Type Content
LastInterval/State String The state that ended.
LastInterval/StateCode String The values that decided it, as for StateCode.
LastInterval/Start DateTime When it began (the agent’s time; the gateway’s time for an Unavailable interval that the gateway noticed).
LastInterval/End DateTime When it ended (the agent’s time; the gateway’s time when the interval ends because the agent cannot be reached).
LastInterval/Seconds Float8 Its length in seconds.
LastInterval/Time DateTime The same as End, moved to 1 ms after the previous record’s Time when it would not be later, so every record changes it.
LastInterval/Record String The whole interval as one JSON text with the fields state, stateCode, start, end, seconds and time (times in UTC, for example 2026-11-13T10:00:10Z).

An interval in Unavailable is published like any other.

Times are the agent’s, except where the gateway itself noticed an outage (the agent cannot be reached, and the moment it answers again): those are the gateway’s. If the clock of the agent differs from the clock of the gateway, Seconds of an interval that mixes the two differs by the same amount.

Time rises within one run of the stream, also when the agent’s clock goes back. After the stream stops and starts again (or the gateway restarts) the module keeps nothing, so the first Time of the new run can be earlier than the value the tag still shows.

Downtime events

A downtime event is a period outside Running that lasts at least the minimum downtime seconds (module setting, default 60). It starts at the change of state and ends at the next Running. A period shorter than the minimum gives no event.

The length of a period is measured on the agent’s clock, both for DowntimeOpen (checked once a second) and for the event, so a difference between the clock of the agent and the clock of the gateway does not change which stops count. DowntimeOpen goes false when the period ends, also when it turns out shorter than the minimum, for example because the setting was raised meanwhile.

Tag Type Content
DowntimeOpen Boolean True while a period outside Running has lasted the minimum and has not ended.
DowntimeSince DateTime When that period began. It keeps the value of the last open period after it ends.
LastDowntime/Start, LastDowntime/End DateTime Start and end of the last event.
LastDowntime/Seconds Float8 Its length in seconds.
LastDowntime/State String The state it started in: Idle, Setup, Alarm or Unavailable.
LastDowntime/Cause String For an event that started in Alarm, the message of the worst active condition at the start (a fault before a warning), else empty.
LastDowntime/Time DateTime The same as End, moved as for LastInterval/Time.
LastDowntime/Record String The whole event as JSON with the fields start, end, seconds, state, cause and time.

The module has no reason codes. An operator’s reason is entered in your own screen and table.

Reading a record

The single tags are written first, then Time, then Record last. A transaction group or a tag change script on Record therefore sees one complete interval or event each time, also when two follow each other within a moment. Reading the single tags later can show the next record.

When the stream is not available

When the extra features stop being available, nothing more is written: the interval and downtime tags keep their last values and their quality becomes Bad, and nothing is removed. An open downtime period is not closed and not written. If the stream ends on its own while a period is open (the agent refuses the requests), the state becomes Unavailable, which counts as downtime, and DowntimeOpen stays as it was until the stream runs again. When the stream runs again the module starts without memory of that period; the next interval or event that ends is published and the quality is Good again. Machine state switched off for the connection removes these tags.

Scripting functions

Three functions in gateway scope return what the module knows right now. They read values held in memory and never read stored data, so they have no history, no utilization and no downtime list; use Tag Historian on State or your own table for that.

Function Result
system.innorobix.mtconnect.extras.getExtrasStatus() One row for each connection with an extra feature switched on: Connection, Features, ExtrasState, Live.
system.innorobix.mtconnect.extras.getState(connection, device=None) One row for each device: Device, State, StateCode, StateSince, SecondsInState, Alarm. Needs Machine state and downtime on for the connection.
system.innorobix.mtconnect.extras.getActiveConditions(connection, device=None) One row for each active Warning or Fault: Device, DataItem, Code, Level, Message. Needs Condition alarm tags on for the connection. An empty result means nothing is active.

Every function first checks that the extra features are available and raises an error with the text “MTConnect extra features are not licensed on this gateway” when they are not. A missing connection name, a connection with no extra feature on, the feature not switched on or an unknown device raises an error that says which. A connection whose stream is not running, or whose agent cannot be reached, has no live values and raises an error that says so. device is positional: pass it as the second argument, or leave it out (or pass None) for every device. Writing device='Mill1' as a keyword is not supported and raises an error. Right after a stream starts, until its first reading has arrived, the functions raise the same “no live values” error instead of returning an empty result.

Starter project

The module can add a ready-made Perspective project with three views, and a data type (UDT) for the tags of one machine. They hold layout and bindings to the _Extras tags of this chapter and nothing else: no script, no query and no database access. You need the Perspective module on the gateway.

Install it

  1. Open the MTConnect connections page and find the card Extra features. While the extra features are available, the button Install starter project is enabled.
  2. Press it. The module adds the project MTConnect-Starter. It is read-only and can be inherited: you do not edit it, your own project uses it. Pressing the button again replaces the project with the version that comes with the module.
  3. In the Designer, open the Project Properties of your own Perspective project and choose MTConnect-Starter as its parent project. The views appear in the folder MTConnect of your project.
  4. The gateway does not keep the project over a restart, so the module adds it again each time it starts while the extra features are available. If the extra features are not available at that start, the project is missing until they are available and you press the button. While the gateway runs and the extra features stop being available, the project stays and the views show the reason in their status line, with the tags in Bad quality.

The views

View Parameters Shows
MTConnect/FleetOverview machines: a list of entries with connection and device One machine detail for each entry. Replace the sample entry with your machines.
MTConnect/MachineDetail connection, device The state, what decided it, since when, seconds in state, the worst condition and the number of active conditions, and the last downtime event.
MTConnect/Downtime connection, device Whether a downtime is open and since when, and the last downtime event with its start, end, seconds, state and cause.

connection is the name of the connection and device the device folder below _Extras (see “What you get” above for how the folder is named). The status line at the top of each view is StreamStatus of the connection. The views have no timeline; chart State with your own Power Chart or Time Series Chart once it has history (see “Storing history”).

The views bind to the tags through parameters of the view. The gateway accepts the project, but the views were not opened in a Perspective session when this chapter was written: check that the values appear in your own project, and report what you see.

After you update the module the project keeps its old views until you press Install starter project again.

The data type

The button Download data type saves a file for Import Tags in the Tag Browser. It adds the data type MTConnect Device Extras to the data types of the tag provider you import into. The data type has one parameter, base, the path of one device’s folder, for example [MTConnect]Line1/_Extras/Mazak. An instance reads State, StateCode, StateSince, SecondsInState, Alarm, the condition tags, DowntimeOpen, DowntimeSince and the groups LastInterval and LastDowntime from that folder. If the provider already has data types of its own, import with a collision policy that keeps them, or import into a provider that has none.

Storing history

The module stores nothing. The tags show the last record only, and after a gateway restart the interval and downtime tags have no value until the next record. To keep history you use Ignition’s own tools, with your own database. This section shows three ways.

Tag Historian for the state

Turn on history for <connection>/_Extras/<device>/State in the Tag Browser of the Designer: select the tag, set History Enabled, choose your history provider and set the sample mode to On Change. Tag Historian then holds every change of state with its time. A chart (the Power Chart or the Time Series Chart in Perspective) can draw it, and the lengths of the states between two dates give the time the machine was running.

Store State and, if you want it, WorstCondition. Do not store SecondsInState: it changes every second.

A historian row is one value at one time. It does not tell you the cause of a downtime event. For one row per event use the next two parts.

One row per downtime event with a tag change script

This is the recommended way. A gateway tag change script on LastDowntime/Record is meant to run once for every event: the module writes Record last and once for each event. The table and the script below stored two events 100 ms apart as two rows when they ran as a tag event script on a tag that follows Record; check your own gateway with two events a moment apart before you rely on it.

Create the table in your own database first. The times are the UTC text of the record, so the table keeps them as text. The key makes sure that the same event is never stored twice.

CREATE TABLE my_downtime (
    device     VARCHAR(100) NOT NULL,
    start_time VARCHAR(40)  NOT NULL,
    end_time   VARCHAR(40)  NOT NULL,
    seconds    FLOAT        NOT NULL,
    state      VARCHAR(20)  NOT NULL,
    cause      VARCHAR(255),
    PRIMARY KEY (device, start_time)
)

In the Designer, open Gateway Events, Tag Change, and add the tag path [MTConnect]<connection>/_Extras/<device>/LastDowntime/Record, with your connection and device names. Use one script for each machine and list only that machine’s tag path in it: the script stores the device name from its first line, so a script that lists several machines would store them all under one name. Paste this as the script. It is the body of the script, not a function. Change the first line to the device name and MyDatabase to the name of your database connection:

device = 'Mazak'
if not initialChange and newValue.quality.isGood() and newValue.value \
        and (previousValue is None or previousValue.value != newValue.value):
    r = system.util.jsonDecode(newValue.value)
    found = system.db.runPrepQuery(
        "SELECT 1 FROM my_downtime WHERE device = ? AND start_time = ?",
        [device, r['start']], 'MyDatabase')
    if len(found) == 0:
        system.db.runPrepUpdate(
            "INSERT INTO my_downtime (device, start_time, end_time, seconds, state, cause) "
            "VALUES (?, ?, ?, ?, ?, ?)",
            [device, r['start'], r['end'], r['seconds'], r['state'], r['cause']], 'MyDatabase')

The fields of the record are start, end, seconds, state, cause and time. The script reads Record and nothing else, so it always stores one complete event. The check before the insert and the key of the table keep an event that is delivered twice from being stored twice.

The same script works on LastInterval/Record for every state interval. The fields there are state, stateCode, start, end, seconds and time, and the table needs a column for each field you store.

Ignition runs the script only while the gateway runs. An event that ends while the gateway is stopped is not stored, and the module replays nothing after a restart. A script that fails raises an error in the gateway log and stores nothing for that event.

A transaction group

A transaction group needs the SQL Bridge module. A Standard group runs on its own timer, 1 second by default, and tests its trigger once for each run. When two events arrive between two runs, the group stores one row and the other event is lost. Use a group only for downtime events, which are seconds or minutes apart, and set its execution rate well below the shortest time between two events.

In the Designer make a Standard group on your own table, with the update mode Insert. Use the trigger setting “Use trigger” on the tag LastDowntime/Record with the trigger condition “Value changed”. Add the tags Start, End, Seconds, State and Cause of LastDowntime as items and map each to a column of the table. The group reads the single tags when it runs, so the row can show the next event when two events arrive close together. Check the result with two events a moment apart before you rely on the group. For one row per event, use the script.

Redundant gateways

The choices of extra features and the settings are stored on each gateway of a redundant pair, as the connections are. Enter them on both gateways. Which of your own tag history, scripts, groups and the starter project reach the backup gateway is decided by Ignition’s redundancy synchronisation, not by this module. The module’s own project MTConnect-Starter is installed with the button on the gateway where you press it; check on the backup gateway that the project exists there before you rely on it.

Extra features and your licence

  • The extra features are included in the trial. On a licensed gateway they run when your licence includes them. Without them the Extra features step of the connection dialog shows each feature disabled, marked ($), with the text how to add them. Everything else in the module works as before.
  • You can always switch a feature off. You cannot switch one on while the extra features are not available; the page answers with the text “MTConnect extra features are not licensed on this gateway” and nothing is saved.
  • When the licence ends, or the licence does not include the extra features, the module stops publishing. The tags below _Extras keep their last values and go to Bad quality, nothing is removed, and the scripting functions and the starter project installer answer with the same text. When they are available again, the next event is published.

Tags of a connection

Besides the tags of each device, a connection with a feature switched on has these tags below <connection>/_Extras/, and one more status tag below <connection>/_Status that lists the features switched on:

Tag Type Content
StreamStatus String Starting, Running, Retrying in <n> s after: <reason> or Stopped: <reason>; while the extra features are not available it holds the reason.
GapCount Int4 How many times the module lost observations or resynchronised. It never counts down while the gateway runs.
LastSequence Int8 The last agent sequence number the module has covered.
LastGapTime DateTime The gateway time of the last gap.
LastGapReason String InstanceIdChanged, BufferOverrun, OutOfRange or ConnectionLost.

Requirements

  • The agent must answer the standard /sample request. For a connection with an extra feature on, the module sends GET /sample to the same host and port as the connection, once for each sample interval, and nothing but GET requests. The sample interval, the sample count and the minimum downtime seconds are set on the card Extra features of the connections page.
  • The starter project needs the Perspective module. A transaction group needs the SQL Bridge module. Tag history needs a history provider. The tables of “Storing history” are in your own database.
  • On a redundant pair, enter the choices on both gateways (see “Redundant gateways”).

First steps

  1. Open the connection in the connections page and go to step 3, Extra features. Switch on Machine state and downtime, Condition alarm tags, or both, and save.
  2. Wait for the first reading. Browse <connection>/_Extras/<device>/State in the Tag Browser; StreamStatus says Running.
  3. Press Install starter project on the card Extra features and set the parent project of your Perspective project (see “Starter project”).
  4. Turn on history for State, or add the table and the script of “Storing history”, to keep what happens.

Generated from the module's documentation for version 8.14.0. Questions: contact us.