New efficient communication services for ISO 11898 networks

New efficient communication services for ISO 11898 networks

Computer Standards & Interfaces 22 Ž2000. 61–74 www.elsevier.comrlocatercsi New efficient communication services for ISO 11898 networks Gianluca Cena...

357KB Sizes 0 Downloads 9 Views

Computer Standards & Interfaces 22 Ž2000. 61–74 www.elsevier.comrlocatercsi

New efficient communication services for ISO 11898 networks Gianluca Cena b

a,1

, Adriano Valenzano

b,)

a Dipartimento di Automatica e Informatica, Politecnico di Torino, Corso Duca degli Abruzzi, 24, 10129 Turin, Italy Istituto di Ricerca sull’Ingegneria delle Telecomunicazioni e dell’Informazione, Politecnico di Torino, Corso Duca degli Abruzzi, 24, 10129 Turin, Italy

Accepted 15 October 1999

Abstract Fieldbus networks should be able to support several kinds of data exchanges, which are characterised by very different requirements. The most popular solutions available today have been designed with some sets of specific needs in mind and usually, they are not always able to satisfy, equally well, the different kinds of communications which can be found in the industrial and process control environments. Often, system integrators and designers are forced to trade responsiveness Žneeded in event-driven systems. for efficiency Žmostly required in systems which are based on the periodic polling of the controlled devices., or vice-versa. In this paper, a modification of the basic ISO 11898 protocol is described which supports some new transmission services that significantly increase the communication efficiency for periodic exchanges of process data and for messages devoted to high level functions. These services maintain a good degree of compatibility with the original protocol and do not affect its very good responsiveness and flexibility. q 2000 Elsevier Science B.V. All rights reserved. Keywords: Fieldbuses; Communication efficiency; Data communication systems; Real-time networks; Network protocols

1. Introduction Fieldbus networks should support several kinds of traffic, as a consequence of the increasingly more sophisticated control applications being used today. In automated factory environments, in particular, there are basically two kinds of communication needs: process data, which directly affect the controlled system and messages, devoted to high level functions and parameterisation. Process data are small-sized Ž8 to 32 bit-long words are commonly )

Corresponding author. Tel.: q39-011-564-7061; fax: q39011-564-7099; e-mail: [email protected] 1 Tel.: q39-011-564-7078; fax: q39-011-564-7099; e-mail: [email protected].

adopted. and characterised by real-time requirements, while messages can be arbitrarily long and the timings involved in their transmission are not usually a critical issue. From the point of view of applications, process data exchanges can be further classified as predictable and unpredictable. Predictable data exchanges Žoften referred to as cyclic, periodic or synchronous exchanges. take place at well-defined times, which are known a priori by the control application. In the following text, they will be also referred to with the term compelled in order to highlight the fact that their schedule is often decided in some way by a master station, which also drives the effective data exchanges over the network. On the contrary, it is not possible to know in advance the times when the unpredictable data have to

0920-5489r00r$ - see front matter q 2000 Elsevier Science B.V. All rights reserved. PII: S 0 9 2 0 - 5 4 8 9 Ž 9 9 . 0 0 0 2 7 - 6

62

G. Cena, A. Valenzanor Computer Standards & Interfaces 22 (2000) 61–74

be exchanged. In fact, they are sent asynchronously on device demand Žthey are also known as spontaneous, sporadic or acyclic exchanges. when a given condition arises in the system. In this case, the best solution is to adopt a medium access technique which gives each device a chance to transmit on its own. On the one hand, predictable data exchanges are usually involved in controlling the conventional automated systems, in which a controller device ŽPLC, CNC, etc.. inquiries the different IrO devices in order to read measured input data and status information and then sends them back the related commands and set-points according to a fixed schedule. In this case, it is very important that cyclic data be exchanged at a very precise rate and that jitters be kept low so that the physical system can be controlled accurately. On the other hand, unpredictable data are important in event-driven systems, where any device acting as a data producer should be able to send measured values to the intended destinationŽs. as soon as they can be obtained from the physical system. Moreover, spontaneous transmissions are necessary so that urgent interactions such as, for example, alarm notifications Žas a consequence of errors or exceptional conditions. or trigger signals Žused to co-ordinate the operations of a number of devices and applications. can be implemented. In this case, each datum should be assigned a priority, so that the communication system can order the concurrent transmission requests according to some precedence criteria and grant a suitable schedule for the related exchanges. In such a way, higher priority messages experience shorter transmission delays than lower priority communications. High level functions usually have not any particular timing constraint and the related messages can be sent at a lower priority with respect to real-time data. However, they may require the transmission of a considerably large amount of information. Hence, it is necessary for the available bandwidth of the communication system to be shared out efficiently and fairly among the different nodes. For physical reasons, each fieldbus network has basically to face two main limitations: first, is the fact that the available bandwidth is a limited resource and secondly, that at any one time, only one node can be enabled to transmit a frame on the

shared communication medium. Bearing these constraints in mind, an ideal communication system for industrial environments should behave as follows. Ø The transmission of compelled process data Žwhich usually takes up a percentage of the system bandwidth which is known in advance. has to be carried out with the highest precedence at the required rate, and frequency jitters must be kept as low as possible. Ø The part of the network bandwidth, which is not assigned to compelled exchanges, should be made available to non-critical real-time spontaneous process data; as long as they do not exceed the available bandwidth, bounded transmission delays must be ensured and, to this extent, a mechanism based on priority tags being assigned to the different data can be adopted so that the correct precedence among concurrent exchanges can be set, without affecting the compelled exchanges. Ø The amount of network bandwidth which is not used for real-time data exchanges Žboth compelled and spontaneous. should be shared out fairly and efficiently among the nodes which need to transmit messages for supporting high level functions, so as to maximise the throughput for each node; in this case, temporary network overloads are tolerated and must be managed correctly by the network without affecting the real-time exchanges. Ø Timings of very urgent asynchronous data Žcritical alarms, which can occur at any time. must be always respected and, to this extent, their transmissions can pre-empt any non-critical transmission Žeither process data or messages. which is currently taking place on the network. In the following, an enhanced access technique and a new set of services are proposed for the ISO 11898 w15x protocol Žbest known as Controller Area Network, or simply CAN. to obtain a network behaviour closer to the ideal solution mentioned above, at least from the point of view of the efficiency and responsiveness. The paper is structured as follows: Section 2 analyses the properties of several existing medium access control ŽMAC. mechanisms, pointing out their advantages and their drawbacks. In Section 3, the relevant characteristics of the new protocol are introduced, while its performance is evaluated in Section 4. Finally, Section 5 contains considerations on how the new technique can be applied.

