A structured application framework for TwinCAT (IEC 61131-3)
TwinCAT.OpenFramework is a modular framework that introduces architecture, execution model, and reusable libraries for building scalable PLC applications.
It brings structured software engineering practices into the TwinCAT ecosystem.
More technical descrition you can find here
As TwinCAT projects grow, they often become:
- Hard to maintain and extend
- Tightly coupled
- Filled with repetitive patterns
- Lacking clear architectural boundaries
Typical PLC code mixes:
- execution flow
- business logic
- error handling
This leads to:
- fragile systems
- slow development
- high cost of change
Without a structured approach, TwinCAT applications often evolve into:
- implicit state machines
- scattered error handling
- tightly coupled execution logic
TwinCAT.OpenFramework provides a unified platform for PLC development, similar in spirit to modern software frameworks.
Instead of ad-hoc code, you get:
- A structured execution model
- A consistent programming model
- A reusable foundation library
The framework is built around three main layers:
- Execution Layer → "runtime"
- Programming Model → "language extensions"
- Foundation Library → "standard library"
Defines a predictable and explicit execution model, replacing ad-hoc control flow typical for PLC applications.
Includes concepts like:
- AutomationRunner
- AutomationController
- Workflow / execution orchestration
This layer separates how code runs from what it does.
Defines how you write logic.
Includes:
- Exception-like error handling (
__TRY / __CATCH) - Result and error models
- Base abstractions and patterns
This layer makes code:
- more predictable
- easier to reason about
- less error-prone
Provides reusable low-level components.
Includes:
- Collections
- String utilities
- Date & time helpers
- Base types and primitives
- Full list you can find here
This layer reduces boilerplate and standardizes common operations.
- 📐 Clear and scalable architecture
- 🔁 Reusable components
- 🧠 Easier reasoning about program flow
- 📉 Less repetitive code
- ⚡ Faster development in medium and large projects
__TRY
controller.Execute();
__CATCH(errorCode)
exception := TOF_Core.ExceptionManager.GetLastException(errorCode);
TOF_Core.LogManager.TryLogException(exception);
__ENDTRY
- Medium and large TwinCAT projects
- Complex automation systems
- Long-lifecycle industrial applications
- Teams that need maintainable code
- Requires learning new concepts
- Adds abstraction layer
- May be unnecessary for small/simple projects
TwinCAT.OpenFramework treats PLC development as software engineering, not just control scripting.
It encourages:
- separation of concerns
- structured execution
- reusable design
Contributions, ideas, and feedback are welcome.
If this project is useful:
- Star the repository
- Share it
- Use it in your projects
Open an issue or reach out via GitHub.