PlcVanguard
.NET 8 Blazor application for industrial communication with Siemens S7 PLCs. Inherits production-proven logic from MHT-Siemens (legacy .NET Framework WinForms) and restructures it into a modular, testable architecture.
Build & Run
# Build
dotnet build solution/src/PlcVanguard.Web/PlcVanguard.Web.csproj
# Run (Blazor Server)
dotnet run --project solution/src/PlcVanguard.Web/
Browse to https://localhost:5001 (or the URL shown in console).
Project Structure
solution/
├── src/
│ ├── PlcVanguard.Core/ PLC communication layer (S7.net, polling, persistence)
│ └── PlcVanguard.Web/ Blazor Server UI + API glue
└── PlcVanguard.slnx
Architecture
| Layer | Project | Technology |
|---|---|---|
| PLC Driver | PlcVanguard.Core |
S7.net 0.2.0 |
| Pollers | PlcVanguard.Core/PLC |
BackgroundService, ContinuousPoller, OnEventPoller |
| State | PlcVanguard.Core/State |
In-memory state management |
| Persistence | PlcVanguard.Core/Persistence |
File, Redis, MariaDB (EF Core) |
| UI | PlcVanguard.Web |
Blazor Server, SVG charts |
See ARCHITECTURE_AND_SPEC.md for full spec.
Pages
| Page | Route | Description |
|---|---|---|
| Dashboard | / |
Live counters, trendline SVG, historical records |
| Comparison | /comparison |
Multi-record comparison with live reference line |
| Counter | /counter |
Single counter monitoring |
Current Status
Completed (Phases 1-10)
- .NET 8 solution scaffold with 2 projects
- S7.net 0.2.0 PLC driver (
S7PlcService) - Continuous poller (
ContinuousPoller) - On-event poller (
OnEventPoller) - Hosted service with reconnect logic (
PlcHostedService) - State manager (
StateManager) - Persistence: File, Redis, MariaDB (entity scaffolds complete)
- Blazor Web with DI integration
- Dashboard page with live monitoring
- Comparison page with SVG chart
Pending
- REST API Controllers (
StateController,RecordsController) - SignalR Hub for real-time push to clients
- Auth middleware
- EF Core database migration / seeding
- Unit tests
PLC Configuration
Default connection (in Program.cs):
| Parameter | Value |
|---|---|
| IP Address | 192.168.0.102 |
| CPU Type | S7-1500 |
| Rack | 0 |
| Slot | 1 |
Legacy Baseline
Original WinForms app: MTH-Siemens/ (.NET Framework 4.0)
- Source:
MTH-Siemens/SiemenProxy.cs - Config:
MTH-Siemens/setup.json - PLC write: REAL (double) via
S7.Net.Types.Double.ToByteArray()
Git Workflow
Tasks are developed on feature/ branches and merged to develop. Current branch: develop.