Skip to main content

PLC Program Testing and Simulation Best Practices

By NFM Consulting 4 min read

Key Takeaway

Thorough PLC program testing before field deployment reduces commissioning time, prevents equipment damage, and improves safety. Testing strategies include offline simulation, hardware-in-the-loop (HIL) testing, factory acceptance testing (FAT), and structured site acceptance testing (SAT) with documented test procedures.

Why PLC Testing Matters

A PLC program that has not been thoroughly tested before deployment is a liability. Untested logic can cause equipment damage, production losses, safety incidents, and extended commissioning schedules. Studies show that catching a logic error during desktop simulation costs 1/10th of catching it during FAT, and 1/100th of catching it during field commissioning when equipment, contractors, and production schedules are at stake.

Effective PLC testing follows a structured progression from desktop simulation through factory acceptance testing to site commissioning. Each stage catches different categories of defects, and skipping stages inevitably results in more expensive problems downstream.

Offline Simulation

Offline simulation runs the PLC program on a software emulator without physical hardware. This is the first line of defense against logic errors and should be performed by the programmer as they develop each section of code.

  • Rockwell Studio 5000 Logix Emulate: Emulates ControlLogix and CompactLogix processors. Supports all instructions, tag types, and task structures. Can connect to FactoryTalk View for integrated HMI testing.
  • Siemens PLCSIM / PLCSIM Advanced: PLCSIM (built into TIA Portal) emulates S7-1200 and S7-1500 CPUs. PLCSIM Advanced adds API access for co-simulation with external models and virtual commissioning tools.
  • Schneider Control Expert Simulator: Built-in simulator for Modicon M340 and M580 platforms.

Simulation Techniques

Effective simulation requires systematically forcing input conditions and verifying output responses. Create a force table document that maps test scenarios to expected input states and output states. Walk through each program section by forcing inputs and confirming outputs match design intent. Pay special attention to edge cases: what happens when two permissives arrive simultaneously, when a timer expires during a transition, or when an analog input goes out of range.

Hardware-in-the-Loop (HIL) Testing

HIL testing connects the actual PLC hardware to simulated I/O signals rather than real field devices. Signal generators, simulator cards, and I/O simulation modules allow testing of the physical wiring, module configuration, and communication setup without connecting to process equipment. HIL testing catches wiring errors, module addressing mistakes, and communication configuration issues that offline simulation cannot detect.

Factory Acceptance Testing (FAT)

FAT is a formal testing event typically conducted at the integrator's facility before shipping the control panel to the project site. A well-structured FAT includes:

  • FAT procedure document: A numbered list of test steps with pass/fail criteria, expected results, and sign-off lines for witness review.
  • Power-up verification: Confirm all modules are recognized, firmware versions are correct, and no faults are present.
  • I/O verification: Every physical I/O point is tested by applying signals and verifying correct indication in the PLC and HMI.
  • Logic sequence testing: Walk through every operational sequence (startup, normal operation, normal shutdown, emergency shutdown, fault conditions) and verify correct behavior.
  • Alarm testing: Trigger every alarm condition and verify correct annunciation, priority, and acknowledgment behavior.
  • Communication testing: Verify all network connections, protocol configurations, and data exchange with other systems.
  • HMI verification: Confirm all screens display correct data, controls function properly, and navigation is logical.

Site Acceptance Testing (SAT)

SAT occurs after the control system is installed at the project site with field devices connected. SAT verifies that the complete integrated system functions correctly with real process equipment. Key SAT activities include:

  • Loop checks: Verify every I/O point from field device through wiring, terminal blocks, marshalling cabinets, and PLC modules. Confirm correct engineering units, scaling, and alarm setpoints.
  • Functional testing: Run each process sequence with actual equipment. Verify motor rotations, valve stroke directions, instrument ranges, and safety system responses.
  • Performance testing: Confirm PID loop tuning, scan times, communication latency, and data logging rates meet specifications.
  • Documentation: Record all as-built changes, calibration records, loop check sheets, and commissioning punch list items.

Regression Testing

After any program modification, regression testing verifies that changes have not broken existing functionality. Maintain a library of test cases for critical functions and re-execute them after modifications. Automated regression testing using PLC simulators and scripted test sequences reduces the effort required and improves consistency.

Documentation and Traceability

Every test should produce documentation that can be referenced during the life of the system. Test procedures, results, punch lists, and change logs form the commissioning record that supports future troubleshooting, modifications, and regulatory audits. NFM Consulting provides comprehensive FAT and SAT documentation packages that include test procedures, results, annotated logic printouts, and as-built drawings for every PLC programming project.

Frequently Asked Questions

Ready to Get Started?

Our engineers are ready to help with your automation project.