added wasm plc compiler tool.
This repository shows a small end-to-end pipeline:
┌──────────────┐ Modbus TCP ┌────────────────────┐ OPC UA ┌─────────────────────┐ │ slave.py │ ─────────────▶ │ PLC (Rust + ST) │ ─────────▶ │ Web dashboard │ │ 25 °C etc. │ │ running as WASM │ │ (ECharts + Socket) │ └──────────────┘ └────────────────────┘ └─────────────────────┘
modbus_slave_simulator/ └─ slave.py # synthetic sensors st_app_with_rust_lib/ └─ MODULES/rust_computing_lib/ ├─ implements/rust/ # you edit Rust FBs here └─ .MODULE/rust/wa_interface.rs # auto-generated bridge – read-only data_visualization_host/ └─ frontend-lite/ ├─ public/ # static files (index.html, app.js, style.css) └─ server.js # Express + Socket.IO gateway
wasm32-unknown-unknown
pip install -r requirements.txt # pymodbus cd data_visualization_host/frontend-lite npm i # express, socket.io, echarts …
python modbus_slave_simulator/slave.py # listens on 0.0.0.0:5020
cd st_app_with_rust_lib/MODULES/rust_computing_lib cargo build --target wasm32-unknown-unknown --release
In a real PLC this WASM is loaded automatically; outside of PLC you may host it with Wasmtime for tests.
cd data_visualization_host/frontend-lite node server.js # http://localhost:3000
Add a PLC endpoint (e.g. opc.tcp://localhost:4840), map variables, and start watching charts.
opc.tcp://localhost:4840
simple_computing.rs
z_anm_detc.rs
spctrm_anlys.rs
Algorithms:
public/app.js
slave.py
Enjoy experimenting! 🚀
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
CPIPC Demo Project
This repository shows a small end-to-end pipeline:
1. Directory layout
2. Requirements
wasm32-unknown-unknowntarget)Install
3. Run the demo
3.1 Sensor & Modbus slave
3.2 Compile Rust FBs (optional test)
In a real PLC this WASM is loaded automatically; outside of PLC you may host it with Wasmtime for tests.
3.3 Web dashboard
Add a PLC endpoint (e.g.
opc.tcp://localhost:4840), map variables, and start watching charts.4. Rust Function-Blocks
simple_computing.rsz_anm_detc.rsspctrm_anlys.rsAlgorithms:
5. Frontend details (
public/app.js)6. Extending the demo
slave.py, regenerate interface, implement new FB.Enjoy experimenting! 🚀