G. Cena, A. Valenzanor Computer Standards & Interfaces 22 (2000) 61–74

2. Analysis of medium access techniques for realtime networks The performance considerations developed in this paper are based on two main indices: efficiency and responsiÕeness. The communication efficiency is defined as the ratio between the useful throughput as seen by the user Žapplication programs. and the network bit rate. It measures how effectively is the network bandwidth used, that is to say, the amount of information Žboth process data and messages. which can be exchanged over the network in the unit of time. Responsiveness, instead, provides an indication on how quickly the network can deal with the asynchronous events which take place in the system. In practice, it is defined as the worst-case delay which can elapse between the time a transmission request is made and the time the related piece of information is received by the intended destinationŽs.. When the timings of all the data transmissions are known in advance, such as in the case of systems based only on cyclic exchanges, the time division multiple access ŽTDMA. technique is surely the most efficient solution. TDMA combines all the data produced or consumed by the different nodes in a single Žsummation. frame and requires that the protocol control information be added only once per frame in order to achieve bit and frame synchronisation and guarantee appropriate error controls Žas what happens, for example, in the Sercos protocol w11x.. Since all the information from Žor to. the different nodes is collected together, TDMA ensures the highest efficiency among the different MAC techniques. In the Cenelec EN50254 w10x protocol Žwhich is also known as Interbus., for example, whose behaviour is similar to TDMA Žthough in reality it is not a true TDMA network., the communication efficiency for a generic controlled system can be as high as 0.6 Ži.e., 60%.. On the contrary, TDMA is not suitable for spontaneous data exchanges and high level communications, in that it is necessary for the whole system bandwidth to be allocated in advance to the different nodes, thus leading to poor flexibility. Moreover, in this case, the bandwidth which is not used by a node cannot be reallocated to other stations, so that it is effectively wasted, thus reducing the system’s overall efficiency.

63

When spontaneous process data has to be sent, a carrier sense multiple access ŽCSMA. technique with deterministic collision resolution, such as the one adopted in the CAN protocol w15,16x, appears to be the most suitable solution. In this case, unlike pure CSMA w17x, each different piece of information is assigned a priority tag Židentifier.. When a node has to send a message, it can start the transmission as soon as the medium becomes free and, if a collision takes place, the contention is solved by means of a network-wide arbitration phase which is based on the values of the identifiers of the messages involved. The access technique adopted in CAN, together with its limited payload size Žup to a maximum of 8 data bytes are allowed per frame., ensures very short response times and enables a scheduling policy which is truly distributed and dynamic. Exchanging small pieces of information in a message-based network like CAN, however, leads to very poor efficiency w1x. In the case of remotely requested 8-bit cyclic process data, the efficiency drops down to about 0.08, which means that the neat bandwidth actually available is less than one-tenth of the network bit rate. In the same way, the small payload of CAN frames leads to reduced efficiency for the transmission of large messages, due to the effect of fragmentation w1x. When message transmissions are considered, a token-based access technique such as the one adopted in Profibus w8x Žwhere each single frame can include up to 246 user data bytes. seems to offer more satisfactory performances with respect to both TDMA and CSMA, at least from the point of view of bandwidth share-out Žin terms of flexibility, fairness and efficiency.. In this case, however, responsiveness is reduced and jitters are increased for real-time process data. As shown in Table 1, each kind of medium access technique provides optimal performances for a particular type of data exchange, while it is usually less suited to other kinds of communications which are required in factory automation systems. The basic idea of this paper is to achieve a satisfactory trade-off between the CSMA and TDMA techniques in order to get the most out of a fieldbus network. In this paper, we propose a modification to the ISO 11898 protocol w15,16x Žwe have called it CANrP., which introduces TDMA-like data exchanges and also im-

64

G. Cena, A. Valenzanor Computer Standards & Interfaces 22 (2000) 61–74

Table 1 Characteristics and performances of some popular fieldbus networks Medium access technique

Kind of traffic Predictable Ž compelled .

TDMA ŽInterbus.

High efficiency Žcombined message, one masterr many slaves. Medium efficiency Žmessagebased, each node is a master.

CSMA ŽCAN.

Token passing ŽPROFIBUS. CANrP

Medium efficiency Žmessagebased, more than one masterr many slaves. High efficiency Žcombined message, many mastersr many slaves.

Unpredictable Ž spontaneous.

Messages Ž high leÕel .

Medium responsiveness Žcan only be implemented with periodic exchanges. High responsiveness Žprioritybased, truly dynamic and fully distributed. Medium responsiveness Žcan only be initiated by masters at token reception. High responsiveness Žprioritybased, truly dynamic and fully distributed, pre-emptive.

Medium efficiencyrmedium flexibility Žhigh fragmentation, static bandwidth allocation. Medium efficiencyrhigh flexibility Žhigh fragmentation, dynamic bandwidth allocation. High efficiencyrhigh flexibility Žlow fragmentation, fair and dynamic bandwidth allocation. High efficiencyrhigh flexibility Žlow fragmentation, fair and dynamic bandwidth allocation.

