Skip to content

feat: add EPICS communication support and i18n#2159

Open
honeymelon3 wants to merge 4 commits intofrangoteam:masterfrom
honeymelon3:master
Open

feat: add EPICS communication support and i18n#2159
honeymelon3 wants to merge 4 commits intofrangoteam:masterfrom
honeymelon3:master

Conversation

@honeymelon3
Copy link

Git Commit Summary: EPICS Driver Implementation & Optimization

0. About EPICS

EPICS (Experimental Physics and Industrial Control System) is a set of open-source software tools, libraries and applications developed collaboratively and used worldwide to create distributed soft real-time control systems for scientific instruments such as particle accelerators, telescopes and other large-scale experimental facilities.

In the context of FUXA, this driver enables seamless integration with EPICS Input/Output Controllers (IOCs) via the Channel Access (CA) protocol, allowing FUXA to act as a powerful web-based HMI/SCADA for complex scientific and industrial environments.

This document summarizes the changes staged for commit to support the EPICS protocol within the FUXA project.

1. Core Changes Summary

Implemented a comprehensive, robust EPICS driver using a high-performance native bridge. This update covers the entire stack from low-level native calls to the frontend configuration UI.

2. Detailed Scope of Changes

Backend (Server)

  • Native Interface (server/runtime/devices/epics/cainterface.js):
    • Integrated Koffi for efficient native calling of ca.dll, replacing legacy FFI implementations.
    • Optimized _decodeValue logic to handle single-value Process Variables (PVs), fixing the issue where readbacks were incorrectly displayed as [object ArrayBuffer].
    • Added automatic type coercion in put() to ensure string values from the UI are correctly converted to numeric EPICS types.
    • Hardened resource lifecycle management (destroy()) to prevent server crashes during project reloads or driver restarts.
  • Driver Main Logic (server/runtime/devices/epics/index.js):
    • Implemented PV polling and real-time monitoring (Subscription) mechanisms.
    • Added batching and throttling to manage concurrent read/write operations.
  • Integration:
    • Registered the EPICS plugin in the runtime engine.
    • Updated server/package.json with koffi and adjusted dependencies for better stability.

Frontend (Client)

  • Configuration UI:
    • Created tag-property-edit-epics component for managing PV addresses, data types, and monitoring modes.
  • Device Management:
    • Updated device list and property components to support EPICS device types.
  • Internationalization:
    • Added EPICS-related translation keys to zh-cn.json and other assets.

Desktop (Electron)

  • Pathing Fixes (app/electron/main.js):
    • Refactored getServerPath() to correctly resolve the server entry point within the packaged resources directory.
  • Packaging Configuration (app/electron/package.json):
    • Enabled asar with asarUnpack for koffi and node-epics-ca to ensure native binaries (.dll) are physically available for OS loading.
    • Corrected extraResources mapping to include necessary server dependencies and client assets.

3. Resolved Issues

  • Fixed: Server crash (segmentation fault) during project save or reload.
  • Fixed: PV readback values displaying as [object ArrayBuffer].
  • Fixed: TypeError when writing numeric values provided as strings.
  • Fixed: Packaged Electron app failing to locate the server or native modules.

…vironment\n\n- Fix global 'Gauge' variable conflict in Electron by temporarily disabling CommonJS 'module' in index.html.\n- Improve gauge centering and scaling by adding 'box-sizing: border-box' and optimizing resize logic in NgxGaugeComponent.\n- Ensure the gauge maintains a circular shape by using the minimum dimension of the parent container.
…ranslation keys\n\n- Fix issue where translation keys were lost after initial translation in AppSettingsComponent.\n- Implement real-time UI language preview when selecting from the language dropdown.\n- Add rollback logic to restore previous language if settings are canceled.\n- Refactor SettingsService to use a single TranslateService instance for better consistency.
@unocelli
Copy link
Member

@honeymelon3 Hi, thank you very much for the PR.
I’m currently reviewing it. I just have two small requests, if that’s ok for you:

Could you please move the ngx-gauge related changes into a separate PR? This would help keep the changes more focused and easier to review.

Regarding node-epics-ca: have you already considered making it optional, for example by installing it via a plugin, similar to how it’s done for the Ethernet/IP device? In that case, koffi can remain as it is.

Thanks again for your work, really appreciated 🚀

@honeymelon3
Copy link
Author

@unocelli thanks for you reply, let me have a try.

- Add FUXA_EPICS_Paper.md: Academic paper on EPICS integration
- Add LANGUAGE_OPTIMIZATION_GUIDE_ZH.md/pdf: Chinese language optimization guide
- Add SETTINGS_AND_DATABASE_GUIDE_ZH.md/pdf: Settings and database guide
- Add COMMIT_LOG.pdf: EPICS implementation documentation
- Update index.html, auth-interceptor.ts, package.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants