| Crates.io | plcmodel |
| lib.rs | plcmodel |
| version | 0.1.0 |
| created_at | 2025-12-05 12:40:43.081715+00 |
| updated_at | 2025-12-05 12:40:43.081715+00 |
| description | Vendor-neutral PLC model for IEC 61131-3 programs |
| homepage | https://github.com/radevgit/plc |
| repository | https://github.com/radevgit/plc |
| max_upload_size | |
| id | 1968121 |
| size | 29,381 |
Vendor-neutral PLC model for IEC 61131-3 programs.
This crate provides an abstract representation that different PLC formats (L5X, PLCopen XML, etc.) can map to, enabling format-independent analysis and tooling.
┌─────────┐ ┌─────────────┐ ┌──────────┐
│ L5X │────▶│ │────▶│ Analysis │
└─────────┘ │ PlcModel │ └──────────┘
┌─────────┐ │ │ ┌──────────┐
│ PLCopen │────▶│ │────▶│ Viz │
└─────────┘ └─────────────┘ └──────────┘
Project - Top-level container for all PLC configurationPou - Program Organization Unit (Program, Function, FunctionBlock)Variable - Variables with scope and data typeDataTypeDef - User-defined types (struct, enum, array)Task - Task configuration for schedulingBody - Program body (instructions, networks)use plcmodel::{Project, Pou, Variable, ToPlcModel};
use iectypes::{PouType, VarClass};
// Create a project
let mut project = Project::new("MyProject");
// Add a POU
let mut main = Pou::new("Main", PouType::Program);
main.interface.inputs.push(Variable::input("Start", "BOOL"));
main.interface.locals.push(Variable::new("Counter", "INT"));
project.pous.push(main);
Format-specific parsers implement this trait to convert to the common model:
use plcmodel::{Project, ToPlcModel};
// Implemented by l5x::Controller, plcopen::Project, etc.
pub trait ToPlcModel {
fn to_plc_model(&self) -> Project;
}
MIT