proves the transmission efficiency of low priority messages without reducing the responsiveness or the flexibility of the original protocol. As will be shown later, the resulting network combines the best features of a number of existing fieldbus protocols and guarantees a very high level of efficiency and responsiveness in all operating conditions. However, the reader should be warned that CANrP cannot be considered as ‘‘the fieldbus that all are looking for’’, because it exhibits its own drawbacks Žtypical of an ISO 11898-based network. such as the limited bit rate and network extension.

3. CAN r P basics The original ISO 11898 protocol exhibits very good performance for exchanging spontaneous realtime data, while no special service is provided for compelled data exchanges or for transmission of large messages. This section describes the additional services introduced in CANrP which enhance the performance of CAN for the data exchanges mentioned above. Basically, CANrP introduces a new service which is used to collect process input data and to distribute process output data to a number of different devices at the same time, thus providing a mechanism which is similar to the summation frame of Interbus. Since the summation frame is usually larger than the conventional CAN frames, the overall responsiveness

could in some way be reduced. In order to avoid excessive transmission delays, a pre-emption mechanism is provided for extremely urgent notifications. Furthermore, another new service conceived explicitly for high efficiency message transmissions is introduced which enables transparent fragmentation of long messages directly at the data-link level, so that the responsiveness is not degraded. The new services of CANrP are based on a MAC technique and frame formats which are very similar to CAN, hence, a certain degree of backward compatibility is ensured, at least from the point of view of the application programs. In the following text, it will be shown how the different kinds of data exchanges can be supported by the new services. 3.1. Compelled data exchanges Since the timings for compelled data exchanges are known in advance by the control applications, a technique similar to TDMA can be used in CANrP which relies on an asymmetric interaction model and is able to increase the efficiency for such communications. In particular, a quantity of different process data which has to be delivered to the output devices Žactuators. or collected from the input devices Žsensors. at the same time Žor, better, at the same rate. is grouped and exchanged in a single Žlarge. DATASET frame, as happens for the summation frame in Interbus w10x. The efficiency of the resulting protocol increases noticeably because, on the aver-

G. Cena, A. Valenzanor Computer Standards & Interfaces 22 (2000) 61–74

age, a smaller number of control bits has to be added by the protocol for each piece of information being exchanged. Unlike the solution described in Ref. w3x, where a masterrslave approach has been adopted, a technique based on the popular schedulerrpublishersr subscribers model is introduced here which, to some extent, is derived from the IEC 61158 Fieldbus protocol w12–14x. In practice, a dataset actiÕe scheduler ŽDAS. is defined for each dataset in the system with the role of initiating and monitoring the exchange phase of the related compelled data. At the limit, there could be only one node in the network which acts as a DAS and which takes care of the scheduling of all the different datasets. At any time, only one scheduler can be active for a particular dataset and, as in the IEC Fieldbus w14x, suitable procedures can be Žoptionally. provided which enable the re-election of a new DAS should the current one cease operations. The communication objects in the system that are to be sent according to a compelled schedule are transmitted by means of data slots and, depending on their timing requirements, they are gathered in a number of different datasets. Each dataset is made up of a Žfixed. number of data slots, each one having a unique publisher and a variable number of subscribers. In this way, the basic approach of CAN is maintained, in that such a solution still provides a buffer transfer mechanism which is based on multicasting. The only significant difference is that, in this case, each publishing node has no right to initiate the transmission of data over the network on its own, instead, it has to wait until the DAS initiates Žcompels. the relevant exchange sequence. Each data slot occupies a fixed position in the dataset. In this way, each publisher or subscriber device only needs to know the dataset to which its process datum is bound, the starting position of its own data slot in the dataset and the related length. Implementation of slave nodes is thus kept as simple as possible, so as to enable the implementation of inexpensive devices. As in CAN, an acknowledgement mechanism is provided by which a publishing node is notified whether at least one subscriber read its data correctly. It should be noted that should there be only one node which subscribed to the published object, this mechanism is equivalent to the usual

65

acknowledged data transmission in peer-to-peer exchanges. As in the IEC w14x and FIP w9x protocols, the mechanism discussed above effectively decouples the productionrconsumption of data from their transmission on the network. In practice, each publishing node writes its data asynchronously in some local buffer by means of the L_PUT service request. When asked Žcompelled. to do so by the DAS, the MAC sublayer of the node automatically transmits Žby using the related slot. the value stored in its local buffer. This value is read and stored by the MAC sublayer of all the intended subscribers, which are then notified of the exchange. The subscribers can read their local buffer Žeither asynchronously or synchronously. by means of the L_GET service invocation. Details of the compelled exchange mechanism are depicted in Fig. 1. The schedulerrpublishersrsubscribers model described above is perfectly adequate to emulate the masterrslave approach, as it lets the DASrmaster publish the process output data and subscribe to the process input data which are sent by the slave devices. In this way, it is possible to achieve a behaviour which is similar Žto some extent. to the SRDrCSRD services w8x of the Profibus networks, where the DASrmaster decides when a data exchange should take place. The L_COMPEL service is provided to the control application running on the DAS and is used to trigger the transmission of a dataset frame on the bus. When compared to the Interbus protocol, it turns out that CANrP is able to support more than one master ŽDAS. on the same network, each one supporting several datasets Žeach dataset is characterised by a unique dataset identifier, DSID.. This allows each group of slave devices to be sampled with a different period Žas occurs, for example, in the FIP w9x or IEC w14x protocols. and so provides a further improvement of the overall efficiency. At first glance, the use of long dataset frames could reduce network responsiveness to an unacceptable degree. In practice, however, cyclic Žcompelled. process data usually have a higher precedence than the other kinds of information exchanged on the network, and it is often considered as a fundamental requirement that their timings are respected rigorously. When this is true, delaying the spontaneous

66

G. Cena, A. Valenzanor Computer Standards & Interfaces 22 (2000) 61–74

Fig. 1. Protocol diagram of the compelled exchange mechanism.

transmissions until the scheduled compelled data have been exchanged is certainly a satisfactory approach. Furthermore, if urgent spontaneous notifications are defined in the system which need to be delivered within very tight deadlines Žsuch as, for example, the synchronisation or emergency messages of CANopen, or some high priority asynchronous PDO., a pre-emption mechanism is provided in CANrP

which can possibly stop the transmission of dataset frames, as described in detail in Section 3.3. Fig. 2 shows the format of dataset frames. Such frames are made up of a preamble Žsent by the DAS., a sequence of data slots Žsent by the different publishers which are bound to the dataset. and a postamble Žalso sent by the DAS. which is mainly provided to check for transmission errors. The

Fig. 2. Format of the DATASET frame.

G. Cena, A. Valenzanor Computer Standards & Interfaces 22 (2000) 61–74

preamble is similar to the first part of a CAN frame and consists of a SOF bit, a DSID identifier field Žwhich specifies the unique identifier of the dataset., some bits which tag the frame as a DATASET frame, a length field Ž6-bit wide. which specifies the number of bytes included in the data section and a synchronisation sequence ŽSS. which transfers the ownership of the communication medium to the first publisher. It should be noted that the length field refers to the combined size of all the data slots, including the padding field. Next, comes the sequence of data slots. Each one of them begins with a RDY field Ž1-bit-wide. which is set at the dominant value by the publisher to indicate that it is ready to send its own data. Should the device, which acts as the publisher, no longer be working Žor it is temporarily unable to reply correctly., the RDY bit assumes a recessive value according to the rules governing the CAN physical layer. In this case, the DAS gets back the ownership of the bus immediately and starts sending a padding sequence, made up of alternating dominant and recessive values, whose length is the same as the data slot it is replacing Žsee Fig. 2b.. In this way, the bit stuffing rules on the bus are not violated and the different devices are kept in synchronism. It should be noted that in this case, the DAS is responsible for adding any possible stuff bit right after the Žrecessive. RDY bit. By contrast, if the publisher of the slot is ready, the subsequent bits are managed and interpreted as in Fig. 2a. In particular, a dominant value for the updated ŽUPD. bit indicates that the value was refreshed on the publisher’s side after the last time it was distributed over the network. On the contrary, a recessive value means that the output buffer of the publishing node contains the same value sent in the previous compelled exchange Žor that it is undefined if it has never been updated.. Such a kind of timeliness check is necessary since the production of new data is decoupled from their transmission. In order to optimise data transmission, the size of the data field in a slot is allowed to be an even number of bits in the range from 0 to 64. A SS and a slot acknowledgement ŽSACK. field complete the data slot. The SACK field is made up of an ACK slot, which is overwritten with a dominant value by the intended subscribersŽs. of the

67

datum so as to confirm that it has been received correctly, followed by a recessive ACK delimiter bit. The SACK field is preceded by a synchronisation sequence, consisting of a dominant bit followed by a recessive bit, which provides a synchronisation edge in the bit stream and is used to transfer temporarily the right to access the shared communication medium to the subscribing deviceŽs.. The synchronisation sequence ensures that no stuff bit has to be added in the middle of the slot acknowledgement field. The dataset frame is closed by a postamble, made up of a dummy field which pads the overall data field to the nearest byte boundary, a CRC field, an ACK field Žfor the whole frame. and an end of frame ŽEOF. field which actually terminates the frame. The CRC field sent by the DAS covers the whole frame Žand hence all the different data slots. and is checked by all the nodes in the network. In fact, each node in the network Žpublishers, subscribers and even the other nodes. computes the CRC on its own and, should a mismatch be detected, an error flag is sent so as to invalidate the frame. Fig. 3 shows that the communication efficiency for compelled exchanges based on dataset frames depends directly on the size of the combined data field, that is, on the number of data slots and their size. Since we do not wish to affect the responsiveness of the system excessively, the size of the data field in the dataset frames is limited to 63 bytes. In fact, as shown in Fig. 3, any further increase of this size does not lead to any real improvement of the network efficiency but the transmission delays are

Fig. 3. Transmission efficiency of the cyclic exchanges vs. number of slave devices Ždata slots. and size of process data.

68

G. Cena, A. Valenzanor Computer Standards & Interfaces 22 (2000) 61–74

worsened accordingly Žthe dashed line shows the maximum number of data slots allowed, which depends on the size of each slot.. As an aside, it should be noted that it is not necessary for the different slots to have the same size. When compelled process data exceed the 63 bytes limit, they can be split up into several Ždifferent. datasets, each one having a different identifier. To make a comparison, in ISO 11898 networks the efficiency for a cyclic exchange of 8-bit sized asynchronous process data is only about 0.14, irrespective of the number of slave devices in the system, and that value drops down to 0.08 when slave devices are polled by the master by means of RTR frames. In a similar system based on CANrP, where 15 slave devices are grouped together by means of the dataset approach, the efficiency raises up to 0.46. Compelled services are not symmetric; hence, two different roles are involved, that is to say DAS devices Žcontrollers, which usually carry out complex operations. and publisherrsubscriber Žslave. devices Žsimpler and cheaper sensors and actuators.. It should be noted that the exact position of a particular slot in the related dataset frame is known only by both the associated slave device and the DAS. This means that a dataset frame is seen by the other nodes in the network as a conventional frame Žexcept for its increased length.. Its particular format and the related transmission technique have been conceived to ensure that the bit stuffing rules are always respected, even when some slave devices are in a non-operational state. A suitable configuration phase should then be provided, before the normal operations are started, where the DAS notifies each device of the position of its data slotŽs. in the dataset frame. The configuration of the publishing and subscribing devices does not have to satisfy any particular communication requirement and can be easily carried out using the conventional data frames. This phase can take place either off-line Žstatic binding. or on-line Ždynamic binding. before the compelled exchanges are started. 3.2. Block transfer In order to ensure a satisfactory responsiveness for the high priority frames and to lessen the effects of the priority inversion phenomenon w4x Žwhich

takes place when the transmission of an urgent frame is delayed until the current low priority message has been completely exchanged., ISO 11898 frames have a payload Ždata field. which is very small with respect to other popular fieldbus protocols. This implies that long messages have to be split into a sequence of smaller chunks Žwhich are referred to as fragments in the CAN literature. according to some fragmentation technique, which is usually accomplished by the application layer w5x. Fragmentation protocols perform all the operations needed to split the message, send each fragment into a separate frame and reassemble all the fragments at the destination node so as to rebuild the original message. Fragment sequencing, as well as error and flow controls, are, in this case, relevant issues which should be dealt with carefully. Whatever kind of fragmentation protocol is used, the resulting efficiency for exchanging messages is quite low. In the case of CALrCANopen w5,6x, for example, each fragment Žwhose size can be up to 7 user data bytes. causes a pair of frames to be exchanged Žone command frame sent from the initiator of the service and one response frame returned by the responder.. This leads to a level of efficiency which, even neglecting the negative effects of the bit stuffing mechanism, is theoretically only about 0.25. The major drawback in performing fragmentation at the application level, however, is that it has to be carried out in software and hence, it is slower than a silicon-based solution and wastes CPU time. Therefore, a hardware implementation at the data-link level Žcommunication controller. can lead to noticeably better performances for the messaging system. An improvement of transmission efficiency for the low priority messages Žwithout there being penalties for network responsiveness. cannot be obtained by simply increasing the payload of the frame. A possible solution is to split the original message into a sequence of fixed-length fragments, which are then sent sequentially by the transmitting node in the same frame. In this way, some common parts of the envelope, such as, for example, the identifier, CRC and EOF fields are sent only once per message, thus ensuring a higher communication efficiency. Each fragment is followed by a stop field, which consists of a stop slot Ž1-bit wide. preceded by a synchronisation sequence and followed by a stop delimiter Žin

G. Cena, A. Valenzanor Computer Standards & Interfaces 22 (2000) 61–74

this way the stop bit is ‘‘surrounded’’ by two recessive bits.. By overwriting the stop slot with a dominant value, each node in the network which has to transmit a higher priority frame can temporarily Žand gracefully. stop the current message transmission, without discarding those fragments that have already been sent. The overhead to implement this mechanism is hence limited to adding 4 bits to each 8-byte fragment Žplus some additional fields in the header of the frame.. As shown in Fig. 4, a special BLOCK frame has been introduced in CANrP to support the transmission technique described above, which is similar to the ISO 11898 data frames but whose data field is organised as a sequence of adjacent message fragments. When the transmission of the block frame is stopped, the node which is currently transmitting the message adds Žimmediately after the stop field. the CRC, ACK and EOF fields to the bits already transmitted. Then, the transmission of the message will be resumed automatically from the point it was abandoned Žwhole fragment boundary. when the bus becomes free again. In this way, a long message can be sent as a sequence of block frames, each one consisting of a number of adjacent fragments. If the message transmission is never interrupted, only one block frame is effectively transmitted. Instead, when the message transmission is repeatedly interrupted, each block frame carries only one fragment. To prevent situations from occurring, in which the block frame is stopped repeatedly before useful data

69

can be effectively transmitted Žsuch a behaviour can reduce the available system bandwidth to an unacceptable level., at least one fragment should be sent for each block frame Žthis is the reason why the stop field has been placed after the fragment data, as shown in Fig. 4a.. If a transmission error is detected, the conventional error management mechanism of CAN is used to stop the current frame transmission and ensure that both the transmitter and all the intended receivers are notified of the error. In this case, all the fragments in the current block frame are discarded and have to be re-transmitted. In CANrP two kinds of fragment are defined, that is to say intermediate ŽIF. and final fragments ŽFF.. All the intermediate fragments contain exactly 8 data bytes, so that it is unnecessary to specify their length explicitly. The last Žfinal. fragment, instead, can contain 1 to 8 user data bytes Žand even 0, if the message is empty. and is not followed by the stop field. In block frames, the length indicator is replaced by an 8-bit-wide field which is interpreted in the following way: the first 5 bits Ž whole fragments number or WFN field. encode the number of full Ž8-byte. fragments included in the frame, while the second part Ž fragment leftoÕers length or FLL field. specifies the number of bytes in the last partial fragment. Furthermore, the RTR bit is given a different meaning to the one in ISO 11898 frames, since it is used to encode the resume transmission bit and specifies whether the block frame initiates a new message transmission or resumes a previously inter-

Fig. 4. Format of the BLOCK frame.

70

G. Cena, A. Valenzanor Computer Standards & Interfaces 22 (2000) 61–74

rupted transmission. In principle, the purpose of the resume transmission bit is unnecessary, however, such a piece of information is very useful so that when the transmission of a block frame is resumed, the synchronisation of the different nodes can be managed correctly. From the point of view of the data-link users, a L_MESSAGE service is provided which can be used to send Žlong. messages. The data-link protocol, on its own, uses the block frames to carry out the effective transmission of the message. In addition, it also takes care of resuming the stopped transmissions in a way which is transparent to the message sender. Block frames can contain up to 31 full frames plus one Žpartial. final frame. In this way, the L_MESSAGE service can be used to transmit messages whose total length is up to 255 bytes, as in most of the currently available fieldbus networks. As can be noted, the L_MESSAGE service does not noticeably worsen the responsiveness of a CAN network: the sending node, in fact, can be Žtemporarily. stopped after each fragment, so that the higher priority frames can be sent as soon as possible. Actually, the message transmission services of CANrP provide two communication modes, which are referred to as connection-oriented and connectionless. A sequence control ŽSC. field is placed immediately before the first fragment and is used by the MAC to implement a sort of error and flow control mechanism. The first bit in SC Ž connection type, or CT bit. specifies whether connection-oriented Žwhen at the dominant level. or connectionless Žif it is recessive. communications have been selected. In the case of connection-oriented communications, the remaining 3 bits in SC can be interpreted either as a sequence number ŽSN. field or as an abort field Žwhich has a format similar to the stop field. depending on whether the block frame is the first of the related message or it resumes a previously stopped transmission. The SN Žsee Fig. 4b. is automatically incremented by one Žmodulo 8. after each message has been exchanged completely and is used to detect missing or duplicated messages. The abort field depicted in Fig. 4c, instead, serves to control the fragment sequencing. When one of the intended receivers of the message detects a block frame which is not in sequence, it simply overwrites

