Skip to content
Start free evaluation

GEM state models

GEM (Generic Equipment Model, SEMI E30) defines how equipment must react to SECS-II messages. At its core are two state models. The communication state model says whether host and equipment are ready to talk SECS-II; the control state model says whether the host may control the equipment remotely.

HSMS connection state and GEM state are separate. An HSMS connection can be selected while GEM communication isn’t established yet, and GEM communication can be established while the equipment is off-line.

This is the SEMI E30 Communications State Model:

DISABLED ENABLED
+-----------------------------------------------+
| NOT COMMUNICATING |
| +-------------+ +----------------+ |
| | WAIT CRA | ------> | WAIT DELAY | |
| | (S1F13 sent)| <------ | (retry later) | |
| +------+------+ +----------------+ |
| | S1F14 COMMACK=0 |
| v |
| COMMUNICATING |
+-----------------------------------------------+
  • Communication is established with an S1F13 request and an S1F14 reply. Either the host or the equipment can send S1F13.
  • A COMMACK of 0 in S1F14 accepts; 1 denies.
  • If the equipment’s S1F13 gets no reply or is denied, the equipment waits a while (WAIT DELAY) and tries again.
  • While NOT COMMUNICATING, only the establish-communications messages are exchanged.

PDComm reports the communication state with these values (PDCOMM_GEM_* in C, GemCommunicationState in .NET):

Value C constant .NET name Meaning
0 PDCOMM_GEM_DISCONNECTED Disconnected The HSMS connection isn’t selected.
1 PDCOMM_GEM_NOT_COMMUNICATING NotCommunicating The connection is selected, but communication isn’t established.
2 PDCOMM_GEM_WAITING_ACK WaitingAck S1F13 is out and the endpoint waits for S1F14 (WAIT CRA in E30).
3 PDCOMM_GEM_COMMUNICATING Communicating Communication is established.

So gem=3 from the tutorial’s state command means COMMUNICATING.

PDComm never starts communication on its own, and it has no internal thread or retry timer:

  • To establish communication, call pdcomm_gem_begin_communication (GemEndpoint.BeginCommunication in .NET). A host sends S1F13 with an empty list; equipment sends its model name and software revision.
  • A COMMACK of 0 produces the result CommunicationEstablished. Any other value produces CommunicationRejected and the state returns to NOT COMMUNICATING. So does a missing reply after T3.
  • After a delay, retry by calling the function again at an interval you choose.
  • When the peer sends S1F13, PDComm answers with COMMACK 0 and moves to COMMUNICATING.
  • Equipment doesn’t process other primary messages before communication is established. Their results carry the state error code PDCOMM_GEM_ERROR_STATE.

The SEMI E30 Control State Model governs how much control the host has:

OFF-LINE ON-LINE
+----------------------------------+ +--------------------------+
| EQUIPMENT OFF-LINE | | LOCAL |
| | operator: go on-line | | ^ |
| v | | | operator switch |
| ATTEMPT ON-LINE --(S1F1/S1F2)----------->| v |
| | no answer | | REMOTE |
| v | | |
| HOST OFF-LINE <----- S1F15 --------------- |
| | | | |
| +-------- S1F17 -------------------> (LOCAL or REMOTE) |
+----------------------------------+ +--------------------------+
  • EQUIPMENT OFF-LINE: the operator has taken the equipment off-line. Host requests to go on-line are refused. The operator’s OFF-LINE switch returns the equipment here from ON-LINE and from HOST OFF-LINE; the diagram leaves out those arrows.
  • ATTEMPT ON-LINE: after the operator chooses on-line, the equipment sends S1F1 to check for the host. An S1F2 reply puts it ON-LINE.
  • HOST OFF-LINE: the equipment wants to be on-line, but the host keeps it off-line. An S1F17 from the host puts it ON-LINE.
  • ON-LINE LOCAL: the host can read status and receive data, but remote commands that make the equipment act are restricted.
  • ON-LINE REMOTE: the host can control the equipment with remote commands. The operator’s REMOTE/LOCAL switch moves directly between LOCAL and REMOTE.

The host’s requests and their reply codes:

Request Reply Reply code
S1F15 Request OFF-LINE S1F16 OFLACK 0: acknowledged
S1F17 Request ON-LINE S1F18 ONLACK 0: accepted, 1: not allowed, 2: already on-line

An equipment endpoint reports these control states (PDCOMM_GEM_* in C, GemControlState in .NET). A host endpoint has no control state; it reports PDCOMM_GEM_CONTROL_UNAVAILABLE.

Value C constant .NET name
0 PDCOMM_GEM_EQUIPMENT_OFFLINE EquipmentOffline
1 PDCOMM_GEM_ATTEMPT_ONLINE AttemptOnline
2 PDCOMM_GEM_HOST_OFFLINE HostOffline
3 PDCOMM_GEM_ONLINE_LOCAL OnlineLocal
4 PDCOMM_GEM_ONLINE_REMOTE OnlineRemote

A PDComm equipment endpoint moves between them as follows:

Trigger Transition Reply
Start The initial control state from the options. AttemptOnline isn’t allowed as the initial state.
Operator on-line (OperatorOnline) EQUIPMENT OFF-LINE → ATTEMPT ON-LINE; sends S1F1 An S1F2 reply leads to LOCAL or REMOTE, depending on the online mode.
S1F1 fails, or the connection drops during the attempt ATTEMPT ON-LINE → HOST OFF-LINE
Operator off-line (OperatorOffline) ON-LINE or HOST OFF-LINE → EQUIPMENT OFF-LINE. Sends no message and needs no connection. Not available during ATTEMPT ON-LINE.
Operator REMOTE/LOCAL switch (SetOnlineMode) While ON-LINE, switches between LOCAL and REMOTE at once. In the OFF-LINE states, selects the state entered at the next ON-LINE transition.
S1F15 received ON-LINE → HOST OFF-LINE OFLACK 0
S1F17 received while HOST OFF-LINE → ON-LINE (LOCAL or REMOTE) ONLACK 0
S1F17 received while already ON-LINE No change ONLACK 2
S1F17 received while EQUIPMENT OFF-LINE or ATTEMPT ON-LINE No change ONLACK 1

You can change the online mode (LOCAL or REMOTE) in any control state with GemEquipment.SetOnlineMode. It’s a local operator action, so no message goes to the host. The tutorial equipment starts HOST OFF-LINE in REMOTE mode, so when the host’s online command sends S1F17, the equipment becomes ON-LINE REMOTE.

Read the current state with pdcomm_gem_state (GemEndpoint.GetState in .NET). The state holds the role, communication state, control state, online mode and connection generation.

Data collection, events, alarms and remote commands build on these state models. See GEM capabilities.