The Automation Base library provides a comprehensive foundation for building industrial automation applications with SIMATIC AX. It offers base classes, interfaces, and utilities for managing equipment initialization and cyclic execution, operating modes, error handling, automatic startup sequences, and signal supervision.
- Equipment Management: Abstract base classes for standardized equipment initialization and cyclic execution
- Operating Modes: Support for Commissioning, Manual, and Automatic modes
- Auto-Startup: Configurable automatic startup with safety warning timers
- Error Handling: Structured error state management
- Release Management: External release control for safety interlocks
- Supervision: Time-based signal monitoring for sensors and actuators
- Logging: Flexible logging system with multiple log levels
- Interface-Based Design: Easy customization and testing
Install with Apax:
If not yet done, login to the GitHub registry first. More information: Personal Access Token Guide
apax add @simatic-ax/automationbase
Add the namespace in your ST code:
USING Simatic.Ax.AutomationBase;
USING Simatic.Ax.AutomationBase;
NAMESPACE Simatic.Ax.AutomationBase.Tests.ApplicationExample_01
CLASS MyConveyor EXTENDS EquipmentBase
VAR PUBLIC
Speed : LREAL;
Running : BOOL;
END_VAR
METHOD PROTECTED OVERRIDE InitUser
// Start from a safe idle state.
Speed := 0.0;
Running := FALSE;
END_METHOD
METHOD PROTECTED OVERRIDE RunCyclicUserCode
IF (THIS.GetStartupStatus() = StartUpStatus#AutoStartedUp) THEN
// Only run the conveyor after automatic startup completed.
Running := TRUE;
IF (Mode.GetOperatingMode() = OperatingModes#Automatic) THEN
Speed := 100.0;
ELSE
Speed := 0.0;
END_IF;
ELSE
Running := FALSE;
Speed := 0.0;
END_IF;
END_METHOD
METHOD PROTECTED OVERRIDE ResetFaultUser : BOOL
ResetFaultUser := TRUE;
END_METHOD
END_CLASS
PROGRAM ConveyorDemo
VAR
modeProvider : OperatingModeManager;
releaseByBool : BoolRelease;
conveyor : MyConveyor;
END_VAR
// Wire the dependencies exactly as in ApplicationExample_01.
conveyor.Mode := modeProvider;
conveyor.ExternalRelease := releaseByBool;
conveyor.StartUpTime := T#0s;
// Automatic mode plus release starts the conveyor immediately.
modeProvider.SetOperatingMode(mode := OperatingModes#Automatic);
releaseByBool.ReleaseSignal := TRUE;
conveyor.RunCyclic();
// Removing the release stops the conveyor in the next cycle.
releaseByBool.ReleaseSignal := FALSE;
conveyor.RunCyclic();
END_PROGRAM
END_NAMESPACE
This example shows the minimum contract for EquipmentBase:
- assign
Modebefore the firstRunCyclic()call - assign
ExternalReleaseif startup should depend on a release condition - call
RunCyclic()every PLC cycle - override
InitUser(),RunCyclicUserCode(), andResetFaultUser()in derived equipment classes - use
GetStartupStatus()to gate actuator logic until startup is complete - expect the equipment to return to
NotReleasedand stop again if the release is withdrawn during operation
| Topic | Description |
|---|---|
| Equipment Base | Abstract base class for all equipment with initialization and cyclic execution |
| Operating Modes | Commissioning, Manual, and Automatic mode management |
| Startup Warning | Automatic startup sequences with configurable warning times |
| Release Management | External release control for safety interlocks |
| Supervision | Time-based signal monitoring for sensors and actuators |
The library is organized around a small set of public contracts:
EquipmentBase: base class for reusable equipment logic with initialization, cyclic execution, startup handling, and fault resetIEquipmentBase: common equipment lifecycle interfaceIOperatingMode: provides the current operating mode to equipmentIRelease: provides an external release or interlock signalBoolReleaseandBinSignalRelease: ready-to-useIReleaseimplementations forBOOLandIBinSignalsourcesIResetCommand: provides centralized reset requests and error reportingSupervision: monitors time-based action and reaction conditionsILoggerandRingBufferLogger: logging abstraction and in-memory logger implementation
| Class | Description | Documentation |
|---|---|---|
EquipmentBase |
Abstract base class for equipment | Details |
BoolRelease |
Simple release implementation based on a BOOL |
Details |
BinSignalRelease |
Release implementation based on an IBinSignal |
Details |
Supervision |
Time-based signal monitoring | Details |
RingBufferLogger |
Ring buffer based logger | Source in src/Logging/RingBufferLogger.st |
| Interface | Description | Documentation |
|---|---|---|
IEquipmentBase |
Equipment contract | Details |
IRelease |
Release provider interface | Details |
IOperatingMode |
Operating mode provider | Details |
IResetCommand |
Reset command provider | Source in src/Equipment/IResetCommand.st |
ILogger |
Logger interface | Source in src/Logging/ILogger.st |
| Type | Description | Documentation |
|---|---|---|
OperatingModes |
Enum: Commissioning, Manual, Automatic | Details |
StartUpStatus |
Enum: InternalError, NotReleased, Manual, AutoStartingUp, AutoStartedUp | Details |
ErrorState |
Error codes: NoError, ConfigError, OtherError | Details |
SupervisionBehavior |
Enum: Action, Reaction | Details |
LogLevel |
Enum: Info, Warning, Error, Debug | Source in src/Logging/LogLevel.st |
The library is organized into modules:
- Equipment: Base classes and interfaces for equipment management
- Operating Modes: Operating mode management and interfaces
- Supervisions: Signal monitoring and timeout detection
- Logging: Logging infrastructure with multiple implementations
Example implementations are provided in the examples/ directory:
ApplicationExample_01/- BoolRelease-gatedMyConveyorapplication example with matching AxUnit testsServoAxisExample.st- Servo axis supervision flowPneumaticCylinderExample.st- Pneumatic cylinder controlLoggingExample.st- Logging integrationSupervisionExample.st- Signal supervision patternsResetCommandExample.st- Centralized reset handling
Use the examples as integration patterns, then adapt the interfaces and timing parameters to your machine. The examples are not a substitute for assigning the required public dependencies such as Mode before cyclic execution starts.
Application examples in the ApplicationExample_0x format contain a local README, runnable ST code, and matching tests. Promote snippets from these examples into this README only after the corresponding tests pass.
-
Always assign Mode: The
Modeproperty is mandatory for equipmentequipment.Mode := modeManager; -
Use ExternalRelease for safety: Integrate safety systems
equipment.ExternalRelease := safetyRelease;For simple cases, you can use the built-in release helpers:
boolRelease.ReleaseSignal := machineEnabled; equipment.ExternalRelease := boolRelease; equipment.RunCyclic(); boolRelease.ReleaseSignal := FALSE; equipment.RunCyclic();binSignalRelease.ReleaseSignal := releaseInput; equipment.ExternalRelease := binSignalRelease; -
Override protected methods only: Use
InitUser()andRunCyclicUserCode()METHOD PROTECTED OVERRIDE InitUser METHOD PROTECTED OVERRIDE RunCyclicUserCode -
Check startup status: Before activating equipment
IF (THIS.GetStartupStatus() = StartUpStatus#AutoStartedUp) THEN // Safe to activate END_IF; -
Set appropriate startup times: Based on safety requirements
equipment.StartUpTime := T#10s;
If ExternalRelease is not assigned, EquipmentBase falls back to the internal AlwaysReleasedRelease implementation. See docs/Release.md for the available release strategies.
The framework includes unit and integration tests in the test/ directory with mock implementations for reference. Use them to understand expected behavior for startup, reset handling, supervision, and logging.
Thanks for your interest in contributing. Anybody is free to report bugs, unclear documentation, and other problems regarding this repository in the Issues section or, even better, propose changes using a pull request.
Please read the Legal information