the abort slot with a dominant value, so that the initiator Žtogether with the other receivers. knows something has gone wrong and aborts the current transmission. In this case, the initiator has to retransmit the whole message, because it is assumed that the fragment synchronisation has been lost. Out of sequence block frames can be easily detected by means of the WFN field and the RTR bit. In particular, the data-link layer remembers the number of fragments which still need to be sent for each message whose transmission has been stopped Žand, hence, must be completed. and checks this value against the WFN field in the next block frame related to the same message Žwhich must be set as a resume frame by means of the RTR bit.. This kind of communication scheme requires specific hardware resources Žregisters and filtering circuitry. to be allocated in the network controller for each message to be exchanged Ždifferent streams of messages are tagged by means of the message identifier field. so that they can be used to manage fragment reassembling and sequence checking. The Žsimpler. connectionless solution is mainly provided because it does not require additional resources to be allocated. In this case, the network controller does not have to be able to determine in real-time either whether the sequence of blocks and fragments being received is ordered correctly or if some fragments got missed or duplicated. Hence, this kind of check has to be carried out in software by the data-link layer after the last block frame of the message has been read completely. At that point, in the case when a corrupted message is detected, the data-link layer will request the whole message to be sent again later. When the connectionless communication mode is selected, the SN field can be left unused or, as an option, it can be used by the data-link software to encode a sequence number Žas depicted in Fig. 4b. which is unique for each outstanding message and is checked when the different blocks are reassembled. The connection-oriented mode is supported only when both the sender of the message and its intended receiverŽs. possess the resources needed to correctly manage the SC field Žand, in particular, to set at the right time the abort field.. If not, the transmission automatically switches to the connectionless mode. It should be noted that the above MAC mechanism

G. Cena, A. Valenzanor Computer Standards & Interfaces 22 (2000) 61–74

only takes care of sending Žand reassembling. blocks and fragments correctly. Error and flow control at the message level still have to be performed Žin software. by the upper communication layers Žeither the data-link or the application layer.. As shown in Fig. 5, the block transmission of messages consisting of more than 100 user bytes results in an efficiency level which is about 0.90 in the best case Žthat is to say, when the block frame is never interrupted.. In the worst case, that is to say when the transmission is repeatedly interrupted Žand thus each block frame can carry only one fragment., the efficiency falls to 0.55. In addition, to ensure a fair bandwidth share out among the different nodes, a technique similar to the priority promotion mechanism discussed in Ref. w2x can be adopted. It is a technique which dynamically modifies the priority of the different nodes in order to enforce an overall behaviour which is similar to that of the token-based networks. 3.3. High priority notifications In fieldbus networks, a phenomenon which is known as priority inversion could take place when the transmission of an urgent frame is delayed because a lower priority message is being transmitted. This phenomenon is due to the fact that almost all the MAC mechanisms are not pre-emptive and hence, when a frame transmission is started, it is always allowed to be taken to completion. It should be noted that the priority inversion problem is not particularly

Fig. 5. Transmission efficiency of messages vs. message size.

71

relevant in ISO 11898 networks because of the very limited size of frames. To provide an extremely high level of responsiveness for very urgent Žtime critical. interactions, the basic CAN protocol has been modified in CANrP so that the communication media can be pre-empted by the nodes which need to transmit a frame as soon as possible. In particular, a new alternative set of preemptive transmission services is provided in CANrP Ži.e., L_HDATA, L_HREMOTE, L_HCOMPEL, etc.. which can possibly abort the transmission of the current frame on the network. To do so, these services first initiate Žif needed. the transmission of an ERROR frame which corrupts Žand hence stops abruptly. the current transmission of the lower priority frame and then, immediately afterwards, they transmit the high priority frame Žwhich will possibly be involved in an arbitration phase with other nodes which are waiting to send high priority frames.. In order to let all the nodes in the network know that the error frame was not sent due to a network error, the transmission of the Žhigh priority. frame from the interrupting node begins at the second bit of the intermission time. In this way, the error counters are not incremented as a consequence of the preemption. Since the length of an error frame in CAN takes up to 20 bits, this means that the bus can be pre-empted in a time which is certainly lower than or equal to 21 bit times Žerror frame plus the first bit of intermission.. Pre-emptive services are characterised by two additional parameters: the first Žmaximum interruptible priority, MIP. specifies a priority while the second Žmaximum remaining bytes, MRB. represents a number of bytes. The error frame is effectively transmitted only if a frame is currently being exchanged on the network, the identifier of that frame is Žnumerically. strictly higher than both the MIP and the identifier of the frame to be transmitted and the number of remaining data bytes needed to complete the current frame exchange is strictly greater than MRB Žsuch information are certainly known by each node in the network., so as to ensure very short transmission delays without reducing the efficiency excessively. For reasons of efficiency, the current transmission should not be stopped if the CRC field is already being sent. If MRB is set at 0, for example, the frame can be stopped provided that the last

72

G. Cena, A. Valenzanor Computer Standards & Interfaces 22 (2000) 61–74

byte in the data field has not been already completely exchanged. In CANrP, the pre-emptive services are mainly conceived as a way of interrupting the Žlong. compelled process data exchanges when small-sized very urgent notifications Žcritical alarms. have to be sent. Whenever possible, message transmissions should be preferably interrupted Žgracefully. by means of the mechanism provided for block frames Žthat is to say, using the stop bit.. This can be easily achieved by setting the MRB parameter at a value greater than or equal to 8.

