JMatic 2.0 Documentation

JMatic 2.0
100% pure Java component software for Siemens PLC access.

See:
          Description

Packages
com.langner.jmatic2  

 

JMatic 2.0

100% pure Java component software for Siemens PLC access.

JMatic 2.0 enables Java software developers to access Siemens PLCs from their application programs. JMatic 2.0 requires a Siemens S5 or S7 PLC with Ethernet TCP/IP communications controller (CP343, CP443, CP1430). An alternative is using the Langner Communications 3964NET Gateway product which may be connected to an async serial CP using the RK512 or the 3964R protocol.

Transport-level and application-level protocols

Siemens supports both transport-level and application-level protocols.

Transport-level protocols

For Ethernet CPs, the transport-level protocol is RFC1006, which is also referred to as "ISO-on-TCP". In JMatic 2.0, this is implemented in the RFC1006 class. RFC1006 requires the PLC program to actively transmit packets (by calling the AG_SEND function). This results in unsolicited packets that will trigger the ITransportListener method dataReceived. Note that data packets being passed by ITransportListener use Siemens data types which must be converted to the target computer's data format by application code. - Transmitting a data packet to the PLC is achieved by calling RFC1006.write. The PLC program must actively call the AG_RECV function in every cycle to acquire such packets.

For Serial CPs, the transport-level protocol is 3964R. To process this protocol within JMatic you need the Langner 3964NET gateway which is connected to the serial CP of the PLC. Your application uses the J3964Net class for communication with the 3964NET gateway. The procedure of the communication between the 3964NET gateway and your application is similar to the RFC1006 communication. The PLC program calls the P_SND_RK function for sending data to the 3964NET gateway. The 3964NET gateway transmits this packet over the TCP connection to your application. This results in unsolicited packets that will trigger the ITransportListener method dataReceived.- Transmitting a data packet to the PLC is achieved by calling J3964Net.write. The PLC program must actively call the P_RCV_RK function in every cycle to acquire such packets.

Application-level protocols

S7 Functions, Fetch/Write and RK512 on the other hand are application-level protocols. Usage of these protocols does not require the PLC programmer to add code for communication purposes. Instead, the IT application calls the read functions to acquire specific PLC data content(DB, Output, Input etc.). The JMatic 2.0 classes SxPLC (includes S7Functions, FetchWrite), S7Functions, FetchWrite, and RK512 may be used for this purpose. The Fetch/Write protocol may be used either on top of TCP or on top of RFC1006. The JMatic 2.0 Fetch/Write implementation supports both stacks. Please note that in any case a connection must be configured for the Fetch/Write protocol on the PLC using the Siemens NetPro utility. When using Fetch/Write, two connections (one for Fetch passive, one for Write passive) must be configured. In contrast, zero configuration is required for using th S7Function protocol.

JMatic 2.0 class overview

  • SxPLC is a high-level component for accessing Siemens S5 and S7 PLCs. The PC may access any of the PLC's operands (DBs, timers, counters, etc.). This is encapsulated in SxPLC for S7Function and Fetch/Write connections where the Java application takes 100% control of data exchange.
  • FetchWrite is a low-level counterpart of SxPLC. This class is used to connect to a Siemens S7 plc, using the FetchWrite Protocol to read (Fetch) or write (Write) data from or to the PLC. The plc has to be configured for a FetchWrite communication. It is important to have two communications configured, one for Fetch and one for Write. The Siemens S7 is not able to handle Fetch and Write on one connection. The component can be used with TCP and RFC1006 connections. With FetchWrite, the Java programmer must implement a polling cycle on its own and must deal with data type conversion from Siemens data types to computer data types. In SxPLC, this functionality is encapsulated in the class.
  • S7Functions is a low-level counterpart of SxPLC. The class S7Functions is used to connect to a Siemens S7 PLC via Ethernet, using the S7 functions to read or write data from or to the PLC. The plc doesn't need to be configured. With S7Functions, the Java programmer must implement a polling cycle on its own and must deal with data type conversion from Siemens data types to computer data types. In SxPLC, this functionality is encapsulated in the class.
  • RK512 supports accessing serial communication controllers via the gateway 3964NET from Langner Communications. 3964NET is a hardware gateway that maps the Siemens 3964R protocol on an async serial interface to Ethernet TCP/IP. The RK512 class enables a Java application to utilize the RK512 protocol over this connection. In respect to functionality, RK512 is pretty similar to Fetch/Write. In situations where a point-to-point CP is already installed, the 3964NET gateway eliminates the need to install an Ethernet CP for Java-to-PLC access.
  • RFC1006 is used for transport-level ISO-on-TCP connections. The function call AG_SEND must be used on the PLC to transmit packets to the IT application. The function call AG_RECV must be used on the PLC to receive packets from the IT application. While it seems fairly low-level, the benefit of RFC1006 is that it enables event-driven communication that is triggered from the PLC.
  • J3964Net supports accessing serial communication controllers via the gateway 3964NET from Langner Communications. 3964NET is a hardware gateway that maps the Siemens 3964R protocol on an async serial interface to Ethernet TCP/IP. The J3964Net class enables a Java application to utilize the 3964Net protocol over this connection. In respect to functionality, J3964Net is pretty similar to RFC1006. In situations where a point-to-point CP is already installed, the 3964NET gateway eliminates the need to install an Ethernet CP for Java-to-PLC access.
  • Sample Programs

    This distribution contains the following sample programs.
    SxPLC SxPLCSample in folder: samples/sxplc
    RFC1006 SendReceive in folder: samples/rfc1006/ConsoleSamples/SendReceive
    RFC1006_Sample in folder: samples/rfc1006/SwingSample
    FetchWrite FetchWrite_Sample in folder: samples/fetchwrite/TCP Connection
    S7Functions S7FunctionPolling sample in folder: samples/s7functions/ConsoleSamples
    S7Functions_Sample in folder: samples/s7functions/SwingSample
    RK512 RK512_Sample in folder: samples/rk512
    J3964Net STXETX_Sample in folder: samples/J3964Net

    The JMatic distribution includes also a PLC simulation (PLC-Simulation.exe) for Fetch/Write access. You find this simulation in the folder simulation. The simulation provides a fetch and a write connection. Listen port for both connections is TCP port 8000. The simulation PLC memory layout is described in the file "PLC-Simulation.csv".

    Beyond JMatic 2.0

    Please note that Langner Communications offers a companian product called i-Plant which goes beyond the capabilities of JMatic 2.0. While JMatic 2.0 is componentware, i-Plant is a dedicated middleware product with connectors to Oracle, SAP, Web HMI, MS Office, and much more. i-Plant also offers a Java SDK for accessing PLC data from custom Java applications. Different from JMatic 2.0, there is integrated support for fault tolerance, authentication, and enterprise-wide data access in i-Plant. If you are faced with writing enterprise-level factory automation or MES software, consider i-Plant as an alternative to JMatic 2.0. Contact Langner Communications for details (www.langner.com, www.factoryxml.org).

    About Langner Communications

    Langner Communications' track record goes back to 1988. Since its incorporation, Langner has focused on componentware to connect factory automation equipment and IT applications. The company has implemented more than 100 protocols and services 3000+ customers worldwide. Recent product developments focus on Java technology for enterprise-wide data integration in the manufacturing and process industries.



    Copyright © 2001-2005 Langner Communications AG. All Rights Reserved.