Object PLC Mapping

What is Object PLC Mapping

Object PLC Mapping (OPM) is heavily inspired by the Java Persistence API (JPA) [1]. One of the main goal of the PLC4X Project is to make it easy to communicate with PLC devices to enable the development of applications that interact with PLCs. As many (or even most) of the application programmers are no experts in PLC Communication and protocols it should be as easy as possible to interact with PLCs without too much domain knowledge. This is exactly the reason why JPA was initialized many years ago to allow the interaction with a Database by simply calling methods on POJOs (Plain old Java Object). This is exactly what the OPM Module is for, to enable PLC communication by simply interacting with a POJO.

Simple Example

The following short code snippet shows how to read one value from a PLC via OPM. First, a PlcEntityManager is instantiated, then a connected entity is fetched for a given PLC connection address. Connected means that all method calls of the entity are intersected and replaced by PLC calls. This is then used to print one value to the console. In the second snippet one can see how the Entity class looks. The address where to read the variable pressure from is given in the @PlcField annotation.

public static void main(String[] args) {
    PlcEntityManager em = new PlcEntityManager();
    MyEntity entity = em.connect(MyEntity.class, "s7://...");

The class MyEntity is given by

public class MyEntity {

    private double pressure;

    public void MyEntity() {
        // For OPM

    public double getPressure() {
        return pressure;


More details