4. CAN r P performance A basic question about CANrP is the following: are the new services really necessary? The answer is that because of its particular medium access technique, the CAN protocol suffers from serious limitations concerning the network extension which, in the next future, could role out this protocol in several application fields. For example, if a bus length of 500 m is considered, the maximum bit rate allowed is as low as 100 kbrs and cannot be improved further, irrespective of the advances in the semiconductor technology. The new services introduced in CANrP are an effective way to increase the throughput of a CAN network by preserving a satisfactory degree of compatibility with the existing devices and applications. As shown before, the improved efficiency of our proposal allows a larger number of periodic variables to be exchanged or, alternatively, a higher sampling rate which helps in improving the precision of the controlled real system. As pointed out at the beginning of the paper, CANrP is not a global solution to any fieldbus application. In fact, to be fair, it must be noted that even though improving the performance of the basic CAN protocol, CANrP suffers from the same drawbacks of CAN concerning the limited network size and maximum bit rate. Hence, when large systems have to be controlled, other solutions must be taken into account. To evaluate the benefits that can be achieved by the adoption of CANrP, let us compare some features of our proposal with the EN50254 protocol

w10x, which is particularly suitable for systems based on the central data scanning approach. When compelled Ži.e., periodic. data exchanges are taken into account, if the same bit rate is considered Ži.e., 500 kbrs., there are no relevant differences between the performance achieved by these two protocols. However, for large plants Ž) 100 m., EN50254 is the preferred solution because of its particular topology and medium access technique which permit larger network extensions. A typical scenario in which CANrP is better is found in small-to-medium plants Žinside a machine or a small production cell.. In this case, in fact, CANrP allows the user to integrate both the Žsynchronous. masterrslave and Žasynchronous. eventdriven communication models on the same physical support. Moreover, it features very efficient message transfer services to be used, for instance, for remote parameterisation or for implementing powerful humanrmachine interfaces. Thus, CANrP is a very satisfactory solution for implementing highly flexible communication supports in systems with a limited extension. The performance of CANrP can be computed for a typical ‘‘real world’’ example. To this extent, let us consider a medium-sized automated cell whose devices are spread over an area which requires a 200 m long network Žthus, according to the CAN rules, the maximum bit rate allowed there is 250 kbrs.. This system is made up of 320 digital IrO points that need to be exchanged periodically and which are grouped into 30 different CAN nodes according to the following schema: 10 = 8 digital inputs, 5 = 16 digital inputs, 10 = 8 digital outputs and 5 = 16 digital outputs w7x Žnote that all these variables fit into one single dataset.. The control scheme adopted is the classical one masterrmany slaves model Žvery common in PLC-based systems. according to the CANopen pre-defined connection set w6x. Let us assume that, on the average, one stuff bit is added by the network controller every 10 protocol bits and that the hardware is fast enough to neglect any processing delay. Moreover, in order to leave enough room to deal with possible retransmissions Ždue to transmission errors. and emergency or asynchronous messages, we require that the periodic traffic only takes 75% of the overall network bandwidth available. In such conditions, the minimum

G. Cena, A. Valenzanor Computer Standards & Interfaces 22 (2000) 61–74

cycle time Žor scan time, according to the PLC terminology. to exchange the variables is the most significant performance index. In the case an asynchronous transmission mode w6x is selected for CAN, where data to be read from slave devices are remotely requested by the master node, the scan time is 14.160 ms. If a synchronous transmission mode w6x is used instead, the scan time decreases to 10.352 ms. It is worth-noting, however, that not all the currently available CANopen devices are able to support the SYNC message. Finally, by using the CANrP protocol, we obtain the shortest scan time which is equal to 3.232 ms. In our analysis, other possible scenarios were considered and the resulting figures demonstrate that in many practical cases the advantage obtained in using CANrP is not negligible.

5. Implementation issues In order to implement the additional services foreseen by the CANrP protocol, some brand new frames have to be defined. The best solution, in this case, is to provide a means by which the format of previously defined frames can be left unmodified, as in the case of the introduction of the extended identifiers w16x. To this extent, it should be noted that the role of the r0 field in ISO 11898 is currently still undefined in the standard frames Žthose with the IDE bit set at 0., and hence, it could be used to tag the new frames. The high efficiency services which are introduced in CANrP require that the data-link layer has to be able to determine, in a very short time, whether the frame which is being exchanged on the network is relevant to the node or not. For example, in the case of the compelled data exchange services, each node which was bound Žeither as a publisher or as a subscriber. to a given dataset must check the identifier of the dataset frame being exchanged and, if a match is found, it should write Žor read. the assigned data slot in the same frame. In the same way, checking for out-of-order fragments in the message transmission services should take place very quickly, so that the abort field can be overwritten correctly. This implies that unlike the conventional CAN, a hardware implementation of the filtering functions is

73

no longer optional but is necessary. Anyway, this is not a serious problem, since nearly all the controller chips available today incorporate more or less sophisticated filtering circuits, whose complexity and functions closely resemble those needed by the CANrP protocol.

6. Conclusions In this paper, a new access technique has been introduced, which is mainly based on the ISO 11898 protocol but also inherits a number of good features from other kinds of fieldbus networks such as Interbus and IEC 61158. The resulting CANrP protocol has the same optimum responsiveness as the original CAN protocol, but features a higher degree of efficiency for periodic process data exchanges which is comparable to Interbus. Moreover, a particular message transfer technique has been conceived which ensures a level of transmission efficiency similar to that of Profibus for the large Žlow priority. messages and enables a completely dynamic management of the available bandwidth. To get a better idea of the benefits which can be achieved, the CANrP protocol has a throughput that, in the operating conditions usually found in factory environments, outperforms CAN by a factor which is about 5 for cyclic process data exchanges and 3 for parameterisation and message transmissions. In the near future, it is highly likely that the cost of developing and producing network controller chips will decrease more rapidly than the cost of the physical communication supports, at least from the point of view of the distributed factory applications. Hence, networks which ensure an optimal use of the available bandwidth Ževen at the cost of a slightly more complex protocol. will probably be the preferred solutions. The substantial improvement in the network performance of CANrP over CAN enables the communication support to be used more efficiently and hence, lower bit rates can be adopted on the network Žas an aside, this also means that wider areas can be covered.. CANrP constitutes a proper superset of the CAN protocol and it is backward compatible with all the existing applications developed for that protocol suite. This means that devices which are based on

