Skip to the stories
Robotics & Automation

FactoryTalk Optix Handshakes Coordinate PLC and C# Data Operations

  • Michal Gumulak
  • 925 reads

FactoryTalk Optix uses variable change events and C# handshakes to confirm tasks between a PLC and Optix, whether either side initiates the operation.

FactoryTalk Optix Handshakes Coordinate PLC and C# Data Operations

FactoryTalk Optix can coordinate PLC tag changes with database operations and other C# tasks using a handshake that tracks whether each side has completed its part. The design addresses a common integration gap: a standard PLC may not detect when external software reads or writes its tags, so a value change alone may not confirm that the associated work has finished.

The pattern has two forms. A PLC tag change can trigger an Optix function, which runs a task and reports completion to the PLC. Or Optix can start a task, signal the PLC, and wait for the PLC to acknowledge receipt. DMC engineers Ben Clare and Otto Gottlieb presented this approach at Rockwell Automation Fair 2026. The examples below show how variable change events and custom C# NetLogic connect the two sequences.

PLC changes can trigger Optix tasks

In the first arrangement, the model object variable PhaseL1Filling.StartSent, of type Phase, is bound to a PLC tag. When the PLC changes that tag, Optix updates the variable. A variable change event on the object then calls the StartPhase method in the StartPhaseService C# class.

Diagram showing a PLC tag change initiating an action in Optix.

The method extracts the Phase object that triggered it and calls the handshake function. It is marked with Optix’s [ExportMethod] attribute, allowing the application to invoke it through the configured event. The service class supplies the task that the handshake will run. In the example, the derived StartPhasesService class overrides TaskToRun to record a phase start time in a database. The same structure can be assigned other C# work, such as updating another tag.

FactoryTalk Optix Phase object PhaseL1Filling with a change event configured on its StartSent property.
C# snippet defines an exported StartPhase method in FactoryTalk Optix NetLogic that retrieves a Phase node and triggers a handshake task.
C# code defines StartPhasesService, which inherits from BaseEnumerationHandshakeService and overrides TaskToRun to record a phase start time in a database.

The base class, BaseEnumerationHandshakeService, processes the handshake values. In this implementation, a value from 1 through 9 tells Optix to run the assigned task using RunTaskAndSetReceived. Once the task has run, that function sets a received bit for the PLC, giving the controller an explicit indication that the work completed.

ProcessHandshakeAndRunTask handles handshake states to reset a status bit or launch a task.
C# RunTaskAndSetReceived method executes a task and updates the received bit.

The PLC then acknowledges that response with a value from 10 through 19. Optix processes that final state and resets its received bit, completing the exchange. The important feature is the sequence of confirmations: the initiating tag change starts the work, Optix signals task completion, and the PLC acknowledges that signal. The specific value ranges are part of this example’s implementation, not a universal handshake convention.

C# code validates the PLC handshake and resets the received bit.

Optix can initiate the exchange

The second arrangement reverses the direction of initiation. Here, an Optix object called PalletPrinter starts the procedure rather than waiting for a PLC-bound variable to change. Optix runs its backend C# logic and writes the sent value to the PLC. The sent and received bindings are arranged for this direction of operation.

Diagram showing Optix initiating a tag change action on a PLC.
PalletPrinter1 configuration.

Unlike the first example, the task does not wait for an incoming handshake value before it runs. The backend calls RunTaskAndSendHandshake, which starts an asynchronous task and sends the handshake to the PLC. That signal tells the controller that Optix has initiated the operation.

RunTaskAndSendHandshake runs an asynchronous task and sends a handshake to the PLC.

After receiving the signal, the PLC returns an acknowledgment through ScanReceived. A variable change event on that value invokes ProcessPrinter1ReceivedHandshake, which uses the base class’s ProcessHandshake logic. The function resets the sent bit, closing the exchange and confirming that the PLC responded.

ProcessHandshake processes a handshake signal and resets the sent bit.

Use the sequence to match the application

Both examples use a pair of status signals to make task progress visible across the Optix and PLC boundary. Their order depends on which system starts the work. With a PLC-triggered event, Optix receives the changed value, runs its task, signals completion, and waits for the PLC’s acknowledgment. With an Optix-triggered event, Optix runs its task and sends the handshake, then processes the PLC’s acknowledgment.

That distinction matters when choosing where to place event handling and what each bit means. A tag update can trigger work, but the handshake adds confirmation that the task ran and that the other side registered the result. The code shown is a general implementation pattern; its description does not cover every error-handling case. For a real application, the task, state values, and reset behavior need to fit the equipment’s communication sequence. Database writes, PLC tag updates, and other C# operations can all use the same basic coordination model when their completion needs to be acknowledged.

Source: Michal Gumulak · www.dmcinfo.com

From the same set