Article sections
How are image processing results transferred to the production line?What do PLC, HMI, SCADA, and MES do?Why is a handshake protocol necessary?How do you choose between digital I/O, Modbus TCP, and OPC UA?How is product identity preserved?Encoder and rejection-point timingFail-safe policy on connection lossWhat information is useful for SCADA and HMI?How is traceability achieved with MES?Which error codes should be defined?Should we test only with a live PLC?Fault scenarios in an example handshake cycleCommissioning checklistHow should fields be defined in the PLC data contract?Race conditions and duplicate messagesPresenting decisions safely on the HMI screenHow do we send every result reliably to MES?Why do OPC UA security settings matter?How is success measured in the physical rejection mechanism?The scope of FAT and SAT testingHow is identity preserved when a product passes multiple cameras?PLC scan cycles and network latencyReestablishing a valid state after a connection outageThe difference between a SCADA alarm and a quality alarmWhy should MES records include both event time and recording time?Joint testing by PLC and AI teams during change managementHow do you write the contract between a PLC and a computer vision application?When does a timeout start, and who decides?Separating MES records from production decisionsSimply saying 'OK/NG was received' is not enough for acceptance testingExample fault matrix: why do three events require three different responses?How do we define data fields at the PLC–vision system interface?In what order should a handshake cycle proceed?Who takes responsibility for OPC UA certificate management?How should missed products, late results, and physical rejection failures be reported?Frequently asked questionsHow are image processing results transferred to the production line?
The value of an image processing system in production comes not from the model finding a defect, but from associating that defect with the correct product and the correct action. When the camera sees a defective part, it sends the result to the PLC; the PLC can activate the separator at the appropriate position. The same event can be displayed on the HMI screen, contribute to statistics in SCADA, and be added to the product's traceability record in MES. These systems are not all the same thing.
The most critical issue in production integration is product identity and timing. The model may produce results for two products in a different order. There is a window between the moment the PLC makes its decision and the product reaching the rejection point. Even if the result is correct, applying it to the wrong position in the sequence can reject a good product and let a defective one pass. Integration should therefore be designed around the data contract and the timing of the physical process first.
What do PLC, HMI, SCADA, and MES do?
PLC (Programmable Logic Controller) is a class of industrial controller that reads sensors, executes logic and timing rules, and controls field outputs. An HMI allows the operator to view machine status and issue permitted commands. SCADA can provide monitoring, alarms, trends, and supervisory control for one or more devices/lines. MES handles production orders, product traceability, workflows, and quality records.
Writing the image processing application's high-resolution mask or an entire raw image into PLC registers is usually not a sound design. The PLC needs product identity, a decision code, validity, and readiness information; detailed images, classification heatmaps, and investigation records can be stored in suitable data infrastructure. Instead of sending raw frames to SCADA and MES every millisecond, provide an event summary and, where needed, a link to evidence.
Machine control and the enterprise record system operate at different speeds. If the process permits it, local quality control can continue during a short MES outage. However, losing the camera or PLC connection directly affects decision reliability. Define a separate policy for each type of outage.
Why is a handshake protocol necessary?
Simply sending a result by changing a single OK bit is risky. The PLC may mistake an old bit for the new product's decision, the AI software may not know whether the PLC has read the result, or a delayed message may be processed in a new sequence. A handshake protocol is therefore used to define triggering, busy, result-ready, result-identity, and acknowledgment (ACK) states.
An illustrative sequence might be: the PLC issues a Trigger and adds a sequence number; the vision application reports Busy=1; the image is processed; ResultReady=1, ResultID and Decision are sent; the PLC accepts the result with a valid identity and asserts Ack; the application returns to the ready state. This single example arrangement need not be copied into every facility, but similar states must be explicitly defined.
Each handshake state's timeout rules must be defined separately. What will the system do if the PLC does not respond within 100 ms? If the ACK message is lost, will the vision application resend the result? If it is resent, could the same valve be triggered a second time? A good protocol addresses these uncertainties using the product sequence number and an idempotent acceptance rule.
How do you choose between digital I/O, Modbus TCP, and OPC UA?
Digital I/O provides low complexity for simple trigger, ready, and alarm signals, but does not carry a rich message structure. Modbus TCP can be a common, understandable option for register-based data exchange; the application defines what each register means, byte order, and consistency rules. OPC UA can provide richer information exchange between systems through its address space, data models, client/server concepts, and subscriptions.
The suitability of a protocol cannot be assessed independently of the PLC brand. Consider the existing OT network, control cycle time, certificate/security requirements, maintenance personnel's expertise, and other systems' expectations. Using OPC UA alone does not guarantee functional safety; critical safety functions must not be delegated to a general-purpose AI application.
Why does the data model matter in OPC UA?
Over OPC UA, a structured object such as QualityResult can be defined with the following fields: ProductID, Decision, Confidence, Timestamp, ErrorCode, ModelVersion. When the types, update frequencies, and consistency of these fields are known, integration by other teams becomes easier. However, if network latency or the subscription interval cannot meet time-critical actuator control requirements, the decision path may require a more suitable hardware connection.
How is product identity preserved?
The system must know the physical product's position on the conveyor. A photoelectric sensor, encoder counter, product carrier ID, or PLC sequence number can be used. If the decision message contains only NG=true, there may be confusion about which product to remove. Product ID, trigger event, camera frame ID, and result ID must therefore be linked.
For example, suppose product 105 passes the camera, followed immediately by 106. If the image of 106 is processed faster, its result may return first. An error occurs if the result for 106 is then applied on the assumption that the next physical product is 105. The identity-linked decision is compared with the product identity expected by the PLC; if they do not match, application of the stale result is prevented.
Encoder and rejection-point timing
Even on a constant-speed conveyor, small speed variations can occur. If the distance between the camera and rejection point is known, the theoretical decision window is calculated from belt speed: 400 mm / 800 mm/s = 500 ms. However, valve opening time, air pressure, product length, encoder resolution, and friction effects must be checked in the physical system. Triggering the valve after a fixed delay may be sufficient on some lines, but can cause misalignment when speed changes.
The PLC often tracks the product's physical position with an encoder, while the AI application only produces a decision code. This separation keeps motion control on the PLC side. If the vision system must directly time valve activation, fault analysis and safety requirements become more complex.
Fail-safe policy on connection loss
The term fail-safe does not mean 'reject every product' in every system. Different safe states may be appropriate depending on human safety, machine damage, product safety, cost, and process risks. On camera loss, some lines must stop, while others may divert all products to manual inspection. On loss of the MES connection, a suitable recording queue and subsequent synchronization may be acceptable. These decisions are defined together with the process and safety owners.
The critical distinction is this: general-purpose image processing/AI software is not a certified safety controller. Emergency stops and protective safety functions must reside in separate control infrastructure compliant with the applicable standards. A vision system fault may trigger a transition to a safe mode, but how that transition is implemented must be validated for the specific process.
What information is useful for SCADA and HMI?
Showing numerous technical model scores on the operator screen often makes decision-making harder. A good HMI clearly presents information such as product status, defect region, error code, camera health, and the reason for manual inspection. A display such as 'The model is 0.73% confident' can be misunderstood; a score must not be presented as an exact probability if its calibration has not been validated.
On the SCADA side, useful indicators include hourly rejection rate, camera connection status, average and p99 latency, timeout count, and device temperature. However, a rise in the daily rejection rate alone does not mean the model has deteriorated: the material batch may have changed, or the actual number of defects may have increased. Operational interpretation should be based on data and process knowledge.
How is traceability achieved with MES?
MES can associate the quality decision with the production order, lot, station, operator, and product serial number. The vision system's decision record can include the model version, configuration hash, and a link to an example evidence image. While the time-critical result is transferred quickly and reliably to the PLC, the record destined for MES can be sent later. However, record ordering and duplicates must be controlled.
Some production processes may require a photograph of the defect to be stored; others may retain only selected samples. The data retention policy balances retrospective quality investigation against disk/network capacity. Preventing unauthorized changes to production parameters and restricting access to images are also part of integration.
Which error codes should be defined?
CAMERA_MISSING, FRAME_INCOMPLETE, INFERENCE_TIMEOUT, INVALID_PRODUCT_ID, PLC_ACK_TIMEOUT, CONFIG_MISMATCH are examples of distinctions that can speed up debugging. Stable, documented codes prevent operators from being left with a 'general error' message. Define each code's impact on production, priority, retry limit, and responsible team.
A stopped camera stream, a temporarily unavailable MES, and a PLC failing to acknowledge may have different alarm levels. However, this example classification should not be copied directly into a live facility; the facility's risk analysis and acceptance criteria must be the basis.
Should we test only with a live PLC?
No. During development, a PLC emulator or simulation can be used to test valid and invalid message sequences. For example, have the PLC request the result twice, delay the ACK, reconnect, or supply a product ID different from the expected one. You can verify how the software behaves in these situations without producing an incorrect decision. An emulator may not fully represent actual input/output timing; final acceptance must be performed on real hardware.
Test levels should be separated: unit tests, protocol contract tests, integration tests, FAT/SAT with the live line, and load/fault tests. Each level finds different errors; one does not replace another. Safety function validation in particular must be performed with appropriate expertise and standards.
Fault scenarios in an example handshake cycle
Suppose the system enters the Busy state when a Trigger arrives. If model execution takes longer than expected, a Timeout occurs. If the old model result arrives afterward, it must not be applied to the next product. This behavior is managed by checking the product ID and validity in the message. If the PLC reads the same decision again, the valve's physical action must not be triggered twice.
Similarly, if the PLC restarts, its previous ACK state may be lost. When the application reconnects, the last sequence numbers processed by both sides can be compared; products with uncertain status are not automatically considered good. Such situations may be very rare in the field, but they can be costly when they occur.
Commissioning checklist
For the product under test, the photoelectric trigger record, camera frame ID, decision message, PLC acceptance message, physical separation result, and MES trace record must reference one another. Test p95/p99 latencies at line speed and demonstrate that the system returns to a valid state after a network interruption. Operators and maintenance personnel should recognize the error codes and be able to follow the restart procedure.
On the first day, shadow mode can be used to monitor differences between human and automated decisions, followed by controlled activation of physical separation. However, shadow mode does not validate the correct timing of the product separation mechanism. Production acceptance therefore consists of more than software tests or a model accuracy report.
How should fields be defined in the PLC data contract?
An illustrative decision contract may include StationID, ProductID, Sequence, Timestamp, Status, Decision, ErrorCode, ModelVersion and AckSequence fields. Document each field's data type, unit of measurement, valid range, and impact on production behavior. In particular, if Decision=OK and Status=TIMEOUT can arrive simultaneously, define how this contradiction will be resolved. Ambiguous states must not silently be treated as good products.
Decision enum values can be more descriptive than binary bits: PASS, REJECT, REVIEW, UNKNOWN. However, the codes used in the protocol must be compatible with the facility. If the PLC's existing communications infrastructure supports two bits, reliable state encoding, error information, and validity information must be designed separately. When the data contract changes, test PLC and HMI behavior together with the AI application, not just the application alone.
Race conditions and duplicate messages
If the PLC generates a new trigger just before receiving the result, the old decision and the new product's state may become mixed up. ResultReady is a bit that, if held high for a long time, may allow the same result to be read in multiple cycles. The bit-level protocol must therefore explicitly specify the rising edge, state transitions, result sequence, and ACK ordering. Simply stating 'the PLC reads it' does not sufficiently explain repetition behavior.
During a timeout, it may be unknown whether the message reached the receiver. When the software resends it, the PLC must not produce two physical actions. Idempotent acceptance logic based on product identity and sequence number reduces this risk. Validate this design using repetition and delay tests in the emulator, followed by tests on the actual PLC.
Presenting decisions safely on the HMI screen
For the operator, the most critical information is the product's final state and the action required. Displaying the model score in large type can create a false sense of certainty. Instead, the screen can show the suspicious region marked in the image, defect type, who made the decision, manual inspection instructions if needed, and the event identity.
An HMI displaying a stale image as though it belongs to a new product is a significant source of confusion. Add product identity and a timestamp to each image, and preserve the distinction between the 'last image' and the 'latest live decision' when the display connection temporarily drops. If manual override is available, an authorized role and an audit record must be mandatory.
How do we send every result reliably to MES?
It is normal for records sent to MES to be processed at different speeds from the industrial control cycle. A local event queue, holding records during an outage, and safely resending them when the connection returns can therefore be considered. However, the queue must not consume disk space without limit, and authorization and data retention rules must be maintained.
Product IDs and event IDs make deduplication easier on the MES side. If the same record is delivered twice, the production report must not double the defect count. A record being accepted and persistently stored may have different meanings; the integration contract must state this explicitly. Deviations in chronological order can be corrected using event identity, but missing records must not be silently ignored.
Why do OPC UA security settings matter?
OPC UA has security features, but a poorly configured server may not take advantage of them. Certificate validation, authentication, access permissions, and network segmentation must be part of the design. Leaving an anonymous, insecure connection used for convenience during development unchanged in production can create serious risks.
Even so, an encrypted connection alone does not provide industrial safety. Functional safety requires physical risk analysis, appropriate hardware, a control program, and testing. Secure communication and a machine's ability to stop hazardous movements are different disciplines.
How is success measured in the physical rejection mechanism?
Sending the PLC a REJECT message at the correct time does not mean that the product was actually separated. Air pressure may have changed, the valve may have jammed, or the product may have shifted. Therefore, where possible, monitor the physical outcome using a verification sensor after the rejection point or another traceable mechanism. An incomplete rejection action must be treated as a separate production quality fault.
If products are too close together on the conveyor, the valve's action duration may also affect the next good product. This situation requires consideration of product length and the mechanical action window in addition to the simple d/v timing calculation. Acceptance testing must cover the actual speed range, different product masses, and air pressures.
The scope of FAT and SAT testing
During FAT, the protocol contract, emulator, defined product scenarios, and fault conditions can be checked. SAT is performed with the actual camera, PLC, conveyor, valve, and site network. The purpose of the two tests is not to replace each other: FAT reduces integration errors that are easier to detect in the laboratory, while SAT validates the physical system's behavior.
Two simultaneous triggers, ACK loss, late results, camera connection faults, MES outages, PLC restarts, and normal operation should each be separate test cases. For every test, record the expected production state, observed behavior, and the authorized person accepting it. A 'passed' note is not sufficient evidence without stating the conditions under which the test was performed.
How is identity preserved when a product passes multiple cameras?
On a production line, a product may pass first under a top camera, then a side camera, and finally through the rejection station. Each camera produces a separate image. If the final decision is generated solely by combining images according to their sequential indices, changes in belt speed or retriggering may mix up products. The PLC's product sequence number, encoder position, or carrier identity can therefore serve as a shared reference.
For example, suppose product 1203 passes through two stations and its image at the second station is delayed. The system must not assign the side image of 1204 to 1203. The camera event can be recorded with StationID, ProductID, TriggerID and time information. If the images required for the decision are not all available, create an explicit incomplete-inspection state.
This approach has physical limits: if products touch on the conveyor, the photoelectric sensor may not be able to count individual products. Such situations may require mechanical separation, an encoder, or another identification technique. Software cannot eliminate physical uncertainty through assumptions alone.
PLC scan cycles and network latency
The PLC control program reads inputs and updates outputs in defined cycles. The cycle in which the PLC sees a decision arriving over the network depends on the communications configuration and application design. Sending a network request in 3 ms therefore does not mean the valve was triggered in 3 ms. The PLC scan cycle, message reading, state validation, output change, and actuator response are separate timing elements.
When testing a product decision, examine the vision application's timestamp, the PLC event log, and, where possible, the physical actuator signal. If different clock systems are used, time alignment is necessary. If the control cycle changes under load, include worst-case timing in the report.
Reestablishing a valid state after a connection outage
When the PLC connection drops, the two sides may remember different last-processed product numbers. On reconnection, simply seeing Connected=true is not enough. First compare the protocol version, station state, and sequence number against the expected values, and decide whether results in the old queue remain valid.
For example, if a product's decision deadline has passed by the time reconnection occurs, sending the result may be physically meaningless and risky. Such an event can be retained in the audit log as a 'late decision', but must not be applied to a new product's output. This distinction requires the automatic retry policy to be designed together with product traceability.
The difference between a SCADA alarm and a quality alarm
Loss of the camera connection is a technical fault alarm; an increase in the defective-product rate may be a quality or process alarm. Although both appear on the operator screen, their causes differ. In the first case, the vision system may not be working; in the second, production may genuinely be producing more defective parts. The alarm hierarchy should help identify the source of the problem.
Directly converting a low confidence score from the image processing model into a PLC safety alarm may not be appropriate. Decision uncertainty may justify routing a product for quality inspection. A machine emergency stop, however, is managed through separate risk analysis and safety control.
Why should MES records include both event time and recording time?
A product may have been inspected at 10:00, but its record sent at 10:05 because the MES connection was down. If only the time of writing to MES is stored, the actual production order of events is lost. The inspection event time and the time of persistent recording in the central system can therefore be retained separately. Synchronization between the two clock systems also matters.
Retrying a data write must not create the same event twice. Idempotent writes using a unique event identity can improve record integrity. However, disk and queue management must also be considered to prevent record loss; an identity alone does not recover missing data.
Joint testing by PLC and AI teams during change management
Changing the model threshold may leave the PLC message format unchanged but increase the rejection rate and thus the valve's workload. Conversely, a small change in the PLC protocol can cause product decisions to be mismatched even when the model has not changed at all. Both teams must therefore assess together how changes affect each other.
Joint acceptance tests validate product identity, decision time, actuator action, alarms, MES records, and rollback. The production owner decides which risks are acceptable. Reliable integration means not just successful data transmission, but traceable verification of physical outcomes.
How do you write the contract between a PLC and a computer vision application?
The heart of integration is not a connection library, but a data and state contract explicitly defining what each side expects in each situation. Readiness, processing activity, product identity, result validity, and result acknowledgment are distinct concepts. For example, the Ready signal should indicate not that the application has started, but that the camera, model, configuration, and PLC connection have been verified. Busy indicates that processing is ongoing. ResultReady indicates that the result for a specific product is fixed and ready to read; Ack is the agreement that the PLC has received this result.
These names are not a universal protocol requirement; a different state machine can be built to suit each system's needs. What matters is defining the transition order, timeouts, and restart states. If, after the PLC receives the result, the computer clears the ResultReady signal too early, the PLC scan cycle may miss the result. Conversely, holding the signal longer than necessary risks the same decision being read for a second product. The state machine must be designed together with edge detection, sequence numbers, and acknowledgment semantics.
Particularly in an asynchronous GPU job queue, the results for two products can complete out of order. The PLC side needs a product number or a station-managed pending-product table to associate each result with the correct product. A result of just 0 or 1 is not enough. A physical rejection command generated without matching the product is not rescued by being based on the correct model; the wrong product may be rejected.
When does a timeout start, and who decides?
A timeout becomes meaningful only when its starting point in the event sequence is defined. A delay of 50 ms after the camera trigger is not the same as the time allocated to a frame waiting on the GPU. The budget must include PLC scan time, network latency, and the actuator's mechanical response time. A separate duration can be considered for each state: an image-wait limit, decision-computation limit, message-acknowledgment limit, and physical-separation limit. Tying all of these to one general '5-second timeout' hides the critical issue.
Fail-safe behavior depends on the production process's risk analysis. On some lines, automatically separating uninspected products on communication loss is appropriate; on others, a controlled stop is required. The costs of false rejection and letting defective products pass, operator safety, and the process's physical hazards must be considered together. The AI application must not take over PLC safety functions; safety-related stops and mechanical movements must remain within authorized automation and safety design.
For safe commissioning, verify that the PLC does not read an old result as a new one when the application restarts. If the camera, model, or network is not ready, the computer incorrectly asserting Ready=1 is a startup sequencing defect. After power is lost and restored, the system must not resume production control until the required tests and synchronization are complete.
Separating MES records from production decisions
The quality event sent to MES is designed to let an operator later trace which station processed a part and what decision was made. This record may include product/lot identity, a measurement or defect code, decision time, machine, model version, and an image reference where needed. But if a response from the MES service becomes a mandatory condition for the immediate rejection command for every product, a temporary network problem can affect production. If actual process requirements permit, loosely coupling local decisions and the enterprise archive is more resilient.
In a store-and-forward approach, events are written locally to a durable queue and transferred when the connection returns. Since the same event may be resent, duplicates must be prevented on the MES side using a unique event key. Define local disk capacity and the data loss policy for outages lasting hours. Transferring thousands of events when the network returns must not overwhelm live PLC traffic; separate priorities or bandwidth limits can be considered.
Sending the same raw image to both SCADA and MES is unnecessary in most applications. SCADA generally focuses on monitoring line status, error codes, and important measurements, while MES preserves production and traceability context. Images can be retained in a suitable file archive when needed, with an access-controlled link added to the event record. Each system then performs its own role, reducing unnecessary dependencies.
Simply saying 'OK/NG was received' is not enough for acceptance testing
Predefined fault scenarios must be tested for PLC integration: behavior when the same product result arrives twice, an alarm when a product number is skipped, the safe state on connection loss, resending when the PLC acknowledges late, the error code when the camera drops a frame, prohibition of action when a late result arrives, and correct matching of the first product after a restart. Tests should begin with simulation where possible, but must also be validated with the physical separator and actual PLC scan behavior.
The acceptance report measures not only average transmission time but also the correctness and timeliness of the decision applied to the actual product. The rejection valve's opening time, the product's passing position, and separation success can be linked to the camera result and PLC event. Electrical and pneumatic faults are tested in a controlled manner within safety limits. Without this evidence, correctly sending a software message does not prove that the production system works correctly.
Example fault matrix: why do three events require three different responses?
At an inspection station, the first type of fault is an image never arriving. Here, the camera trigger counter has increased but no frame has been produced. The second fault is a model timeout despite successful image acquisition. The third is a model decision being produced on time but failing to reach the PLC. Showing all three to the operator as the same 'camera error' makes diagnosis harder. Separate error codes make it clear which subsystem needs to be checked.
In the first case, the camera connection, lighting trigger, SDK buffer, and acquisition counter can be examined. In the second, GPU load, queue waiting time, and model execution time are measured. In the third, the network, OPC UA session or digital I/O, PLC scan, and acknowledgment mechanism are examined. All can affect the quality control decision, but they require different corrective actions. The HMI should show the error description, product identity, and a safe operator action.
Another scenario is a product identity mismatch. Even if the model correctly detects a scratch, associating the result with the previous part produces an incorrect quality decision. If the system can detect this event, no product should automatically be assumed to be OK. The physical decision to take for a missing identity or timeout must be approved with the automation and process team. Leaving a silent default value in the software is unacceptable.
Finally, MES connection loss is handled separately from the decision path. If data affecting the quality decision can be preserved through local recording, the line may continue in a controlled manner; however, legal or customer traceability requirements may prohibit production without a connection. This distinction is determined by risk and operating conditions. Rather than dismissing every event with the same term 'fail-safe', the test document must specify the concrete state to be applied and the responsible parties.
How do we define data fields at the PLC–vision system interface?
Before project handover, there should be a versioned interface table agreed upon by the PLC and computer vision teams. For example, which internal checks must pass for the VisionReady bit to be 1? When does TriggerId increment, and is it reset after a power outage? Under what conditions does ResultCode take a value of 0, 1, or an error? How long does ResultValid remain high? Data types, default values, validity periods, and error conditions must be explicitly defined.
Alongside these fields, ownership is also documented. If the PLC updates a field, the vision application must not write to that same field. The computer generates the ResultValid bit, while the PLC generates ResultAck; both sides managing the same field creates a race condition. A field remaining continuously at 1 and treating its transition from 0 to 1 as an event are different protocol behaviors. This distinction can be critical because of the scan cycle and network communication.
For numerical fields, overflow and reset behavior must also be included in the contract. If a product counter is 16-bit and wraps around after a certain point, its value alone cannot uniquely identify a product. A more robust identification approach based on shift, line, station, and trigger time may be necessary. Using only local time for timestamps can cause problems due to daylight saving time, clock corrections, and drift between device clocks; define an appropriate shared time reference.
In what order should a handshake cycle proceed?
In the example protocol, the computer vision system reports readiness, the PLC triggers a new product, the application marks the relevant ID as being processed, the image is acquired, and the result is calculated. After the result fields have been fully written, the validity signal is raised. The PLC reads and acknowledges the result together with its product identity. After the application sees the acknowledgment, it clears the validity signal. This is only an example; some systems associate triggers and results differently on the PLC side.
The important point is to acknowledge from the outset that this flow may be interrupted. If the PLC acknowledgment does not arrive, the computer may present the same result again, but must not overwrite the old result with fields for a new product. When a connection drops and returns, both sides must be able to transition to a shared clean initial state. Mistaking an old result for a valid result for a new product after a restart is a type of fault encountered in the field that can easily be missed in the laboratory.
A PLC scan time of a few milliseconds does not guarantee that a very short pulse sent by the software will be read. Ethernet networks and the application scheduler can change this behavior. An appropriate method is therefore selected from level-based handshakes, event counters, or acknowledged messaging. The choice must be validated against the mechanism's response and the communications protocol used by the PLC.
Who takes responsibility for OPC UA certificate management?
OPC UA offers powerful tools for secure sessions, authentication, and data modeling, but the project must define how they will be operated. Who will mark the server certificate as trusted during initial setup? How will the system be updated when the certificate expires? If a computer is replaced, how will the old identity be revoked? What will certificate validation do if the clock is wrong? Without answers to these questions, saying 'we used OPC UA, so it is secure' is incomplete.
Review closure of unnecessary ports on the production network, restriction of access to authorized devices, the certificate lifecycle, and role-based permissions. However, connection security must not be confused with machine safety: an encrypted message can be transported securely and still be processed for the wrong product at the wrong time. Data security, timing, and physical process safety are therefore separate areas of testing.
How should missed products, late results, and physical rejection failures be reported?
Application metrics must separately count products for which no image was acquired, products receiving a late decision, and products that could not be mechanically separated despite an intended rejection. The first is an acquisition problem, the second a computation/communication problem, and the third a physical automation problem. Adding them all to the 'model error rate' obscures responsibility boundaries and leads to the wrong improvements. Presenting separate rates by station and error code in the system report is more meaningful.
Suppose an example pilot acquires images for 9,998 out of 10,000 products, produces timely results for 9,995 of those, and physically separates every product for which a rejection command is issued. Image acquisition coverage, on-time decision rate, and rejection verification success can be derived separately from this example. However, defect detection accuracy additionally requires ground-truth labels or an independent reference measurement. Successfully separating a product does not prove that it is actually defective.
This distinction is the central idea of acceptance testing: correct detection, correct decisions, correct communication, and correct physical action must each be demonstrated separately. Acceptance criteria are written in advance for each layer, and boundary cases and controlled faults are tested. During site testing, using an end-to-end product trace rather than blindly trusting another system's 'completed' status strengthens fault analysis.
Frequently asked questions
Is sending only an OK/NG bit to the PLC enough?
It may be possible on some simple lines, but without product identity, validity, and ACK, the risk of mismatched products and repetition increases. The data contract must be defined together with the process.
Is OPC UA suitable for all real-time PLC communication?
It depends on the application. Network timing and control cycle targets must be tested; it does not provide a safety function.
Must the line stop if the MES connection goes down?
Not always. If process policy permits, local decisions can continue and records can be transferred later. The possibility of the recording queue filling up must also be considered.
Who is responsible if the camera sends a decision for the wrong product?
This is a system integration issue. Product ID, sequence number, physical position, and the verification chain must be designed together and tested on the live line.
Interactive tool: PLC decision handshake
A simple state machine designed to teach the Trigger → Busy → ResultReady → Acknowledge cycle. This simulation is not a safety controller and cannot replace an actual PLC program.
No events yet.
Out-of-order events are logged as warnings. In a real application, timeout durations, product ID, retry mechanisms, the physical actuator, and fail-safe design are validated separately.
Technical sources and verification
Documentation from manufacturers and standards organizations was used as the basis for details of the methods' standards and runtimes. All numerical examples are for educational purposes unless explicitly stated otherwise.
Visual note: The nine technical diagrams are original, and the numerical examples are for educational purposes. The illustrations do not represent an actual device benchmark, facility measurement, or factory acceptance test.