74

G. Cena, A. Valenzanor Computer Standards & Interfaces 22 (2000) 61–74

CANrP controller chips can be safely used in CAN networks Žprovided that the new high efficiency services are not used.. Moreover, it should be noted that with a minimum effort Žan intermediate interoperability software layer., most of the applications conceived for other fieldbus networks currently available Žsuch as Profibus, Interbus or WorldFIP. can be adapted to rely on the CANrP communication support. References w1x G. Cena, C. Demartini, A. Valenzano, On the Performances of Two Popular Fieldbuses, Proc. WFCS’97 IEEE Workshop on Factory Communication Systems, Barcelona, Spain, October 1997, pp. 177–186. w2x G. Cena, A. Valenzano, An improved CAN fieldbus for industrial applications, IEEE Transactions on Industrial Electronics 44 Ž4. Ž1997. 553–564. w3x G. Cena, A. Valenzano, Enhancing the efficiency of Controller Area Networks, Proc. ICC’99 6th International Can Conference, Torino, Italy, November 1999. w4x K. Tindell, A. Burns, A. Wellings, Analysis of Hard Real-time Communications, Technical Report YCS 222, Real-Time Systems Research Group, Department of Computer Science, University of York, England. w5x CAN in AUTOMATION International Users and Manufacturers Group, CAN Application Layer ŽCAL., CiArDS201CiArDS205, CiArDS207. w6x CAN in AUTOMATION International Users and Manufacturers Group, CANopen Application Layer and Communication Profile, CiA Draft Standard 301, Revision 4.0, June 1999. w7x CAN in AUTOMATION International Users and Manufacturers Group, CANopen Device Profile for IrO Modules CiA, Draft Standard Proposal 401, Version 1.4, December 1996. w8x European Committee for Electrotechnical Standardisation, General Purpose Field Communication System, Vol. 2 ŽPROFIBUS., EN50170r2, 1996. w9x European Committee for Electrotechnical Standardisation, General Purpose Field Communication System, Vol. 3 ŽFIP., EN50170r3, 1996. w10x European Committee for Electrotechnical Standardisation, High efficiency communication subsystem for small data packages ŽINTERBUS., EN50254, 1998. w11x International Electrotechnical Commission, Electrical equipment of industrial machines — Serial data link for real-time communications between controls and drives ŽSERCOS., IEC 61491 Ž1995-11.. w12x International Electrotechnical Committee, Fieldbus standard for use in industrial control systems: Part 2. Physical layer specification and service definition, IEC 61158-2 Ž1993-12.. w13x International Electrotechnical Committee, Digital data communications for measurement and control — Fieldbus for

w14x

w15x

w16x

w17x

use in industrial control systems: Part 3. Data Link Service Definition, IECrTS 61158-3 Ž1999-03.. International Electrotechnical Committee, Digital data communications for measurement and control — Fieldbus for use in industrial control systems: Part 4. Data Link protocol specification, IECrTS 61158-4 Ž1999-03.. International Standard Organisation, Road vehicles — interchange of digital information — Controller area network ŽCAN. for high-speed communication, ISO 11898, 1993. International Standard Organisation, Road vehicles — interchange of digital information — Controller area network for high-speed communication, Amendment 1, 1995 to ISO 11898, 1993. International Standard Organisation, Information technology — telecommunications and information exchange between systems — local and metropolitan area networks — specific requirements: Part 3. Carrier sense multiple access with collision detection ŽCSMArCD. access method and physical layer specifications, ISOrIEC IS 8802-3.

Gianluca Cena received the Laurea degree in Electronic Engineering from the Polytechnic of Turin in 1991 and the PhD degree in Computer Engineering from the Polytechnic of Turin in 1996. Since 1991, he was involved in research activities at the Computer Engineering Department of the Polytechnic of Turin and has been active in the development of prototype industrial computer networks. In 1995, he became assistant professor at the Computer Engineering Department of the Polytechnic of Turin, where he is currently engaged in research activities concerning communications in manufacturing environments. Dr. Cena is the author of several technical papers in the area of computer communications. His current research interests include communication protocols, metropolitan area networks, industrial communications and, in particular, real-time networks. Adriano Valenzano received the Laurea degree in Electronic Engineering from the Polytechnic of Turin in 1980. From 1980 to 1983, he was with the Department of Systems and Computer Engineering of the Polytechnic of Turin, Turin, Italy, where he was engaged in research on parallel processing, special purpose parallel processors and microprocessor-based local area networks under the Computer Science Program ŽPFI. of the Italian National Research Council ŽCNR.. Since 1983, he has been a researcher with the CNR and, in 1991, he became Director of Research. He is currently with Instituto di Ricerca sull’Ingegneria delle Telecomunicazioni e dell’Informazione ŽIRITI., Polytechnic of Turin, Turin, Italy, where he is responsible for researches concerning distributed systems, local area networks and communication protocols. Adriano Valenzano has coauthored more than 100 journal and conference papers in the area of computer engineering and the books ‘‘Advanced Microprocessor Architectures’’ and ‘‘MAP and TOP Communications: Standards and Applications’’. His current research interests are in the fields of computer networks and communication protocols Žin particular, industrial communications., formal methods for protocol engineering and product data technologies.