CODESYS trace capture and file delivery are separate operations. The trace first becomes a file in the PLC runtime file system; the web visualization must then request that file through the runtime web server. The number that matters is the completed file size relative to free PLC storage and the transfer time permitted by the browser, network, and web server. This is data movement, not trace logic.
Transfer Approaches
Two workflows can retrieve a stored trace. Engineering-software retrieval remains useful during development, but it requires CODESYS access on the desktop. Web-visualization transfer is the better fit when an operator or colleague must capture and download a trace without engineering software.
| Approach | Desktop requirement | Runtime requirement | Best use |
|---|---|---|---|
| CODESYS engineering workflow | CODESYS software and project access | Online engineering connection | Development, commissioning, and trace analysis |
| Web-visualization file transfer | Supported web browser | Web server file-transfer services enabled and visualization controls configured | Operator-driven capture and download |
Use the web-visualization approach for this requirement. It removes the engineering-software dependency while keeping trace generation in the PLC and file delivery in the web server.
File Size, Timing, and Storage Limits
A trace file consumes PLC storage before any browser download begins. A successful trace-save indication therefore proves only that the capture reached the file system. It does not prove that the web server may expose the file or that the browser received every byte.
| Quantity or state | Failure condition | Where to read it |
|---|---|---|
| Trace file size | File is incomplete, empty, or larger than available storage | PLC file-system information or the runtime file browser |
| Free PLC storage | Remaining capacity cannot accommodate the completed trace | Controller diagnostics or runtime storage information |
| Transfer duration | Browser, proxy, session, or web-server timeout expires before completion | Browser network diagnostics and web-server diagnostics |
| Transfer-service state | File-transfer service is disabled | Web-server configuration |
| Requested file path | Visualization requests a different file or inaccessible location | Visualization file-transfer control and PLC file listing |
Estimate transfer time from file size and measured network throughput rather than trace duration alone. A long capture can still create a small file, while a high sample count or many recorded variables can create a larger file quickly. Read the actual completed size from the controller.
Web-Server Transfer Permission
The required runtime setting is the web-server file-transfer permission. Add or set the following entry in the applicable CODESYS runtime configuration:
[CmpWebServerHandlerV3]
AllowFileTransferServices = 1
The section name, key, and value must match exactly. A missing section, a duplicate setting with a conflicting value, or an edit applied to the wrong runtime configuration can leave the service disabled. Activate the changed configuration using the target runtime's documented configuration reload or restart procedure.
This setting opens the file-transfer service; it does not automatically create a download button, choose the trace file, or validate the path. Treat permission, visualization configuration, and trace completion as three separate checkpoints.
Visualization Download Procedure
- Configure the trace workflow so the PLC saves the capture to a known file. Use one stable location and filename convention that the visualization can address.
- Record the path representation used by the runtime. Relative paths, device aliases, and absolute paths are not interchangeable unless the target runtime defines them that way.
- Set
AllowFileTransferServices = 1under[CmpWebServerHandlerV3]in the web-server configuration. - Apply the configuration through the controller's documented activation method.
- Add the CODESYS visualization file-transfer element or implement the equivalent controls from the CODESYS Visu File Transfer example.
- Bind the download action to the same runtime file created by the trace-save operation. If operators can choose among files, restrict the selection to the intended trace directory.
- Disable or block the download action while the trace is still writing. Expose a capture-complete state before allowing retrieval so the browser cannot fetch a partially written file.
- Open the web visualization from the desktop browser, initiate the trace capture, wait for the save-complete indication, and select the download control.
- Choose the desktop destination through the browser's normal download workflow.
Browser security controls may redirect the file into the configured Downloads folder or prompt for a location. That behavior belongs to the browser; the PLC supplies the file but does not select an arbitrary desktop path.
Diagnostic Decision Path
| Symptom | Likely checkpoint | Action |
|---|---|---|
| No download control appears | Visualization implementation | Add or expose the file-transfer element and confirm that the correct visualization version is deployed. |
| Control appears but transfer is rejected | Web-server permission | Verify [CmpWebServerHandlerV3] and AllowFileTransferServices = 1 in the active runtime configuration. |
| File-not-found response | Path or filename | Compare the visualization request with the exact file listed on the PLC after capture. |
| Downloaded file is empty or truncated | Write completion, storage, or timeout | Wait for trace-save completion, compare byte counts, check free storage, and inspect browser network diagnostics. |
| Works in CODESYS but not in the browser | Web delivery layer | Focus on transfer permission, web-session state, visualization binding, and browser diagnostics rather than trace generation. |
Start at the first boundary that fails. Confirm the file exists before troubleshooting the web server; confirm the service before debugging browser behavior.
Transfer Verification and Recurring Pitfalls
- Create a short test trace and wait until the PLC reports that file creation has finished.
- Read the file's exact name and byte size on the PLC.
- Download it through the deployed web visualization.
- Compare the desktop filename and byte size with the PLC copy.
- Open or import the file with the intended analysis workflow and confirm that expected trace channels and samples are present.
- Repeat the test using a normal production-sized trace to expose storage or timeout limits hidden by the short test.
Recurring failures include requesting the file before the write closes, mixing runtime and visualization path syntax, editing an inactive configuration, and testing an old deployed visualization. Also check whether browser policy blocks the download or silently renames a duplicate file. A successful HTTP response alone is insufficient; matching byte counts and readable trace content complete the verification.
Frequently Asked Questions
How do I download a CODESYS trace without CODESYS software?
Save the trace as a PLC file, enable web-server transfer with AllowFileTransferServices = 1, and add a file-transfer download control to the web visualization.
How do I enable file transfer in the CODESYS web server?
Set AllowFileTransferServices = 1 in the [CmpWebServerHandlerV3] section of the active runtime configuration, then apply it using the target's documented activation procedure.
How do I prevent an incomplete trace download?
Keep the download action unavailable until the trace-save operation reports completion. After transfer, compare the PLC and desktop byte counts.
How do I troubleshoot a file-not-found error?
List the completed file on the PLC and compare its exact name and runtime path with the visualization's requested path. Correct the visualization binding rather than changing the trace logic blindly.
When should I escalate a CODESYS visualization download failure?
Stop and contact official CODESYS or controller-manufacturer support when the file exists, the active configuration contains AllowFileTransferServices = 1, and the deployed file-transfer control still receives a repeatable server rejection. Provide the runtime diagnostics, browser network result, target identity, active configuration excerpt, requested path, and matching test-file details.