Wherever applicable IO nodes connected by a field bus. (FB) have ... is provided by a small set of software modules designed to .... CAN object management.
EMBEDDED CONTROLLERS, FIELD BUS AND A MODULAR IO CONCEPT: CENTRAL ELEMENTS OF BESSY II CONTROLS ∗ J. Bergl, B. Kuner, R. Lange, I. M¨uller, R. M¨uller, G. Pfeiffer, J. Rahn, H. R¨udiger BESSY, Berlin, Germany Abstract
+ Data preprocessing: Raw measured values are converted to relevant physical quantities. + Asynchronous data collection: Autonomously aquired data can satisfy requests immediately. + Data sharing: Field bus multicast facility allows task synchronisation and interlocks. + Autonomous control applications: The embedded controller may generate ramp functions, perform regulation loops and monitor device status.
Wherever applicable IO nodes connected by a field bus (FB) have apparent advantages: Simple and flexible installation and cabling, easy signal conditioning as well as data filtering and process security provided by intelligent actuators and sensors. The cost of a complex 3rd control system layer may be a high development effort. At BESSY several design principles of this layer control the risk: A few multi purpose IO cards form a modular set. Multiple IO bus connectivity provides high installation flexibility. ‘Controller Area Network’ (CAN) is the FB connected to the VME system of the standard model control system. Communication is provided by a small set of software modules designed to be easily adapted to hardware changes. The communication protocol with BESSY IO modules is a small and efficient subset of the ‘CAN Application Layer’ (CAL) standard. 1
ADVANTAGES OF A FIELD BUS LAYER
A reliable automated and flexible control system is essential for the effective operation of complex installations like a 3rd generation light source. A wide variety of solutions with emphasis on different properties can make up such a control system. Today the distributed architecture of console workstations on the same fast network as local process computers is widely accepted as standard model. The amount of device control directly handled by local process computer IO cards compared to the data transmission via additional field bus networks connecting intelligent sensors and actuators is less settled. The advantages of a predominantly field bus based architecture obviously overcompensates the drawbacks with respect to the requirements at BESSY:
Process Security is Improved. + Separate CPU per device: Equipment specific software and configuration is very localized and simple. + Stateful recovery: Service is not interrupted by higher level system crashes, actual IO status and setpoints are provided to the rebooting systems. + Independent trouble shooting: Replacement of faulty or suspicious hardware does not affect other devices. Nevertheless increased complexity and development effort should not be underestimated: A field bus communication has to be developed that matches the standard network protocol (at BESSY EPICS/Channel Access). Real time databases and program configurations of local process computer and embedded controller require additional data and link definitions. The intelligent subsystem makes task distribution as well as identification of failures more difficult. 2 SMART IO HARDWARE SET The modular set of hardware (Fig. 1) satifying most of the requirements is remarkable small. Thus the software development, configuration and maintainance effort becomes calculable. 2.1 Highly Integrated IO Components
Installation is Simplified. + Short signal cables: The DAC can be placed as close as possible to the power supply. Combined with properly specified components analog signals with 16 bit resolution become meaningful. + Secure and cheap connection: The field bus protocol guarantees reliable data transmission via shielded twisted pair cable even in noisy environments. + Electrical independency: Cross talk via common ground or bus backplane does not exist. Intelligent Actuators and Sensors can be Utilized. ∗ Funded by the Bundesministerium f¨ ur Bildung, Wissenschaft, Forschung und Technologie and by the Land Berlin
0-7803-4376-X/98/$10.00 1998 IEEE
2493
+ Multipurpose Analog IO Card: This versatile module with high quality components is optimized to control power supplies with high stability. Features are 16 Bit DAC, 4 mux 15+sign Bit ADC, 8 Bit digital in, 8 Bit digital out, low thermal drift components combined with fully isolated analog and digital stages as well as two bus and one device connectors. + Flexible Digital IO: Card has 16 Bit digital in, 16 Bit, digital out and the same set of connectors. Bus interface unit, programmable array logic, input/output stage are fully separated segments on board. + Embedded Controller: The Piggyback Module equipped with i386EX CPU and CAN Controller can be attached to the IO Cards via ISA Bus Connector.
+ Bus Adapters/Connectors and Carrier Boards allow to use the basic components in a variety of VME, ISA 96 and CAN bus configurations. 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 V00 11 00 G11 11 00 11 00 611 00 11 00 411 00 11 00 11 00 11 00 11 00 11 00 11 00 00 11 00 11 00 11 00 11 00 11 00 11
11 00 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 V11 00 00 G11 00 11 00 911 00 11 00 11 611 00 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11
11 00 11 00 1111111 0000000 11 00 0011 00 000000011 1111111 00 0011 11 11 00 11 00 00 11 11 00 11 00 00 11 11 00 00 16 Bit DAC 0011 11 11 00 11 00 00 11 11 00 V 11 00 4 mux 15+sign Bit ADC 0011 11 00 11 00 G 11 00 9 0011 11 00 8 Bit Digital In 11 00 00 11 11 00 6 11 00 00 11 11 00 8 Bit Digital Out 11 00 00 11 11 00 11 00 00 11 11 00 00 11 0011 11 00 11 0000000 1111111 00 00 00 11 000000011 1111111 00 11 00 11
1 0 0 1 0 1 0 1
ADA 16
IO 32 16 Bit Digital In 16 Bit Digital Out
11 00 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 V 11 00 11 00 G 11 00 11 00 11 00 9 11 00 11 6 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11
000000011 1111111 00 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 1111111 0000000 00 000000011 1111111
111111 000000 Embed.0110 Contr. 1010 0 1 i386EX 1 0 Full CAN 0 512K RAM1 0 1 0 1 512K Flash1 0 0 1 512K PROM 0 1 111111 000000 RT Clock
V G 9 6
0 1 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
CAN 11 00 00 00 11 Conn.11 00 11 00 11 00 11 11 00 00 Opto-C.11
Node# Sel. LEDs Connectors
111111 000000
3U ECB1100 Adapter1010 0110 1010 1010 10 111111 10 000000
111111 000000
3U VME 1100 Adapter1010 0110 1010 1010 10 111111 10 000000
000000011 1111111 00 6U VME 00 11 00 11 Adapter 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 111111111 0000000
Plug In
11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00
000000011 1111111 00 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 111111111 0000000
1111111 000000000 11 0000000 Carrier Board 001111111 11 00 11 00 11 Connects 00 11 00 11 Embedded Controller 00 11 to ISA 96 and CAN Conn. 00 11 00 11 00 11 00 11 00 11 00 11 0000000 001111111 11 0000000 1111111
00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 V11 00 11 00 11 00 G11 00 11 00 911 00 11 00 11 611 00 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 11 00 00 11
V G 6 4
00 11 00 11 11 00 11 00 11 00 00 11 00 11 00 11 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00
111111111 0000000 11 00 00 0011 0000000 1111111 11 00 00 11 00 11 00 Embed. 00 11 0011 11 11 00 11 00 00 00 Contr.11 11 00 0011 11 11 00 11 00 00 11 11 00 11 00 0011 11 00 11 00 11 00 00 11 11 00 00 0011 11 11 00 11 00 00 11 00 11 00 0011 11 11 00 11 00 00 11 11 00 11 00 00 11 11 00 0000000 1111111 00 0011 11 00 111111111 0000000 11 00
00 11 00 11 11 00 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11
ADA 16
111111111 IO 32 or ADA 160000000 00 00 11 0 1 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 01 1 0 0 1 1 0 0 1 0 01 1 1 0 01 1 0 0 1 0 01 1 1 0 00 1 1 0 1 0 01 1
CAN 11 00 00 11 00 11 Conn.11 00 00 11 00 11 11 00 00 11
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
11 11001100 00 0 1 0 1 00 11 0 1 0 1 1111111 00 10111000 11 11 IO 32 or ADA 160000000 00 1100010 00 11 1 0 00 1 1 0 11 1 0 00 1100100 11 11 1 0 1 0 00 1 00 00 11 00 0000000 11 1 0 11 00 00 11 11 1 0 00 00 11 11 1111111 00 11 00 10111000 11 1 0 11 00 00 11 11 IO 32 or ADA 16 1 0 11 00 00 11 11 00 00 11 00 1 0 00 00 11 0 1 00 00 11 11 0011 00 111000 11 0 11 1 00 00 11 11 0 0011 1 00 00 11 00 11 11 00 00 00 11 00 10111000 11 11 11 00 11 00 11 00 00 11 11 0011 11 00 10111000 11 11 00 0000000 11 00 11 00 00 11 11 1111111 00 00 11 00 1111111 0000000 111111 000000 00 00 11 11 00 11 11 00 11 00 11 00 00 11 11 Board CAN 00 11110000 11 11 0011 11 00 11 00 100Embed. 10 Carrier 00 00 11 11 00 00 11 00 00 00 11 11 00 11 11 00 11 00 00 11 1 00 00 11 11 0 1 11 00 11 00 11 00 00 11 11 0 1 00 11 0011 11 00 11 00 0 1 Conn. 00 00 11 11 0 1 00 11 00 00 00 11 0011 11 00 101100 11 11 11 0000 11 00 11 10Contr. 00 00 11 11 0011 11 00 00 00 11 11 1111111 0000000 00 11 00 11 00 00 11 0 1 00 00 11 0 11 1 11 00 11 00 11 00 00 11 11 0011 0000 11 00 11 10 00 00 11 11 0011 11 00 11 00 00 11 11 00 11 00 11 00 00 00 11 11 11 00 11 00 11 00 00 11 11 00 11 00 11 00 11 00 00 11 11 00 11 00 00 00 11 00 1010 0011 11 0011 11 00 11 00 00 11 11 111111111 0000000 00 11 00 11 00 00 11 11 00 11 00 11 00 00 00 11 11 11 0000 11 00 11 10 0011 11 00 11 0011 11 00 11 00 1010 00 11 00 11 0011 11 00 11 00 00 11 00 11 00 11 00 00 11 0 1 11 00 11 00 11 1111111 0000000 111111 000000 00 11 00 00 11 00 11
11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00
3U ISA
VME CPU 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 V 11 00 11 00 G 11 00 11 00 9 11 00 11 6 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 11 00 00 11
0 1 0 1 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Figure 1: Components of the Modular IO Set 2.2 Configuration Flexibility Whereever possible devices have been specified with slot, connector and power supply for the interface. Therefore the most common configuration is a standard IO card equipped with embedded controller, plugged into the device and attached to the CAN via bus connector (Fig. 2, top). Unexpensive ISA 96 crates provide access to special devices exclusively equipped with analog signals or requiring more than one IO card. The embedded controller is connected to the ISA bus by a carrier board. Software is identical to the previous case. The interfaces are plugged into the ISA bus with their bus connectors (Fig. 2, middle). For a more efficient use of the ISA 96 crate the backplane can be divided into 4 independent segments of 5 slots. 6U and 3U VME bus adapters allow to use the interfaces also at the local process computer level directly (Fig. 2, bottom). 2.3 Network Setup The CAN field bus has a mature protocol on an inexpensive chip available from multiple sources. Industrial support as well as increasing connectivity to industrial devices [1] make CAN a reasonable choice. The multicast facility is required for synchronisation of corrective actions [2] and used for device protection interlocks. On the embedded controller board the Intel 82527 Full CAN Chip is used to free CPU and development effort from CAN object management. The selected VME CAN card (VCAN2 from esd) is equipped with a MC 68 000 16 MHz CPU and two Philips PCA 82C200 Basic CAN chips capable of handling 2048 CAN objects each and providing gateway functionality between two CAN segments [2].
111111 000000
1 0 1 0 1 0
111111 10 101100 000000 IO 32 6U VME 1010 11001100 or1010 0 1 1 0 Adaptor 0 1 1 0 111111 000000 0 1 0 1 111111 000000 110010 11001100 10 11001100 ADA 16 0 1 0 1 IO 32 0 1 0 1 1 0 6U VME 0 1 0 1 1010 10111000 1010 10111000 or 0 1 11 00 0 1 Adaptor 11 00 0 1 111111 1 0000000 100 111000 11 00 0 1 1 0000000 0 1 11 00 0 1 111111 1 0 1 ADA 16 11 00 0 1 0 1 10 1110006U10VME 11 00 IO 32 0 1 0 1 10 11 00 0 1 0 1 0 1 11 00 0 1 1 0 11 00 0 1 10 111000 1010 10111000 1010 or 11 00 0 1 11 00 0 1 11 00 0 1 11 00 0 1 111111 10 11100010Adapter 1010 11100010 1100 11 00 0 1 ADA 16000000 11 00 0 1 11 00 0 1 0 1 10 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1
11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 00 11
1010 111111 01 000000
0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0 1 000000 111111 10 1100111111 000000
1010 10111000 IO 32 1010 11100010 or1010 0 1 0 1 111111 000000 1010 11100010 1010 11100010 0 1 ADA 16 32 0 1 0 1 IO 0 1 0 1 0 1 10 11001100 0 1 0 1 0 1 0 1 0 1 or 0 1 0 1 00 11 0 1 0 1 10 1100 00 11 0 1 00 11 0 1 1100 11100010000000 111111 10 11100010 00 11 0 1 ADA 16 32 00 11 0 1 00 11 IO 0 1 00 11 0 1 1100 11001100 10 11001100 00 11 0 1 00 11 0 1 1010 1010 10 1100 or 00 11 0 1 00 11 0 1 000000 111111 00 11 0 1 00 11 0 1 000000 111000 10 11100010 00 11 0 1 ADA 16111111 00 11 0 1 0 1 10 10 00 11 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
11 00 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11 00 11
011010 10 1010 10
0110 10 1010 10 10 101100 10 1010 1100 10 000000 111111 000000 111000 10 111111 0 1 1100 10 111111 000000 000000 10 111111
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1
6U VME
1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Figure 2: Basic Configuration Options 3 ADAPTIVE SOFTWARE DESIGN Using CAN as major building block of the control system a CAN communication software is required that allows for hardware changes as well as for different protocols.
3.1 Uniform Data Link Layer A simple programmers interface (SCI - Simple CAN Interface) has been defined hiding specifics of the installed hardware and providing a protocol independent data link layer. SCI reduces the effort of data transmission from a CPU to a certain CAN segment to function calls like ‘Create CAN Object’ assigned to a port #, ‘Read’ and ‘Write’ with different synchronisation behaviour. On the VME side SCI is a library portable between different operating systems and capable of multithreading. Presently the VCAN2 card of esd is supported. The portable SCI board support driver utilizes the vendor supplied memory mapping of CAN objects. Integration of e.g. CAN Industry Pack modules could be done by embedding the appropriate driver (e.g. from [3]) into SCI. SCI used by the embedded controller is a C–library of Intel specific code. It features the transparent handling of several Full CAN chips that may be used on the same CAN segment to increase the number of available CAN objects.
2494
3.2 Multiple CAN Protocols Supported
MultiCan Protocol Handler
_Write
Protocol Function Set 1
simple CAN, CAL/CMS subset:
_Read
Bruker
Entity 1 Entity 2 Entity 3 ...
_Reject
CAN
Message Buffer
_Get
_Put
lowCAL
PC CAN
MultiCan Protocol Handler
PC Appl. IO Driver
CAN
Commercial Products Used ID Gap Drive Motor Control
MOCON
SCI
MultiCan Protocol Handler
gets data
SCI (Simple CAN Interface)
ISA
CPU 386
AD/DA
Program/Table Download
Embedded Controller
Embedded Controller
Driver Support
mCANReader
CPU 386
Driver
sends
stores data and eventually requests EPICS callback GPS Layer
mCANWriter
CPU
PC
Optional
Device Net (Allen Bradley)
CANal
SCI
eventually request EPICS callback
DOS/NT
Siemens S5
SCI
dequeues, gets data
Commercial Products
PLC RF Power Amplifier
checks for timeouts mCANTimer
CANal
Smart Distributed Systems (SDS)
Thermoelement
Device Support
... 3 2 Send 1 Queue
Data Stream of Arbitrary Length:
(Honeywell)
Protocol Layer
... T3 T2 Delay T1 List
lowCAL
Used
PT 100
Entity n
rejected messages are delayed to limit the access frequency
SCI
ISA
and enqueues handle to message cache entry
Callback Processing reads data
CAN IO Nodes
EPICS Record Record Processing writes data
VME CAN2
EPICS
CPU
The asynchronous communication between VME master and IO node requires read, write, buffering and busy/retry mechanisms for identifiable chunks of data.
VME CAN2
VME CAN Master
CANopen Conformal Nodes
R.M. 9.1.97
Other Protocol Nodes
Figure 4: Supported CAN Communication Protocols
Figure 3: Sketch of the Multi Protocol Handler In addition to the transmission engine the software has to support different communication protocols (Fig. 3). In the CAL [1] standard a CAN Message Specification (CMS) is given. Any protocol can be identified as conformal to the CANopen CAL/CMS implementation conventions or not. Base protocol for data exchange between VME and embedded controller is a minimal and efficient subset of CAL/CMS called lowCAL. Protocol support and communication handler run symmetric both on VME motherboard and embedded controller CPU (Fig. 4). The communication protocol for the CAN interface of the RF power amplifier Siemens S5 PLC has been specified to deliver lowCAL conformal messages. Other commercial CAN modules following the CAL/CMS specification (e.g. PT 100) have been integrated with minimal effort. A PC CAN card in combination with the equivalent development environment for PCs and the embedded controller allow to interface PC based (otherwise standalone) control applications with the same software bundle. The CAN interface to a commercial motor controller (MOCON) used for the insertion device gap drives does not fully comply with CAL/CMS. Consequently a variant of lowCAL has been implemented. The software would also be able to support proprietary protocols like SDS (Smart Distributed Systems) or DeviceNet. Development and maintainance of autonomous control
tasks performed by the embedded controller is drastically simplified if code and configuration data can be downloaded from a host via the CAN connection. It is foreseen to implement the appropriate protocol supporting data streams of arbitrary length (CANal) (Fig. 4). 4 EXPERIENCES AND SUMMARY Today 30% of the planned control system installation is operational and fulfills the specified requirements (speed, robustness etc.). The installation process is rapid – partly due to the amount of about 80% CAN based IO nodes mostly in ‘Plug In’ configuration. The CAN communication software design revealed its power while connecting commercial CANopen conformal sensor devices. Portable implementation has been proven by an independent installation at another laboratory (SLS). 5
REFERENCES
[1] CAN in Automation International Users and Manufacturers Group e.V.: CAN Application Layer for Industrial Applications (CAL), CiA e.V., N¨urnberg, 1995. [2] J. Bergl, B. Kuner, R. Lange, I. M¨uller, R. M¨uller, G. Pfeiffer, J. Rahn, H. R¨udiger, Controller Area Network (CAN) — a Field Bus Gives Access to the Bulk of BESSY II Devices, Proceedings of the 1995 ICALEPCS, Chicago, 1995, p. 1017 [3] See http://www.ast.cam.ac.uk/˜anj/epics/, section ‘UKIRT/Gemini CANbus driver’
2495