Faculty of Engineering and Applied Science
Department of Electronics and Computer Science
Serial Digital Multiplexing of Transducer Data
for Intrinsically Safe Applications
by
Richard Paul Collins
A thesis submitted for the degree of Doctor of Philosophy
UNIVERSITY OF SOUTHAMPTON
September 1990 UNIVERSITY OF SOUTHAMPTON ABSTRACT FACULTY OF ENGINEERING AND APPLIED SCIENCE DEPARTMENT OF ELECTRONICS AND COMPUTER SCIENCE
Doctor of Philosophy SERIAL DIGITAL MULTIPLEXING OF TRANSDUCER DATA FOR INTRINSICALLY SAFE APPLICATIONS by Richard Paul Collins
The galvanic isolation of fibre optic transmission offers a distinct advantage in the design of a telemetry system to meet intrinsic safety requirements. So far the usage of fibre optics in instrumentation systems has been largely confined to the implementation of point to point links due to the difficulties encountered in tapping into an optical fibre. Recent developments in the use of intelligence within instrumentation systems, however, have generally tended to concentrate on the concept of multiplexed signal paths. The aim of the work here has been to realise an intrinsically safe fibre optic multi-drop bus utilising an unbroken fibre as the transmission path. The technique employed involves the modulation of Hght within the fibre using an acoustic wave to vary the characteristics of a multi- mode fibre resulting in a differential phase modulation of the propagating modes. Since the system is unidirectional the use of two-way protocols is precluded and instead the method adopted uses the technique of allowing collisions of data to occur on the basis that they can be detected and the corrupted data can be subsequently ignored. Acknowledgements
I would like to thank my supervisor, Mr J K Atkinson, for his assistance during this
research as well as the other members of the TIDI research group. Thanks are also
due to Sieger Ltd of Poole for their sponsorship of this project as well as to SERC
for the postgraduate studentship. I must also thank my wife, Anita, for her patience,
encouragement and proof reading, my parents for their support over the years, and
finally Tracy for the final draft. Contents
Chapter 1 Introduction 1.1 1.1 Hazardous environment instrumentation 1.1 1.2 Telemetry systems 1.2 1.3 Research objectives 1.8 1.3.1 Programme of work and structure of thesis 1.8
Chapter 2 Transducer Networks 2.1 2.1 Three layer model 2.1 2.1.1 Link level 2.1 2.1.2 Transport 2.3 2.1.3 Application 2.3 2.2 Implementations 2.4 2.2.1 Southampton transducer protocol 2.4 2.2.2 Simple asynchronous protocol 2.10 2.2.3 Fieldbus 2.12
Chapter 3 Fibre Networks 3.1 3.1 Passively tapped buses 3.1 3.2 Actively tapped buses 3.3 3.3 Unidirectional transmission 3.4 3.3.1 Multiplexed tapped buses 3.4 3.3.2 Tap free buses 3.7
Chapter 4 Fibre Modulator Evaluation 4.1 4.1 Fibredyne 4.1 4.1.1 Preliminary Experiments 4.5 4.1.2 Space Diversity Systems 4.8 4.1.3 Optimisation of Depth of Modulation 4.11 4.2 Microbending 4.15
Chapter 5 Stochastic Approach 5.1 5.1 Theoretical Performance 5.3 5.2 Simulation 5.6 5.2.1 Simulation Algorithm 5.10 5.2.2 Random number generation 5.13 5.2.3 Simulation Results 5.15 Chapter 6 RS485 Implementation 6.1 6.1 Slave Bus Stations 6.1 6.2 Bus Receiver 6.6 6.2.1 Interface Hardware 6.9 6.2.2 Interface Software 6.13 6.2.3 Host Software 6.16 6.3 System performance 6.16 6.3.1 Multistation Performance 6.19
Chapter 7 Summary 7.1 7.1 Distributed Control Systems 7.1 7.2 Fibre Optic Telemetry 7.2 7.3 Stochastic Bus Protocol 7.4
Appendix 1 Southampton Transducer Protocol Al.O Interface circuits Al.l Environmental software A1.2 Motor controller software A1.3 Bus test software
Appendix 2 Basic Fibre Theory A2.1 Fibredyne A2.2 Microbending
Appendix 3 SDK51 Receiver test software
Appendix 4 Stochastic bus A4.0 Simulation software A4.1 Slave software A4.2 Interface prototype card circuit A4.3 Interface software A4.4 Host software
Appendix 5 Papers and conference details A5.0 Air motor paper A5.1 Conference paper
Appendix 6 Patent application
References List of Figures
1.0 Means of explosion hazard reduction 1-2 1.1 Centralised data acquisition system 1-7 1.2 Intelligent transducer 1-7 1.3 Decentralised data acquisition system 1.7
2.0 ISO seven layer model 2.2 2.1 Reduced 3 layer model 2.2 2.2 Star bus 2.2 2.3 Ring bus 2.2 2.4 Multidrop bus 2.2 2.5 STP master message formats 2.5 2.6 STP slave response format 2.5 2.7 STP interface units 2.5 2.8 STP environmental system display 2.7 2.9 STP multiaxis motor controller 2.9 2.10 SAP message formats 2.11 2.11 SAP poU response timings 2.13 2.12 SDLC frame formats 2.15 2.13 MIL-STD-1553 frame formats 2.15
3.0 Polished coupler 3.1 3.1 Tapered coupler 3.1 3.2 Wavelength multiplexed highway 3.5 3.3 Time multiplexed fibre optic highway 3.6 3.4 Fibredyne system 3.8
4.0 Trial fibre link 4.3 4.1 Receiver output characteristic 4.4 4.2 PVDF modulator performance 4.6 4.3 Four quadrant receiver 4.7 4.4 Receiver circuit outHne 4.9 4.5 Receiver test system 4.7 4.6 Modulation depth aparatus 4.12 4.7 Multimode fibre mode pattern 4.12 4.8 Multimode fibre modulation depth 4.13 4.9 Two mode fibre mode pattern 4.14 4.10 Six mode fibre mode pattern 4.14 4.11 Six mode fibre modulation depth 4.16 4.12 Two mode fibre modulation depth 4.17 4.13 Microbending modulator response 4.18
5.0 Stochastic bus 5.2 5.1 Stochastic bus transmissions 5.4 5.2 Distribution of transmission attempts 5.7 5.3 Non optimum attempt distribution 5.8 5.4 Non optimum time distribution 5.9 5.5 Simulation algorithm 5.11 5.6 Simulation program output 5.12 5.7 Random number distributions 5.14 5.8 Theoretical vs simulated utilisation 5.16 5.9 Simulated utilisation 5.17
6.0 RS485 test system 6.2 6.1 Packet format 6.2 6.2 Slave bus station 6.3 6.3 Slave station algorithm 6.5 6.4 Slave transmission timings 6.5 6.5 Slave stations 6.7 6.6 Stochastic bus interface controller 6.8 6.7 Manchester receiver 6.10 6.8 CRC checksum verifier 6.11 6.9 Interface logic and microcontroller 6.12 6.10 Bus interface 6.14 6.11 Interface control software 6.15 6.12 Interface host control program 6.17 6.13 Bus host display 6.18 6.14 Multistation performance 6.20 List of tables
1.0 Selection of apparatus according to zone of risk 1-5
2.0 STP environmental system slave configurations 2.7
2.1 STP multiaxis motor controller commands 2.9
4.0 Maximum transmission delays in 2^^ transmissions 4.10
6.0 Single station error rates 6.18 1.1 Chapter 1
1.0 Introduction
This thesis describes a programme of research which has been partly funded by Sieger limited of Poole. Siegers manufacture gas detection and alarm equipment from basic gas sensors and transducers to complete control systems. One of their major markets is the provision of environmental monitoring equipment for use in mining, specifically coal mining and the equipment therefore has to conform to the appropriate hazardous environment safety standards.
1.1 Hazardous Environment Instrumentation
The standards which apply to instrumentation systems are those applied to any electrical installation where there is the risk of an explosive atmosphere, their aim being to reduce the probability of damage or injury to an acceptable level. The fundamental concept behind all the standards is that there should be two independent, improbable events between a safe and an unsafe situation.
For an explosion to develop two things must occur simultaneously [1]:-
(1) There must be a flammable mixture present between its lower explosive limit (LEL) and its upper explosive limit (UEL) of sufficient volume to sustain combustion.
(2) There must be a source of energy sufficient to ignite the mixture.
The explosion risk can therefore be reduced by either allowing ignition but preventing propagation or by preventing ignition (Figure 1.0). In Europe these different design techniques are defined in a range of CENELEC standards published in Britain as BS5501 "Electrical apparatus for potentially explosive atmospheres" [2]. 1.2
Ignition Permitted
Explosion Proof Housing EEx 'd'
Ignition Prevented
No Energy Source Control Atmosphere at Ignition Source
Concentration Isolation of Control Source
Intrinsic Safety Pressurisation Sealing and EEx 'I' EEx 'p' Potting EEx 'n'
Increased Safety Immersion EEx 'e' EEx 'o'
Sand Filling EEx 'q'
Figure 1.0: Means of reducing explosion hazard 1.3
The only technique where ignition is permitted is explosion proof design (EEx'd'[2A]) where any possible source of ignition is within an enclosure which can withstand the pressure generated by an internal explosion. The joints of the enclosure are made long and closely fitting to cool any resulting gas jet to the point where it will not ignite any surrounding gases. The required "flame path" length and permitted temperatures are related to the gas hazard present and for this reason EEx'd' systems are categorised according to gas group. Gas group I corresponds to firedamp (methane and low order hydrocarbons) found in mining, while gas group II relates to the surface industries. Gas group II is itself sub-divided into three subgroups IIA, IIB, IIC corresponding to the maximum experimental safe gap (MESG) in flame paths or the minimum ignition current (MIC) for intrinsically safe design. There is also a restriction placed on the maximum surface temperature permitted on the system and this is given a T class 1-6 corresponding to the range 85°C (T6) to 450°C (Tl). These T classes apply to all the methods of protection.
The methods of ignition prevention are more diverse, Oil immersion (EEx'o'[2B]), Sand filling (EEx'q'[2C]) and Encapsulation (EEx'm'[2D]) isolate any potential ignition source from the potentially explosive atmosphere by a physical barrier, as does pressurisation (EEx'p'[2E]) where the barrier is a constant gas flow away from any ignition source. The other methods of ignition prevention are those based on energy limitation. Increased safety (EEx'e'[2F]) systems are those where the electrical circuits do not produce arcs or sparks in normal operation; terminal boxes are the most common application. The standard specifying minimum creepage and clearance distances and a level of environmental protection (IP54[3]) to ensure that hazardous faults are unlikely to occur.
For active circuits and systems however, the energy limitation principles of Intrinsic safety are more readily applied. The definition of an intrinsically safe circuit to BS5501, part 7 [2G] is "A circuit in which no spark or any thermal effect produced in the test conditions prescribed in this standard (which include normal operating and specified fault conditions) is capable of causing ignition or a given explosive atmosphere". 1.4
This is achieved by restricting the maximum voltages and currents which may occur in a circuit as well as limiting any energy storage devices, such as inductors or capacitors, to below recognised thresholds. AU the permitted values are in fact closely interrelated both to each other and to the gas group of concern. The fault tolerance is achieved by under running all safety critical components and by duplicating or triplicating, corresponding to the classifications 'ib' and 'ia' respectively, all fallible safety components.
When evaluating the type of protection to apply in any given circumstance different techniques are required when an explosive atmosphere is constantly present to those needed when the probability of an explosive atmosphere developing is remote. The approach is to require the equipment to have a lower hazardous fault probability as the probability of an explosive atmosphere increases; this limits the overall risk. The internationally accepted method of implementing this concept is to use an area classification scheme, the location of interest being categorised into 'Zones'. In Great Britain this classification is into three sections BS5345 [4]
'Zone 0': In which an explosive gas or air mixture is continuously present or present for long periods.
'Zone 1': In which an explosive gas or air mixture is likely to occur in normal operation.
'Zone 2': In which an explosive gas or air mixture is not likely to occur in normal operation and if it does occur it will exist only for a short time.
Any other area is deemed non-hazardous and normal electrical installation standards then apply. The types of protection permitted in a given zone are summarised in Table 1.0. It is here that the difference in application of 'ia' and 'ib' certification becomes apparent. In zone 0 an ignitable gas may be constantly present and therefore 'ia' with its two fault tolerance satisfies the 'Two independent events before an unsafe situation' criteria. It is the facility for use in 'Zone 0' together with the cost and size advantages of EExia/ib design which makes I.S design the 1.5 preferred approach to low power instrumentation systems. In some circumstances, notably mining, I.S design is enforced as all non-I.S equipment is turned off in the event of a gas build up. The energy limitation of intrinsically safe design however also applies to a network of separate instruments, where it is possible for the energy distributed among them to be summed. Isolation of devices on a network can hence become an important consideration in a telemetry systems design.
1.2 Telemetry Systems
Until recently analogue transmission has been the basis of the vast majority of industrial telemetry systems. This is partly historical in that no alternative was available when the majority of existing plant was installed and partly due to the effects of standardisation. The existing investment in equipment conforming to analogue standards such as 4-20 mA [5] and 5-15Hz [6] and the general acceptance of these techniques results in a reluctance to change to a new and unproven method unless there is a distinct advantage to the newer approach. The principal factors in the selection of a transmission system are those of economics and noise, analogue transmission requiring the use of a separate cable for each signal (sensor or actuator) on a network. This results in a topology which takes the form of a centralised Data Aquisition System
Zone Type of protection General principle
0 Intrinsic safety EExla Energy limitation Special Protection Special protection
1 Any type suitable for zone 0 Flameproofing EExd Explosion confinement Intrinsic safety EExib Energy limitation Pressurisation EExp Exclude atmosphere Increased safety EExe Refined design Encapsulation EExm Exclude atmosphere Special protection EExs Various
2 Oil immersion EExo Exclude atmosphere Power filling EExq Exclude atmosphere
Table 1.0: Selection of apparatus according to zone of risk 1.6
(DAS) (Figure 1.1) where signals are A/D converted and processed at the central site. This approach can result in a processing bottleneck at the computer interface where many analogue signals have to be converted and sampled all within the minimum acceptable response time of the system.
The development which has allowed alternative approaches is that of the intelligent transducer or smart sensor [7] (Figure 1.2). In this case the signal is digitised at the sensor itself which allows both digital transmission and signal processing at source. This preprocessing may be used to counteract cross sensitivities or non-linearities in the sensing element in ways not readily achieved with the centralised approach. Such sensor based intelligence also allows the use of less ideal cheaper sensing components than could otherwise be used, as well as providing an easier interface to recently developed sensors designed to give a direct digital output [8]. This digital transmission capability when used with a suitable protocol leads to the concept of a decentralised DAS (Figure 1.3) where each sensor has its own processor and a link into a communication network. The physical medium used for the system itself depends on the data rate and the particular environment under consideration. Wire systems are most common although some radio based devices are also now available commercially [9], fibre optics are still to make any major headway in this area for reasons explained later.
Under normal conditions the use of an optical fibre for a transducer instrumentation bus could not normally be justified. The required data rate, and therefore bandwidth, of the bus is generally only a small fraction of the potential offered by the use of fibre. It is this use of the high bandwidth that normally offsets the extra difficulties encountered in using fibre. The property of an optical fibre that alters the situation in this case is the intrinsic safety requirement of a bus for use in a hazardous environment. 1.7
A/B Central Converter Computer
Figure 1.1: Centralised data acqxusition system
A/0 Transducer Multiplexer Microprocessor Converter
Transducer Communication [nterPace
Figure 1.2; Intelligent transducer
Intelligent Transducer
Communications Interface Central Computer
Digital Transmission Network
Figure 1.3: Decentralised data acquisition system 1.8
As previously mentioned one of the requirements of intrinsic safety is the galvanic isolation between individual units on a distributed system to avoid the summing of the energy distributed around a network, which could occur under a fault condition. Some doubts have been expressed about the safety of fibre in a hazardous environment but work so far carried out [10, 11] indicates that the optical power densities normally encountered are unlikely to induce ignition of an explosive gas mixture.
1.3 Research Objectives
The aim of this research program has been to realise a fibre optic telemetry system for the transmission of environmental monitoring data in a mining environment v/ith all its inherent restrictions. The network had therefore to be compatible with the isolation and power requirements of Intrinsically Safe design, low power consumption also being necessary due to the battery backup requirement of safety systems. The geography of most mine installations favours multidrop structures which can be easily reconfigured as the mine is extended as a part of normal operations, this however needs to be achieved with the minimum number of interconnections due to the problems of forming a reliable low loss fibre connection underground.
1.3.1 Programme of Work and Structure of Thesis
The initial phase of the research programme consisted of an assessment of existing and newly emerging telemetry systems for use in industrial environments. At that time very few digital systems existed, most instrumentation signalling being via analogue transmission schemes. Significant effort was subsequently required in the development of systems for Southampton Transducer Protocol (STP), a RS485 based multidrop bus, and the Simple Asynchronous Protocol (SAP), a transformer isolated, FSK, intrinsically safe multidrop bus. These activities are detailed in Chapter 2.
In conjunction with the assessment of existing wire systems, an investigation of optical techniques applicable to a fibre multidrop bus suitable for use in distributed 1.9 instrumentation systems was also performed. The results of the fibre optic investigations in Chapter 3 indicated a need for a system using unbroken fibre with some form of intrinsic fibre modulation scheme. Two different modulation methods were then researched and evaluated as described in Chapter 4.
The outcome of the fibre optic work on unbroken fibre modulation was the need for a transmission protocol suitable for use on a unidirectional transmission channel. The system developed uses a stochastic time division multiplexing technique which was derived and then simulated to verify the expected performance, as detailed in Chapter 5.
Chapter 6 describes a RS485 based implementation of the stochastic protocol which used twisted pair as the physical link. This evaluation/demonstration network was based on a custom designed interface card for a host computer and a number of microcontroller based outstations. The resulting system proved not only the viability of the stochastic bus but had sufficient potential as a novel telemetry technique to be patented for commercial exploitation (Appendix 6). 2.1 Chapter 2 Transducer networks
The problem of defining and implementing a digital communication network is not a trivial one due to the large number of system parameters open to selection. To overcome the problems of complexity and incompatibility that can arise as a result the international standards organisation (ISO) proposed a 7 layer model (Figure 2.0) [12] as a guide in communications systems design. The model separates out the various system functions from the application data at the highest level to the physical link at the lowest. The division of function is now accepted as the optimum approach to network design although few implementations use all 7 layers; in most cases layers are merged or subdivided to optimise performance.
2.1 Three layer model
For an instrumentation bus the complexity of the full ISO model is unnecessary and may be too restricting for real time control applications. Under these circumstances the middle layers may be collapsed down into a single layer giving a simplified 3 layer model of link, transport, and application (Figure 2.1)
2.1.1 Link Level
The link level provides the physical connection between nodes on the system and defines the signalling system to be used. There are an almost limitless number of possible topologies available when constructing a network but they can usually all be described in terms of a few standard structures. The previously described centralised DAS is an example of a star network (Figure 2.2) where connections radiate out from a central node. This is in many ways the easiest to use, there being no need for the inclusion of identification information in the data transmissions since the source is given implicitly by the link from which it derived, although it is possible to confuse the inputs at configuration. This can be overcome in a digital system by making all transducers self identifying. 2.2
Application
Presentation
Session
Transport
Network Application Data
Transport Data link Mechanlsn Physical Physical Link
Figure 2.0: ISO seven layer model Figure 2.1: Reduced 3 layer model
N-1 N-1
Figure 2.2: Star bus Figure 2.3: Ring bus
N-1
Figure 2.4: Multidrop bus 2.3
Ring structures (Figure 2.3) use a different strategy where data passes cyclically around the network between active nodes. The chief disadvantage of such a system is one of reliability; although reconfigurable rings have been developed to cope with link failure, the susceptibility of the whole system to collapse on a node fault is still a largely unsolved problem. The most common topology is that of the multidrop bus (Figure 2.4) which is emerging as the preferred form and is the basis of most of the proposed and recently developed systems.
2.1.2 Transport
The transport layer provides a mechanism for the transfer of data between nodes which is transparent to the application data and the processes which utilise it. The mechanism is responsible for the detection and correction of errors and proper ordering and priority handling of the data transmissions over the network. The possible options for the transport layer are, as in the link layer, numerous: token passing, master slave polling and ethemet style approaches have all been utilised in various forms.
2.1.3 Application
The application layer is the one most open to interpretation and the area where standards are least likely to be achieved. Modem digital instruments are capable of returning considerably more information than a pure instrument reading (type, range, internal status, battery condition etc.) and each manufacturer will assign different priorities and forms of data representation to these various parameters. Most application standards that have been so far developed are therefore normally specific to a supplier but the isolation of application and transport operations in a system allow different devices to still use the same network. 2.4
2.2 Implementations
The application of the three layer model can best be illustrated by the various protocols that have already been developed in the instrumentation field and fit the ideal to a greater or lesser extent.
2.2.1 Southampton Transducer Protocol
The Southampton Transducer Protocol (STP) [13] does not conform to the ISO layer model but instead combines the transport and application layers by using a simple message passing technique, the link being multidrop bus based on RS485 differential transmission [14]. The protocol itself is a single master multiple slave system where each slave has a unique address and may only transmit on the bus in response to a request from the master. The data is transmitted in packets and is byte orientated using an ASCII [15] representation of the data and address information. Master transmissions (Figure 2.5) consist of a start character which identifies it as firom the master, a three digit address field and a command code. The code type indicates the size of the optional data field when appropriate and the packet is terminated by two control characters. The slave response (Figure 2.6) is again started by a unique start character which indicates its source as a slave and should therefore be ignored by other slaves on the system. The start byte is followed by the address, a transducer type code, a two byte data format descriptor and the duplicated data field. Transmissions are again terminated by two control characters. Using ASCII within the protocol eliminates the need for byte stuffing (to avoid data bytes being received as control bytes) and allows the direct monitoring of bus traffic. The disadvantages of such a technique are the inefficiency resulting from the redundancy inherent in an ASCII coded data format and the inclusion of protocol information (e.g. packet length) in the data field.
Byte serial transmissions, as the link level of STP, enables standard computer hardware to be used for the master station, and single chip microcontrollers for the individual slave stations. This reduces the additional overhead of supporting the protocol within an "intelligent instrument" to mainly a software cost, with a minimal 2.5
N N N C D D D D '"sj
X = Unique start character N = Address C = Command D = optional data field = Message, termination
Figure 2.5: SP master message formats
N N N T T F F D D |D l-F
1 = Unique start character N = Address F = Data format D = Optional data field c^F= Message termination
Figure 2.6; STP slave response format
RS232 RS485
TXD
Data RS485 Level Direction Driver Translator RXD
BUS MASTER Master Interface
RS232 RS485
RS485 Data — Level Driver Translator Direction RXD
BUS MONITOR Bus monitor Interface
Figure 2.7: STP interface units 2.6 additional hardware requirement, STP systems having been developed for both monitoring and control based on this principle. The physical link in these cases has been a twin twisted pair cable of up to 500 meters, one pair providing the signal the second a +15V unregulated power supply, the cable screen being used as a OV return. To allow interconnection of the bus to a standard RS232 serial port, level translators have been developed to perform the required conversion, the RS232 RTS signal being used as the data direction control line at the master (Figure 2.7). A simplified version of this unit was then used to interface a standard terminal to the bus as a system monitor (Appendix 1.0).
2.2.1.1 Environmental Monitoring System
The environmental monitoring system was configured to collect and display data from 4 slave stations (Table 2.1) on the 500m multidrop bus. The master station was a microcomputer programmed to poll each slave in turn, to validate the reply and display graphically the resulting data (Figure 2.8). Transmissions on the bus were at 1200 baud with a maximum allowed response delay and interbyte time out period of 0.5 seconds. The main program core (Appendix 1.1) is an mfimte loop which, after initialisation of internal variables and generation of the display screen, polls each of the four configured addresses in turn, waiting for either a valid reply or a time-out to occur, each address being tried three times before being flagged as an error. To minimise execution time of the poll routines, all serial control and timer handling was performed by assembler interrupt routines, the operating system handlers being disabled. The system served to illustrate several of the advantages of a digital system for communicating with remote transducers as well as highlighting some of the problems inherent in the STP message passing technique. The obvious advantage of the system is the use of a single cable to monitor several transducers which return their readings in standard linearised units. Disadvantages with the system are also apparent especially those arising from the combming of application and protocol information within the message format. This is most clearly illustrated by the replies from the magnetic field and temperature sensors both have their data fields described as D3 (three decimal digits) when the magnetic sensor in fact replies with a four digit data field (three decimal digits plus sign). To correctly receive these two formats requires the protocol to know which data format to expect 2.7
Magnetic Field Address 100
-0.5 W. 5
Temperature Address 100
0 50 100
Resistance change Address 300
0 50 100
Flow Address 400
Figure 2.8: STP environmental system display
Sensor Type Address Poll Reply Magnetic Field 100 *100M : 100MTD3 ± DDD ± DDDCj^Lp Temperature loo *100T : 100MTD3DDDDDDCj^Lp Strain (R) 300 *300T :300RKD3DDDDDDCj^Lp Flow 400 *400T :400FLD3DDDDDDCj^Lp
Table 2.0: STP Environmental System Slave Configurations 2.8 from each sensor type and the transport and application layers are no longer transparent to each other and the protocol software is no longer readily configurable to accept other sensor types. Even with these problems however such message passing techniques have found application in distributed gas detection systems although RS485, not being galvanically isolated, cannot be designed I.S and EExd (explosion proof) design has had to be used as the protection form.
2.2.1.2 Multiaxis Motor Control
A development of the initial STP system was a more complex master program to perform the task of a multiaxis control of processor regulated air motors (Appendix 1.2, paper 1). In operation the bus master downloads a set of commands to each motor together with appropriate data (Figure 2.9) from data tables previously created by an operator at the master station. The local motor controller then carries out the requested task returning a command accepted response when completed. The system could cater for up to 10 motors together with an air resevoir pressure sensor which could be trapped on the fly by the motor controllers for their internal use.
2.2.1.3 Response Time
One of the most important considerations in a transducer monitoring system is the maximum time that could elapse between a sensor changing state and that information arriving at the master station. For the environmental system these figures can be derived from the bus data rate and the known packet lengths assuming the transmissions are fault free and all stations take their maximum permitted reply time out. The assumption is also made that the interbyte time period is 0, readily achieved with the use of double buffered uarts and that delays in the master program are not the limiting factor on poll rate.
The complete poll cycle for the four stations requires the transmission of 86 bytes of data (20 from the master and 66 from the slaves) and four 0.5 second delays, giving a total time of 2.71 seconds (10 bits per byte, 1200 baud). From this figure it is clear that even at the low data rates employed the delay in response contributes 2.9
FREE MENORf 241 DIRECTION : SPEEB
Forward Reverse Forward
CONHNDS FILE TABLE EXECUTION 6EKRAI I Load file C Create table R run sequence R Help ciiwwds S Save file M Modify table P Procede T Type file S Generate E Examine table I Bait proyra* Cewiand ? A Advance table
CoMiand complete. . % I l1 21 31 41 SI (• 71 N M IN Presme
Figure 2.9: STP miiltiaxis motor controller
S Speed (RPM) A Acceleration/Deceleration D Direction R Number of Revolutions C Number of Consecutive Events W Wait Time Between Events G Go T Poll Motor Status
Table 2.1: STP Multiaxis Motor Control Commands 2.10 most to the bus delay. At higher bit rates this becomes even more apparent (2.09 seconds at 9600 baud); in all cases however the maximum response delay is a linear function of the number of stations configured.
2.2.2 Simple Asynchronous Protocol
The Simple Asynchronous protocol (SAP) [16] is yet another example of this type of transmission standard, having been developed by the National Coal Board (now British Coal) for use as a low bit rate transmission system in coal mines and more closely fits the three layer model. The standard's aims were to promote compatibility between different manufacturers' control and monitoring equipment in a similar manner to that achieved in the analogue transmission field by BS5745 [17], whilst overcoming the inherent problems with analogue transmission systems notably in this case the lack of galvanic isolation between individual units.
The SAP specification covers both the physical (link) and transport components for either a point to point or a multidrop network and again uses a single master multiple slave protocol. The link uses either optical isolation or transformer coupled FSK to provide the required isolation both systems operating at 600 bits sec. The protocol itself differs from STP by separating the transport mechanism from the application data using different message types (figure 2.10) for the purposes of link control and data transfer. All transactions are initiated by the master which polls each slave in turn, the polling sequence being determined by the status (Active or Failed) of the configured stations in the system. The response may be a link control message or, if data is ready for transfer, an application data message of up to 128 bytes of data. To improve the response time of the system transfers of data from the master to the slave occur asynchronously to the main polling sequence, ADMs directed at particular slaves on the bus may therefore occur, within certain restrictions, at any time, the pending poU being inserted within the ADM frame. To allow the identification of such polls within the frame, byte stuffing of all data bytes matching control bytes is used within the data field. The stuffed byte being replaced by a control byte and a modified data byte, the reverse operation being performed on reception. The application data format itself is not defined within the SAP specifications and is completely independent of the transport mechanism employed. 2.11
SAP Message Formats
Sent First SMB
AB
ADD
ADF
CFH
CFL Sent Last
Applications Data message or Broadcast Message
Sent First SMB
AB Sent Last
Link control or initialisation message format
Figure 2.10; SAP message formats 2.12
The structure allows data from or to several different devices at the same station to be encoded and is defined in an internal NCB document [18]. The only reflection of this within the SAP standard is that due to the low bit rate employed a changes only protocol is adopted where data is only transmitted when it has changed in value by more than some predetermined amount.
2.2.2.1 Response time
The worst case response time for a SAP system is more difficult to calculate due to the master inserting polls within a transmitted application data frame and the restrictions placed on polling a slave whilst it is receiving a ADM. There is also the added complexity of a variable ADM message length all bytes of which could be stuffed. Assuming the worst case situation however, but without transmission errors, for a fully configured 15 station system each transmitting 128 bytes of data all of which require stuffing a single poll on a modem link takes 2960 bit periods corresponding to 4.93 seconds. For a 15 slave network this results in an overall poll cycle time of 1 minute 14 seconds. This worst case is very unlikely to occur; most slave stations would transmit less than 128 bytes of data and only a few would be stuffed. A more realistic case of 16 byte fields with 1 stuff byte translates to a single poll duration of 298 bits or 0.496 seconds, 7.45 seconds for all 15 configured stations. The use of a changes only protocol would further reduce the likely data transfer rate as only a few of the configured stations would be likely to have data to send in any poll cycle. The effect of slave response length to poll duration is summarised in Figure 2.11. The effect of varying the bit rate is harder to calculate as some transmission timings are expressed in the SAP standard in terms of time, others in terms of bit rate; the scaling would excluding these modem timings scale linearly with bit rate.
2.2.3 Fieldbus
The proposed fieldbus standard [19] is to be a subset of the manufacturing automation protocol (MAP) [20] which is a full implementation of the 7 layer model designed to provide a plant wide data highway for information of all forms. The overhead of passing data through such a complex system can however be 2.13
BS6556 SAP Response Times Poll Durations
Duration Bit periods 10000 c
1000
100
10 -J 1—I—I I I I I I I 1 I I I I I I 10 100 1000 Transmission Length Bytes r Master Tx 2 Bytes
T6 L Master RLSD
T2
Slave RTS T5
T3
Slave RFS
2 Byte periods '/ T4
!%ave TX 23 Bit periods n&x 2-264 Bytes L Byte Period Max
Figure 2.11: SAP poll response timings 2.14 considerable. Fieldbus, which fits the three layer model, is envisaged as providing a local subnetwork of the main MAP systems for the interconnection of "intelligent" field mounted sensors or actuators. The motivations for replacement of the current 4-20mA standard are similar to those behind the introduction of SAP over the 0.4-2V technique. Application data on the fieldbus will be of limited resolution (typically 16 bits) while following the MAP message format standard (MMFS). A derivative of MMFS is proposed as the lEA draft standard 1393A (RS511) but this is unlikely to define data fields down to the level of specific transducers.
The fieldbus network topology will be a multidrop bus either as a single trunk with spurs or as a daisy chain, a typical total length being 350m in a process control application. To minimise single point failures all station attachment points are passive and additionally in all implementations there is to be a minimum 500V isolation between the "final elements" (sensors or actuators) and the rest of the station. The maximum permitted number of such final elements on a single field bus is provisionally set at 60 which implies that more than one final element may be present at any one station, the upper Umit on stations being 30. This is the same approach as that taken in both the STP and SAP protocols to reduce the cost per "final element" of the protocol Hnk support hardware. The field bus link level is still to be defined; however two existing techniques are emerging as likely candidates namely SDLC [21] and MIL-STD 1553 [22] based systems although other working groups are proposing further alternatives [23].
2.2.3.1 SDLC
Unlike the previously outlined link layers SDLC (Synchronous Data Link Control) and its derivative HDLC (High level Data Link Control) are bit orientated rather than byte orientated protocols. The SDLC packet format (Figure 2.12) consists of a flag, address, control, and check sum fields (based on the polynomial X^^+X^^+X^ + 1) and a variable length data field. This format would result in a problem if the flag bit sequence 01111110 should occur in any of the other fields, so bit stuffing is used, a 0 bit being inserted after any sequence of five consecutive ones. In HDLC the packet format is changed to allow extended addressing and it is this extended format which is proposed by the National Coal Board [24] as a 2.15
Multiples of eight bits (128 Bytes Max)
Sent First Sent last
01111110 8 Bits 8 Bits 16 Bits 01111110 LSB LSB MSB FLAG ADDRESS CONTROL // FRAME CHECK SEQUENCE FLAG
Figure 2.12; SDLC frame formats
8 10 11 12 13 14 15 16 17 18 19 20
Command Word
5 1 5 5 1
Sync Remote Subaddress/ Data word P Terminal ,mode count/node Address code
Data wo rd 16 1
Sync Data
Figure 2.13: MIL-STD-1553 frame formats 2.16 higher bit rate component (64Kbits/sec) in their mine data network, of which SAP forms the low bit rate component.
2.2.3.2 MIL-STD-1553
MIL-STD-1553 is a standard developed in the early seventies to provide a serial time division multiplexed data bus for use within an aircraft to allow integration of the various aircraft subsystems. Its use for other applications has however grown due mainly to its use of inexpensive twisted pair cable [25]. Transfers on the bus are of the command response format under the control of a bus master; the function of bus master may however be passed to another station if required. Bus messages (Figure 2.13) are 20 bit periods long and use manchester encoding which has the advantage of being both self clocking and transformer coupleable. Message start is indicated by a three bit period synch waveform the polarity of which differentiates between a command/status or data word. The proposed derivative of 1553 for use in field bus [26] envisages transactions on the bus of up to 32 16 bit data words at either 250Kbits/sec or IMbits/sec dependent on bus length and topology.
2.2.3.3 Response times
The derivation of response times for a field bus installation is difficult as there is not yet a definitive bus standard. The draft requirements do however propose a range of performance figures dependent on the particular application and bus length. For a 30m bus the range is from a minimum of 150 messages a second in a process control environment to a maximum of 10,000 messages a second in manufacturing automation. Shorter bus lengths increases the minimum rate to 5000 messages a second with no maximum being specified. In addition to these message rate figures there is also a limit placed on the time delay between a message being ready to transmit and the data being received of 20 milliseconds in process control, 5 milliseconds in manufacturing automation. At low message rates these figures are obviously not obtainable as a fully configured system of 30 stations at 150 messages a second could take 0.2 seconds to interrogate all the configured devices. The response time requirement is therefore relaxed in the draft requirements for low bit rate media. 3.1 Chapter 3 Fibre Networks
When implementing a fibre bus the obvious approach is to treat it in an analogous manner to a wire transmission line and use similar protocols and interconnection techniques. Unlike wire systems, however, there is no equivalent of a high impedance tap to an optical fibre. To read or write to a fibre it is either necessary to break it or to use some form of coupler. The two most popular forms of coupler are described below.
(1) Polished Couplers
In this case the fibres to be coupled are polished to remove some of the outer cladding (glass layer) to expose the core. The two fibres are then butted side on as shown in (Figure 3.0) [27]. It is possible to alter the coupling ratio of such a coupler by mechanical displacement of the fibres.
(2) Tapered Couplers
In this case the two fibres are twisted together and stretched while molten [28], the coupling ratio being set during manufacture. (Figure 3.1).
Due to optical fibre acting in the manner of a waveguide rather than a simple wire transmission line, fibre couplers also differ from v^dre taps in that they are generally unidirectional in operation.
3.1 Passively tapped Busses
The insertion losses of the type of T-Couplers described above are at present of the order of 1-2 dB and it is this loss together with the low power densities and poor receiver sensitivities, compared to non-optical systems, that limits system size [29]. Those systems that have been constructed fall into two main categories:- 3.2
Figure 3.0: Polished coupler
Fused Where Touching
Figure 3.1: Tapered coupler 3.3
(1) In the star bus all fibres are terminated at a common tapered coupler which at present may have up to 100 connected fibres. Optical power in the system is distributed evenly between all the taps and this eliminates the dynamic range problems of some of the other bus structures. The disadvantage of the star bus is that each tap requires its own run of fibre from the transducer to the central point.
(2) The T-bus more closely resembles a standard "bus" format and systems with around 10 taps have been reported [30]. The problem with the T-bus is that losses accumulate along the length of the bus resulting in signals from different points being at different power levels. To counteract this effect the coupling ratios at each tap can be adjusted as a function of the tap position on the bus although this system tuning restricts reconfiguration of the system. By taking this approach the maximum number of taps can be increased to around 40 although this figure is likely to increase as the coupler losses are brought down.
One final system which borders between active and passive taps is a bus that uses optically active crystals to tap ofi" and modulate light passing in a fibre [31]. At present the loss at each tap is 6dB (this can theoretically be improved to a minimum of 1.9dB). This approach is therefore unfortunately not conducive to a large number of taps.
3.2 Actively Tapped Buses
To overcome the power loss and dynamic range limitations of passive taps a common solution is to use an active repeater at each point. The signal is received and regenerated at each tap eliminating the additive losses of the T-bus. The price paid for this signal conditioning is a lower reliability, a susceptibility for total system failure if an individual node fails, and higher power consumption which can cause problems when the equipment is required to be intrinsically safe. A hybrid between an active and a passively tapped bus has been developed as a local area network and uses a combination of 25 receivers at a central node whose outputs are combined 3.4 and used to drive a single input to a 25 way star coupler. This gives an improvement in signal to each remote station of 61 db over the equivalent 25 standard taps in series. The bus does suffer from the inherent problem of star buses however : long cable runs.
3.3 Unidirectional Transmissions
Possible alternatives to the above systems become apparent when it is realised that for many applications the bus only needs to carry data from sensors to the host and that although the ability to address individual transducers may be useful it is not essential. The need for transducers to communicate with each other is often not required. This opens up the possibility of using time or frequency division multiplexing of the transducers onto the bus in a simpler form.
3.3.1 Multiplexed Tapped Buses
The majority of multiplexed buses suffer the same problems as conventional tapped buses as they use similar coupling techniques. In the case of frequency division multiplexing [33] each sensor is connected to the bus via a frequency selective tap, the host then transmits a different frequency signal to each and monitors the return signal which is normally modulated in intensity (Figure 3.2). In this system loss is not the limiting factor on sensor numbers. The problem in this case is the provision of the selective taps and multiplexers; they are an offshoot of developments in high capacity telecommunications and a maximum of four channels is at present the norm.
Time division multiplexed systems generally use either the reflection of a pulse of light from the host or the transmission of the pulse back via a separate fibre [33] (Figure 3.3). The reflected pulse from each transducer is identified by the time delay between the initial source pulse and the reflection. The system still uses couplers however and losses are generally too high for more than a very small number of stations. 3.5
Wavelength Multiplexer Wavelength selective tap for
Wavelength Demultiplexer Wavelength selective tap for
SN
Figure 3.2: Wavelength multiplexed fibre optic highway 3.6
Sensors
JT 0
Pulsed optical source Reflected pulse train
Reflection Time Multiplexed Sensor highway
Pulsed optical source
Sensors ( gA ( gg) ( ss)
Pulse Train
Transnissive Time Multiplexed Sensor Highway
Figure 3.3: Time multiplexed fibre optic highway 3.7 3.3.2 Tap Free Buses
The major problem with all the above systems is that of power loss at taps which severely restrict the number of transducers that can be connected without using repeaters. A method of overcoming this problem is to modulate light passing through the fibre directly. The two parameters of light that can be modulated most easily in this manner are intensity and phase; polarisation modulation is possible however using special fibres that preserve polarisation information. The major problem with tap free buses is that individual transducers cannot read what is on the bus at a given time.
Intensity modulation is achieved by micro-bending induced loss [34] where the fibre is held in a ridged clamp that bends the fibre and allows light to couple from the core to the cladding and thereby escape. A micro-bending system has been implemented [35] whereby light is launched into a fibre as a short pulse and the backscatter from the fibre as a function of time can then be used to identify the position and state of each point on the bus. The problem with the system is the complex signal processing required at the receiver which must be performed in real time; such a system is therefore unlikely to be a viable proposition although it is conceptually elegant.
Phase modulation of light in the fibre can be performed by an ultrasonic source clamped to the fibre. If using multimode fibre and the light in the fibre is coherent, then individual modes are changed differently by the refractive index variations induced by the sound wave. When all the modes in the fibre are summed at a detector the result is an AM modulated signal. A transducer bus based on phase modulation has already been constructed [36] which uses standard fibre with modulators that clip onto it and modulate the light through the cladding. The Fibredyne system, as it is known, has a projected length of greater than 10 Km with up to 50 clip on modulators. (Figure 3.4). The limitations on the number of channels is imposed by the need to use filtering to separate out each channel as well as each channel's individual bandwidth requirements. 3.8
Laser Signal Receiver Cabled Fibre a ^ i ^ Fl F2 FN
FSK
D1 D2 ON
F1
01 02 ON
Figure 3.4: Fibredyne system 4.1 Chapter 4 Fibre Modulator Evaluation
The concept of the Stochastic bus, such as that described in Chapter 5, is based on the idea of a passive connection to the fibre which must modulate some parameter of the light propagating through it. Techniques have been demonstrated to intrinsically modulate the phase [37], polarisation [38] and intensity [39] of a light signal with varying degrees of complexity. Due to the increased difficulty in forming low loss connections between single mode fibres compared to multimode [40] as weU as the increased cost, a passive modulation technique suitable for use on multimode fibre was sought. The use of multimode fibre excludes the use of polarisation modulation as polarisation information is not preserved in this fibre, neither is it preserved in standard single mode fibre. Phase modulation can be acoustically induced into a fibre (either cabled or uncabled) by using a simple acoustic transducer [41]. Intensity modulation can be readily induced into a bare fibre by microbending [42] which couples light firom propagating to lossy cladding modes. The need to access the bare fibre means it would be less practical than phase modulation in this application.
The choice of the digital carrier modulation scheme to use with these possible techniques is limited, particularly with phase modulation, by the fading nature of the received signal which reduces the efficiency of coherent detection techniques [43]. The two main alternatives are incoherent amplitude shift keying or incoherent frequency shift keying. The error probability for a given signal to noise ratio is reduced for the latter technique [44] and this was the method chosen for the initial trials.
4.1 Fibredyne
The term fibredyne is an abbreviation for fibre-optic- self-homodyne, different modes being used to reference each other for demodulation. When a multimode fibre carrying coherent light is subjected to a change in length, refractive index or diameter (normally a combination of all three) the modes are differentially phase 4.2 modulated. This results in changes in the interference pattern at the photodetector giving an amplitude variation.
The property of the resulting signal which is of primary importance is its dependence on the random phases between the interfering modes. In a fibre there will be a large number of modes which will be phase modulated with different random phases and modulation depths. The effect of this is to cause random fades in the received signal level which may disappear altogether. There are however several approaches to improving this fading problem in a digital system using frequency shift keying [45];
1) The random phases can be deliberately forced to cycle by more than 2 within each bit period by mechanically deforming the fibre at a frequency several times the bit rate. The required signal should then maximise sometime within the bit interval. Using an ultrasonic modulator enables bit rates in excess of >100 kbits/sec to be received with this method.
2) A different approach, again mechanical, is to move the photodetector in the output field. Fades in one area of the interference pattern are usually accompanied by signal increases in another; if the scan is done in less than one bit period the signal will maximize some time in the interval. In this case however the maximum frequency is limited by the maximum scan rate of the fibre end over the detector.
3) The final approach is to use a form of space diversity by placing more than one detector in the output field. Due to the bipolar detection characteristic the signals from the separate detectors wiU either be inphase or 180° out of phase and it is therefore possible to combine them to give a more stable output. Systems using a 4 quadrant detector have shown an improvement in fade depth from 70dbm to 14dbm and for 99.99% of the time the signal level will be within 6dbm of its mean value [46]. The improvement in bit error rate is not as great as in the previous two approaches, however, due to the correlation in fading between the signals from the separate detectors. 4.3
4.1.1 Preliminary experiments
The initial experiments carried out into the fibredyne effect were performed to check on the levels of signal fading and the ease of setting up such a system. The initial fibre link was constructed of a few metres of 65/125um multimode optical fibre. The source was a spectra-physics 155A ImW unpolarised HeNe laser launched into the fibre via a 10 x 0.25 microscope objective mounted on a single mode multiaxis positioner for alignment, the detector being a BPX 65 PIN photodiode together with a xlO^ transimpedance amplifier. The phase modulation was induced onto the fibre by clamping it between a 40KHz ultrasonic transmitter and receiver, the receiver providing an indication of the signal level being generated (Figure 4.0).
The output from the detector, with a lOV pk-pk modulator drive consisted of a lOmV pk distorted 40KHz waveform on a 1.2V dc bias level. To remove the dc component and amplify the output signal a 40KHz 4th order biquad bandpass filter was then added with a maximum gain of 36db in the pass band. The signal obtained was, as expected, subject to deep random fades in amplitude which, when the fibre was undisturbed, had a period in the order of seconds. Disturbing the fibre, however, resulted in sharp jumps in the received signal making it difficult to measure. Only peak values could be reliably obtained (Figure 4.1) but these showed a linear increase in output level for increasing modulator drive voltage over the range of input powers available. The observed background noise level at the filter output was approximately SmV.
4.1.1.1 PVDF Modulator
One of the problems encountered with the ceramic piezo- electric modulators being used in the initial experiments was their operating bandwidth, the output power being 3db down at ± IKHz from nominal. As an alternative the piezo-electric polymer polyvinyldynefioride [47] was investigated as it has a very flat response over a wide frequency range [48]. A metaHsed PVDF film was sandwiched between the ceramic piezo-electric transmitter and the fibre from the previous experiments to allow a comparative test of the two sources by switching the drive signal between them. The detected signal from the PVDF modulator was considerably down on that 4.4
Launch Fibre Laser Op-tics
40 KHz
Receiver
Monitor Signal
Output AnpUfier
Figure 4.0: Trial fibre link 4.5
I 0) m SI
m g
0 2 C3 CO CD k. o
o g SI
c CO
Figure 4.1: Receiver output characteristic 4.6 from the resonant device at its peak frequency (Figure 4.2) although the resonant device's output fell rapidly with frequency deviation. The polymer was therefore discounted in spite of its bandwidth advantages as the loss of signal could not be accommodated. The efficiency of the PVDF modulator could possibly have been increased by using alternative structures [49] but this would have been at the expense of not being able to clamp the modulator onto the fibre where required.
4.1.2 Space Diversity Systems
To improve the signal fading problem a space diversity system was constructed (Figure 4.3), the single photodetector from the previous experiments being replaced by a 4 quadrant device. The detector was a centronic type QD-7-0 with a 3mm diameter element, 7mm^ of active area. The quantum efficiency of the detector at the HeNe wavelength of 633nm was approximately 55% giving a responsivity of 0.2794 amps/W. This figure was then used to calculate the required gain of each of the four preamplifiers, one for each quadrant. Assuming a 50% launch efficiency from the laser and an unrealistic 100% of the output falling on the active detector surface, a maximum detector output of 35uA could be expected. This current was converted into a maximum 3.5V by a xlO^ transimpedence amplifier.
The outputs from the preamplifiers were, as previously, a low level ac component on a large dc offset so the signal was again bandpass filtered. The circuit for the filters was changed from the biquad previously used to a dual amplifier bandpass structure DABS (Figure 4.4). This reduced the number of amplifiers needed in the filters from 6 to 4 and had the advantage over a Sallen and Key circuit of only needing variable resistors rather than variable capacitors for tuning. The filters were set up to have a flat response between 39 and 41 KHz to allow for up to ± iKHz of FSK modulation from the nominal 40KHz piezo-electric modulator centre frequency. The modulator output itself is 3db down at this point. The outputs from the four filters were then all frequency doubled by MCI496 balanced modulators to bring the four channels into phase synchronisation. The signals were then summed before being filtered by another DABS filter this time tuned to 80KHz with a flat response from 78-82 KHz. 4.7
(D O C o £ L_ 3 O GO U M— CD o ^^ O> QLt- 0_ CD > Q <0 d. cn L_ _a -2 Q >"o •o -5 ^ > L_ > v_ o O O 'u 3 c -a "O a o o (D c > o c (A a CD c o Qi o Figure 4.2: PVDF modulator performance 4.8 Frequency Amplifier Doubler 40 KHz N Sunning AmpUf!er CXv DATA OUT rSK Benodulator <- 80 KHz Figure 4.3: Four quadrant receiver Laser Launch Photo Detector FSK Four Modulator Quadrant Receiver Carier Enable Data out Carrier Detect Data in MCS-51 System Design Kit Figure 4.5: Receiver test system 4.9 . z \i£ n >H HI H & A Jiit pf „r t UK +> _JOOAf Ad HI H' ULT >-c J-HHl - H=5—IHI :H' =Hi D-C :>-HHl 3 8 ^-HHi 5i I rm T Hi // Figure 4.4: Receiver circuit outline 4.10 To demodulate the received signal the initial system used a NE565 phase locked loop set to capture in the range 78-82 KHz. The device has an input range of ImV to 3V pk-pk giving a dynamic range of 70db. The 565 had to be replaced as the decoder, however, due to pick up of the on chip lOV pk-pk VCO signal by the front end optical amplifier even when screened. The demodulator was therefore changed to one based on a XR2211 FSK demodulator chip, the modulator being a XR2207 with a low pass filter and power opamp to provide the drive to the piezo device. 4.1.2.1 Receiver Test Svstem The test system for the detector consisted of an SDK51 system design kit programmed to drive the FSK modulator, receive the output of the demodulator and log the data (Figure 4.6). The software for the system (Appendix 3.0) was designed to use the design kit monitor programme and an interface library SDKLIB.A51 was written to provide an interface between the control programme and the monitor allowing access to aU the keyboard and display drivers. The test routines themselves in FSKDRV.P51 performed five tests, four on demodulator timings, carrier lock, both high and low logic and logic transition timings. The fifth test was for data transmission which sent out data bytes and monitored the response for errors. Initial tests were performed on the FSK system with the optical component and its associated fading eliminated by feeding the attenuated modulator output directly into the receiver, the carrier frequencies used being restricted to the range 39-41KHz by the bandwidth of the ultrasonic devices. The delays introduced by the filters also limited the bit rate, 300 bits/sec being the highest that was within the response time of the receiver. Time Delay mS Carrier lock logic 1 3.60 Carrier lock logic 0 1.98 On/off delay 1.13 Off/on delay 0.54 Table 4.0: Maximum Delays Experienced In 2^^ Transmissions 4.11 At 300 bits/sec with a ImS carrier stabilisation delay the direct connection gave no errors in transmitted data over the available run time thereby exhibiting an error rate of better than 1 in 10^. Problems were, however, encountered with the receiver once the fibre was replaced in the link. The frequency doubling and filtering introduced differing phase delays into the four signal paths due to slight differences in the filter characteristics. These were not significant in the FSK system tests but with a fading signal the summing stage produced a distorted output which although better than the single detector receiver suffered fades in signal level which resulted in a loss of lock in the FSK decoder. The carrier was in fact too unstable to achieve reliable transmission for any period of time. 4.1.3 Optimisation of Depth of Modulation A series of experiments were then run to try and improve the fading of the received signal by optimising the detector position and the fibre type. The four quadrant detector was mounted on a micrometer adjustable linear translation stage (Figure 4.6) to allow the detector to fibre-end distance to be adjusted and therefore to alter the portion of the fibre output intercepted by the detector. For each fibre type used the dc detector output was measured and by using a hardcopy output oscilloscope the peak ac component was determined. For the multimode fibre (Figure 4.7) the experiment was performed in two runs with the amplifier gain reduced to avoid saturation at the shorter detector distances. The results of both runs were then combined by suitable scaling (Figure 4.8); for this particular fibre the maximum modulation depth was at a fibre detector distance of 8mm. At this separation the mode pattern speckle size is of the same order as the detector element. The procedure was then repeated for two other fibres, one with a cut-off at 750nm which results in only two modes propagating at 633nm [50] (Figure 4.9). The fibre is only just able to sustain two modes, the second mode being easily stripped by wrapping the fibre around a 1cm mandrel. The second fibre had a cut-off of 1450nm giving approximately 6 modes at the 633nm being used. (Figure 4.10). 4.12 Figure 4.6: Modulation depth apparatus Figure 4.7: Multimode fibre-mode pattern 4.13 Q_ 03 Q C o n CD T3 O O c o (D ^5 CO > > £ 0) _C a T3 "S. c O 0) O) Q cn o C < O 3 ~a o > "a c C) 01 (J Q Figure 4.8: Multimode fibre modulation depth 4.14 Figure 4.9: Two mode fibre mode pattern Figure 4.10: Six mode fibre mode pattern 4.15 For the 6 mode fibre the peak in modulation depth occurred at 6mm although the detected signal was fairly constant for spacings between 2 and 6 mm (Figure 4.11). For the 2 mode fibre the modulation depth reduced from that with 6 modes; at separations of less than 4 mm the signal was not detectable (Figure 4.12). The results of these tests indicate that there is an optimum number of propagating modes within a fibre that will maximise the received signal for a given drive power and to obtain the best response the fibre to detector distance also needs to be adjusted to bring the interference pattern spot size up to roughly the same order as the detector element dimensions. 4.2 Microbending Modulation As an alternative to the fibredyne modulation technique a microbending modulation system was devised using the same multimode fibre launch and detector as previously but in this case the fibre was clamped between the ultrasonic transducer and and a ridged plate. The pitch of the ridges was calculated from the known fibre parameters (Appendix 1.3) to maximise the induced mode coupling and therefore loss at 2 mm. The ultrasonic modulator was mounted on a second linear translation stage to allow adjustment of the fibre compression for maximum signal at the receiver. The resulting output for a range of drive powers (Figure 4.13) shows a linear increase in output with drive as in the phase modulation case. With the maximum 10 volts drive to the modulator the detected signal had a modulation depth of 14%; this is twice the maximum achieved in the phase modulation experiments and was a constant value, the signal not being subject to the random fades of the phase technique. These gains are however at the expense of only being suitable for use on uncabled fibre. 4.16 CL o ~o > O ^ a gc is ^ C (D O > _o 3 >OJ -a _aj o a Q Figiire 4.11: Six mode fibre modulation depth 4.17 LD in in hO CN| CM o d o d d CN Q. Q<0 oc CL 'u (U "O Q o c 2 o (D O 3 c •a o (D -2 OQ £ Q Ll- M o<0 c a > b to 43 L. -Q a c "Si O) 2 c In O > 43 43 O O Q -J 3 "O o > > (U a CN c o CT Q lo "D43 O 43 « Q m o m o LD CN CM Figure 4.12: Two mode fibre modulation depth 4.18 L_ O c 3 o "D c c O) (D 2 in _Q o Figure 4.13: Mocrobending modulator response 5.1 Chapter 5 Stochastic Approach In the fibredyne multidrop system the multiplexing of data from a number of modulators is achieved using frequency division multiplexing(FDM). The use of FDM requires that each modulator employs a different carrier frequency and that the detector filters out each of the utilised frequencies. The alternative is to use time division multiplexing(TDM) which allows the individual modulators to be identical and obviates the need for configuration dependent filtering at the expense of requiring some arbitration method or protocol. Since the system described here does not allow the transmission of data to the connected nodes the use of a two way protocol is precluded. Instead the method adopted uses the technique of allowing collisions of data to occur on the basis that they can be detected and the data can be subsequently ignored as invalid (Figure 5.0). It is immediately apparent that there must be some redundancy in the utilisation of the available channel bandwidth to accommodate the overheads of data validation (in the form of transmitted checkcodes) and the inevitable loss of colliding data packets. The stochastic bus consists of a number of independent stations that transmit over a common Unk. The error detection can be implemented in several ways; for example, the use of manchester encoding (in addition to allowing higher data rates, being a self clocking waveform) may be used to provide detection of collisions in the form of manchester violations. CRC checking of the received data can be employed to provide a further level of protection. A situation that must be avoided however is when two stations transmit at the same time then continue to do so indefinitely. In order to avoid this possible deadlock situation, in which no data from those stations would be received, the initiation of transmissions from the connected nodes, or outstations, is achieved on a random basis with each outstation maintaining a random number generator which determines the time intervals between transmissions. 5.2 Source Detector 12 3 N Continuous Fibre Multidrop Bus station 1 station 2 1 rwwxwwi Station N rxwwwwi [ Asynchronous Transmissions Figure 5.0; Stochastic bus 5.3 5.1 Theoretical performance Given the available bit rate, packet length, and the number of connected stations, the required system characteristics are those of bus utilisation, the optimisation of transmission rate to maximise the bus throughput and the likely delays between uncorrupted packets from individual stations. To simplify the derivation an ideal bus is assumed where signal propogation times can be ignored, collisions are the only data loss mechanism , and all faulty/colHded packets are detected and ignored. The randomly derived time intervals are arranged to have a uniform distribution between a minimum set by the stations physical implementation (CH6.1) and a maximum, ideally adapted to match the bus configuration. The average of the distribution is given by T = T - T . av max mm A collision occurs if any two data packets of duration L are commenced during a time interval 2L, the probability of which is given by P = 2VT^^ Given this figure the bus characteristics can be derived, by considering it as a problem in repeated trials [51], using the binomial function. The function only truly applies under conditions of sampling with replacement. In this case this is not strictly true as a slave, once transmmitdng, cannot start another transmission untD the first and its associated housekeeping is completed. The effect on this on the bus performance has however been found to be negligible. Using the binomial function the probability of only one outstation transmitting at any given time is given by P^d) = PN(1-P)N-1 where N is the number of outstations. Plotting P^(l) against P for systems involving various numbers of outstations (Figure 5.1) indicates an optimum value 5.4 to d c cVJ o o "D "a in in i/i o 00 d [] oc CO 00 w d cM c £ Q. o o 00 >- a a c (/) Q. (/I a _Oo CO CO J3 > O ro c 00 d _o 13 (O cn c V) Q_ (/J cVJ c10 C o _o u a a o CN oo in 00 d CM o _c o H— Ul c c o o a o in T~ U") c CL L CO in hO CN d d d d d Figure 5.1: Stochastic bus transmissions 5.5 of P that is a function of N. In general it can be shown that is maximised by the situation P = 1/N hence the optimum relationship between average transmission interval, packet length and number of stations is derived as Tav = 2LN Thus for a given packet length can be calculated to optimise system performance according to the number of connected stations. For large numbers of stations and correspondingly lower transmission probabilities the binomial function can be replaced by the poisson distribution [52] P(x) = e'" uVx! which with NP = 1 gives P(l) = e'^ = 0.3678 giving a theretical channel utilisation of 0.183 channel secs/sec, 1/e being the probability of only one station transmitting in an interval 2L. This figure for channel utilisation is the ALOHA computer communication system result [53] when retransmissions under that protocol are included in the bus traffic. For low numbers of stations however the discrete representation is the more accurate. The other system performance figure which is of importance is the likely delay between successful transmissions from individual stations. This is a direct function of the number of attempts required before success and can be represented by the geometric distribution PpCk) = (i.pp^-\ where P^ is probability of a successful transmission. This is only the case when the other N-1 stations are not transmitting a figure given by 5.6 (Af-1) i-^ T„ Using this value in the geometric distribution therefore gives the probability of needing k transmissions to succeed. The mean of the function is given by 1/ps and the mean delay between successful packets is therefore tmean = Tav/p^ This is plotted for various N and optimum P (Figure 5.2). The effect of using a non optimum P for a given number of stations is also illustrated (Figures 5.3 and 5.4) in terms of transmissions and time. In both cases increasing or reducing the transmission probability away from the optimum gives an increase in the mean delay between successful transmissions from a station. 5.2 Simulation In order to model the technique as closely as possible a simulator has been implemented in Pascal using the same random number system and slave transmission algorithm as the physical system. The simulation allows the predicted performance to be checked for numbers of stations not physically realisable in the laboratory as well as avoiding discrepancies due to noise or signal fading that would be present in a physical implementation. Several variants of the simulation software have been developed, the major difference between them being the data collected and its format in the output file, the latter to allow the results to be read into various graphics packages. All the programs, however, utilised the same simulation core. 5.7 c o a OQ 00 CI (/) (/) (D O c o o o (D a < tn if) C o a cn c o _a LTl CN Figure 5.2: Distribution of transmission attempts 5.8 m d 00 II CO X j2 £ 3 Figure 5.3: Non optimum attempt distribution 5.9 O m CN m d D II > O o X ^ (D tN qI ^ 1 ^6 o o X v> m (/I c q O o LO vs d L_. < — O L_ s II o o 3 o o O43 o 1/3 m c "O o X CJ cd o L_ Q_ II X CT ^ Ql £ eg % O 3 in "D J3 Figure 5.4: Non optimum time distribution 5.10 5.2.1 Simtilation Algoiithni The simulation program takes as input a file containing a list of parameters for each run of the algorithm, giving the number of stations, the packet length, minimum and maximum time delays and the simulation run time. Due to limitations in the number representation on the computer the maximum simulation time was limited to 10^ bit periods. Upon initialisation the program (Figure 5.5, Appendix 4.0) creates a data structure for each station on the bus and initialises a random number generator for that slave with the station's address. This avoids all the simulated slaves starting the pseudorandom number sequence at the same point and locking up the simulation. The individual slave's records are then assembled into a list in order of transmission time. The program removes the first station from the list, calculates if a collision would have occurred with the next or the previous station's transmission and calculates the next transmission interval for that station. The station is then replaced in the list at the appropriate time point and the process repeats until the requested simulation time is completed. This next event scheduling approach [54] simplifies the main routine to one procedure to compare the next two station records on the list and with few stations at low transmission probabilities is the fastest to execute. As the number of stations increases the program speed suffers from the linear search of the record list which when combined with high transmission probabilities results in the sorting of records in the list, increasing the execution time. A method of overcoming this problem would be to still use event scheduling but to scan the station list until a successful transmission was made and use that as the next event time rather than the next transmission. The output from the main simulation program (Figure 5.6) is a file containing a list of the input parameters, various calculated performance figures and the number of transmissions for each individual station. The modified versions of the program formatted the data without comments for input into graphing packages. 5.11 ( START ) Initialise Station List Remove Next Station NO YES CoUlsion 7 Log valid data. Log collision Log tine Calcu late Ne xt Tran. .mission Insert In station list No YES Output Results ( STOP) Figure 5.5: Simulation algorithm 5.12 Numter of slaves = 1 Average tim«out predicted as, 2775 Proo Transmission = 2.52E-02 _ , , Station %4:+03L°a!oOOOOo8:8a'l?r230E+o9"#! >03 isf:} mi Simulated time interval = 1.000002+07 SimuCated.average timeout = 2759 ?!^Si??i?i!?2lt!onWl°53E.OO Number of slaves = 2 5?§fa$^^i.23E.02 Maxdetay = 5.42E+03. Average timeout predicted_asi 2775 Proo Transmission = 2.52E-02 delay, 1""" ifer' ri! Totil ?SSt = 1.Q00QQE+07 SimulatecSimglated.averagl time interye timeoua t = Ratio.valid/sent = 9.45E-p. Capacity utilisation % = 4.77E+00 Number of slaves Pgcket length = 70 ^ Mindelay - Maxoelay Average timeout predicted-as, 2775 Prof•faa Transmission = 2.52E-02 telay. Maxde Station ii is::t % J:®S881:5 , „„„„„ Simulated time interval = 1.000QQE+07 Capacity utilisation % = 6.77E+00 Number of slaves = Pgcfeet length = 70 Mindelay = 1.23E+Q( Maxdelay = 5.42E+02 Average timeout predii 2775 Prob Transmission = Station Sent Maxde Is;:} ?S3S .1:1138885% Simulated time intecva = ,1.000g%%;07 Capacity uutilisatiot n % = 8. 59E+00 Number of slaves = PgcKet length = 70 Mindelay = 1. Maxdelay = 5. i:8 Average timeout predicted as 2775 Proo Transmission = 2.S2E-02 Station Sgnt ,Lost, elay Maxde mi Bi l+E+li Total Sent 1.8Q3nQQE+' Tgtal Tost .3.3$8uOOE+ Simulated time intecva = ,i.ooogy=+07 Capacity utilisation % = 1.02E+0 1 Numter of slaves = 10 S?55:f,;*?:'?.23E+02 70 Maxdelay = 5.42E+03. 2775 Average timeout predi Prob Transmission = elay Maxde Station iC I S?^ !atec^tim«^interva( '= 1.00000^07 Simulated.average timeout =_ 2777 g:^gif^l(!?S!tion#1]57E+01 Figure 5.6: Simulation program output 5.13 5.2.2 Random Number Generation There are numerous methods available for generating pseudo random numbers [55]; the algorithm chosen for use in both the simulation and in the actual slaves themselves is based on an algorithm used in a number of commercial simulation packages. The next random number U(t) is derived using the formula U(t) = U(t-1)*5^^ Mod 2^^ The resulting value can then be scaled into the range required by the given system configuration. To ensure both the simulation and physical realisation of the bus match the theoretical predictions, it is important that the number generator used approaches as closely as possible to an ideal uniform distribution. The above algorithm has a repeat length of 2^ and has been extensively tested [56] and found to satisfy most standard numerical tests. The main problem with implementing this algorithm on a small computer however is due to the value of the numbers exceeding standard variable sizes. In the pascal simulation this is overcome by using a base 128 number representation, the numbers being stored as the coefficients of powers of 128. This is easier to implement than writing a multibyte multiplication routine in assembler, as well as being more easily transportable, but slow (2.8 ms on an 8Mhz 80286 CPU machine). As a check on implementation a small program was written to use the algorithm and record the distribution. The runs are for a uniform distribution of 10000 numbers between 1 and 50 (Figure 5.7). As a further check on the algorithm and its implementation a chi-squared test was calculated on each of the runs, aU of which gave results between 10 and 90 % which is considered acceptable [57]. 5.14 Figure 5.7: Random number distributors 5.15 5.2.3 Simulation results The simulation was run for various combinations of station numbers and transmission time intervals to mimic as closely as possible the physical implementation allowing comparisons of theoretical, simulated and actual performance figures. There was however a slight discrepancy in that the simulation's smallest umt of time was a bit period while tunings in the real implementation were to 1/8 bit period. For the simulation the times from the physical implementation had to be rounded up to the nearest bit period. The main simulation nms were performed on a CPM80 machine and typically took 12-24 hours to complete a sequence of sunulations. The sunulation results correspond closely to those predicted by the theoretical model as can be seen in Figure 5.8. This shows the percentage utilisation of the available channel capacity for both the simulation and the model. The simulation in this case was for 10^ packets for each point. Figure 5.9 is the equivalent to the theoretical plot of Figure 5.1 of utilisation vs transmission probability and shows the peak in through put at pirobabilities that are the reciprocal of N. The simulation run for each point was in this case 10^ bit periods. As a verification of the model and sunulated results a chi^ goodness of fit test was carried out between several of the plots in Figures 5.1 and 5.9 and all values came out within the 10 and 90% limits. 5.16 CO CD O C ID O H— ^ GO C _o CO CD (f) CO 03 "5 7D O .i Zr 0} o f] 03 E D — ^ 8 z 03 _o '-+—' CD i_ O CD co H m 00 3 6Q bQ 6Q 6Q o lO O lO O lO o CO OJ CM Figure 5.8: Theoretical vs simulated utilisation 5.17 in d tf) M c c g o "5 "5 U~i o CO d c C] o 'co (D in O in M c c c o o E D "o (/] "a £ ui (/i C K) 03 O O Jo3 ^ t: oc Q_ lA if) <0 3 "O CD _a d o o o (J 3 a a (/I to E CM U3 o 'ui _c o o CO c c c o o o 0 o a VJ (/J CO f— m in 3 QQ O LD O LTJ LO K) CN CN Figure 5.9; Simulated utilisation 6.1 Chapter 6: RS485 Implementation In order to allow a comparison of the predicted performance with a hardware implementation whilst avoiding the complexities of the optical system, a network has been constructed using RS485[58] differential line drivers on twisted pair. This approach allows the isolation of the data errors due to the inherent fading in the fibredyne signal from that due to packet collisions to be quantified. The network consists of a number of slave stations linked to a single receiver card which plugs into an IBM AT compatible computer (Figure 6.0). Transmissions on the system consist of 64 bit manchester encoded data packets at a data rate of 125 Kbits/sec. Each packet contains a flag byte, an address field, 32 bits of data and a I6bit CRC check sum (Figure 6.1). The data received by the interface is transferred to the host cpu after verification by the interface processor together with information on the number of detected invalid transmissions. The main reason for the use of RS485 is that the line drivers are contention protected and shut down if two devices are active on the bus simultaneously, contention between packets being inherent in the bus operation. 6.1 Slave Bus Stations The individual stations on the bus have been designed to be as simple as possible both for reasons of cost and the necessity of having to assemble several of them. Each station consists of a simple 8031 based computer, an address switch for station address input over the range 1-15 and an RS485 line driver (Figure 6.2). This leaves an unused 8 bit port for instrument operation. Four bits of this port were later used to interface a serial access A/D converter. The cost of minimising the hardware to this basic form was an increase in software complexity especially in terms of execution timings. The software for the system [A4.1] is based on a core module written in PLM51 [59] with assembler routines to perform the main functions of random timeout calculation, CRC generation and manchester encoded data transmission. The main program (Figure 6.3) consists of an infinite loop which, after initialisation performs 6.2 Interface RS485 nniBumir^ Monitor Computer RS485 8051 Data Computer Station 1 Station 2 Station n Figure 6.0: RS485 test system Flag Address Data ORG checksum Figure 6.1: Packet format 6.3 rO ^^%339 3SS%3 51 41 & i SH B H & A iili n u} CO 4> pO- h# wS2 9!n| | i e a\ HDh db ii i ci rt rf rt M w a — (umvuivor** ^2 3=2* <<<<<< 32 z;asssas% i; o fH s !3 wg Hi Figure 6.2: Slave bus station 6.4 the main instrument management tasks, in the initial versions this operation consisted of loading dummy data into the work buffers and calling the CRC polynomial calculation routine. In the final software this was replaced with the A/D converter driver routines. The manchester transmission routine has the tightest constraints on implementation as the waveform is generated using bit shifts and complements of the data field, the opcode execution times being used to provide the correct transmission waveform. For this reason the code is generated using macro expansions for each individual bit rather than subroutines which, due to their call and return overhead, reduce the achievable bit rate. The waveform generated by the procedure (Figure 6.4) consists of two manchester zero bits, a synch pulse and 8 bytes of manchester encoded data. The first six bytes of data are transmitted most significant byte first while the last two are transmitted least significant byte first. This is a requirement of the receiver decode and error detection logic outlined in 5.3.2. By careful ordering of the instructions within each bit transmission, so that data is accessed and stored in the time between signal edges, the bit transmission period was reduced to 8uS with a 12 Mhz processor clock corresponding to 125Kbits/Sec. The total packet duration is therefore 552uS excluding the RS485 Hne driver turn on and off delay which increases the total duration to 555uS. The random timeout routine is based on the same algorithm as that used in the simulation program and was again implemented using assembler with macro expansions rather than subroutine calls. In this case the aim was to reduce the total execution time to the minimum possible rather than meet critical timing constraints. The time it takes to calculate the new random number places a minimum value on the inter-packet timeout period as the calculation time is in effect added to the calculated delay. The routine has therefore been optimised for speed by not calculating higher product terms of the multibyte multiplication and by using bit shifts and masking for the modulo 2 ^ 35 division. The final execution time for the procedure RANDOM was 360uS to which must be added the interrupt routine service code and the time required to reload and restart the timer which increases this time to 427uS. It is important to note that if the interpacket timeout period is made as short as possible then the main instrument operation will be effectively 6.5 START Initialise Random Calculate Time-out Delay Delay^ Expired Transmit Packet Figure 6.3: Slave station algorithm 8uS L_ Driver Enable / Zero Zero Sync IDat a Transnitt data waveform Figure 6.4: Slave transmission timings 6.6 halted as the processor will be continually in the interrupt service routines. Without a considerable increase in software complexity the maximum programmable delay between transmissions is fixed at 65.535 mS by the 16 bit on chip timers. The calculation of the CRC polynomial could have been implemented in the higher level PLM51 language of the main program as there are not the time penalties associated with the interrupt routine code. Assembler was still used however as it allows easier access to the carry bit and simplifies the implementation of the algorithm. The calculation is performed by implementing a 16 bit software shift register in bit addressable memory and utilising the boolean processing capabilities of the 8031 to calculate the feedback term before each shift. The execution time for this routine is not critical and was measured using the development system emulator rather than by calculation of opcode timings at 1309 uS. The initial slave stations filled the packet data field with dummy data (the station address) which was used in early testing as a check on data corruption. Once this was no longer required a serial access Analogue to Digital converter, a TLC1514, was interfaced to each slave processor together with a panel mounted potentiometer to allow the transmission of live data (Figure 6.5). In the demonstration software only one of the 10 possible 10 bit channels on the device was used. If 10 bits resolution is not required it would be possible to transmit four 8 bit values within each data field. The driver software for the device was implemented in PLM. 6.2 Bus Receiver The bus master (in common with the slaves) is based on an 8031 microcontroller with the tasks of manchester decoding, collision detection and verification performed by dedicated hardware (Figure 6.6). The microcontroller handles the tasks of buffering, error logging and data transfer to the host computer. As in the slave the software is interrupt driven, interrupt routines being coded in assembler, to minimise execution time. 6.7 Stochastic Station No 1 e Actke ^ Power O Stochastic Stafon No 2 1 Active Q PowerQ 1 Stochasfc Station No 4 | Aciv© Q [ Power O j Figure 6.5: Slave stations 6.8 0 a L 1 0) Y U -P L o "Sac in oj c 0; 75 -br j: o L a3 3 u u C. C 01 I Q -adr aU a 1 a C3L 13 -p C 3 L — o dj L O CD "3 • Qi Xu 4-> CJ 01 -r ^ ^ !±; u Ul rJ Of 00 i_ u. u Q: L a ocu Q_ 3 L > Oi o, "o U L -LP CD -H c P O OI U "C 0 cu u u L §• 01 c5 O s_ n U1 L lE <4- (Uk1 "C L u c Oj o M OC C5 m L •P o a 0) U1 c 00 o T3 L. UL O CU •a U 4- U1 < (D 4- 3 Q 3 cq II ui cq in 0) U OJ U L d -H "O 4- in 13 L cJ C Qj C JZ C5 L uCU u • U o L. Oi Z CL C5 -p cO ) (X 4- < 4- CL <4- Z L U (/) L W c3q Qi cq 0/ CL 0_ -cP cq Figure 6.6: Stochastic bus interface controller 6.9 6.2.1 Inteiface hardware The signal from the RS485 line receiver is decoded by a dedicated manchester decoder chip that looks for a valid synch pattern in the input waveform. When a valid MIL-STD1553 synch is detected the decoder generates a NR2 data signal, a synchronous clock waveform and a status signal /NVM ( Non Valid Manchester). The decoder bit rate is set at 1/32 the crystal frequency, to provide maximum jitter margin, at 125 Kbits/Sec. The decoded clock signal is gated with /NVM and used to increment a bit counter, the CRC shift register and a monostable pulse generator. The monostable pulse clocks the NRZ data into a serial in parallel out 32 byte FIFO. /NVM and the bit counter overflow signal are themselves gated and drive an interrupt pin on the microcontroller when /NVM goes low before 64 bits of data have been received. If 64 bits of data have been decoded without error then a valid data interrupt is generated (Figure 6.7). The CRC checksum calculation is performed by a 16 bit shift register with feedback which is reset by the processor before the start of each new data packet (Figure 6.8). The outputs of the 16 register locations are combined to give a single CRC error signal on a port pin. It is the difference between the CRC checksum hardware, which operates least significant bit first, and the serial to parallel FIFO, which operates most significant bit first, that requires the data transmission direction to be reversed in the slave manchester generation routine. Communication between the microcontroller (Figure 6.9) and the IBM compatible computer is via a second 32 byte FIFO, this time in parallel in parallel out mode, and an eight bit latch. The interface is built onto a prototyping board mapped into the lO address space $300 to $31F (Figure 6.10) [A4.2]. Minimal address decoding is used on the board and for reads of the card the FIFO is mapped to $300, shadowed to $30F, while the latch is mapped to $310 shadowed to $31F. Neither the FIFO or latch are bi-directional and a write to any address within the card's address space results in a reset pulse to the controller from a second monostable. The latch acts as a status register for the interface with bits representing the FIFO flag and output ready signals together with an overflow bit set by the control processor if the 2k byte on card buffer overruns. The latch also acts to synchronise 6.10 X — aUfalBI « Figure 6.7: Manchester receiver 6.11 So a Figure 6.8: CRC checksum verifier 6.12 —< a\ COidiQ M . m V in ikjDS i >u ss&sisssz psp- \0(Ui n ( * If r~. CS CSC5 O C3 a> C 3 Ct CO B c 5« s = L o- KSEs! SaS25S2S < --ftJC*>'*»-t/^sDhvCO % — (vJifdcu culftjlftjculaj w SSggSSSo LJCC << < "«c C8O r Q T u JfflEfflZ Figure 6.9: Interface logic and microcontroller 6.13 the control card to the main computer bus cycle and prevents status signals changing while they are being accessed, the microcontroller running, at 12 Mhz, asynchronously to both the manchester receiver and the host computer. 6.2.2 Interface Software The PLM interface control program [A4.3] utilises three interrupt routines in operation (Figure 6.11). A timeout interrupt is used to trigger the generation of status information at one second intervals. Information on the number of CRC errors and manchester code violations is then transferred to the host computer in the form of a received bus data packet but with an address field of zero. If 64 valid bits are received the resulting interrupt routine checks the overrun and CRC status bit and clears the bit counter if set. If the 64 received bits are vaHd the FIFO is read into a temporary buffer and the CRC checker and counter are cleared. This enables valid reception of a new packet while the current one is transferred to the 2K byte cyclic buffer for eventual transfer to the host. Manchester data violations before 64 bits are received reset the CRC checker and bit counter and the corresponding interrupt routine flushes the input FIFO and logs the error. By changing the priorities of the interrupt routines it is possible for errors to occur and be serviced while the valid data interrupt routine is still processing the last received data. There is a critical timing constraint here since, in order to avoid the loss of a valid packet, the interrupt routine must clear the serial input FIFO before another packet can generate an error interrupt. At 125 Kbits/Sec this timing constraint is 24uS, equivalent to the manchester synch period. The bus interface/host communication is all via the read only latch and FIFO, data being transferred in 6 byte packets (the CRC check bytes are stripped of by the interface control program) consisting of the flag, address and data fields of the received data packets or the internally generated status information. If the host does not read the received data from the interface at sufficient speed the resulting interface buffer overflow is detected and the interface microcontroller disables all further reception, setting the overflow status bit in the interface status latch. Recovery from this situation is only possible by writing to the interface and thereby forcing a complete interface reset. This hard reset requirement was included to avoid the situation of the bus recovering from overflow when unattended and the event being missed. 6.14 mmm Figure 6.10: Bus interface 6.15 C start 1 Reset interface HW cstar t 3 Enable Interrupts Flush Serial input FIFO of data L Second Tineout N Clear bit counter & oendlna nterruot Data n Maift Buffer Generate Status [ncrenent counter Data Packet of manchestpr errors Transfer to iBM Transfer to IBM Fira FIFO cRetur n J Main Program Error Interrupt ) c 1 Reload Tiner overrun or CRC error V Reset bit counter Rush serial FCFO I second elapsed N Transfer data to Internal RAM Clear bit counter loendno nterruot Swap Interrupt Toggle Indicator LED Priorities mcrenent CRC error counter Set timeout Bit Main Buffer Full Set overflow flog & LED Indicator Return Transfer data to Main Buffer Disable receiver cRetur n J Tlner Interrupt Valid Interrupt Figure 6.11: Interface control software 6.16 6.2.3 Host Software The host software, written in turbo pascal V3.0, is based on a core procedure which continually polls the bus interface status register until valid data is indicated by the flag bit (Figure 6.12). The received data is the read out in the 6 byte packets and the appropriate station or status information updated. The software exists in two versions, a basic data logger [A4.4] which records the total number of errors and valid transmissions over a specified time, and an enhanced configuration which displays the last received data from each configured slave (Figure 6.13). The use of polling to access the interface is a development of the initial system which used the Flag signal from the Interface FIFO to interrupt drive the program. The control program in this form was subject to crash during long runs especially at high packet rates and as polling is sufficiently fast the interrupt approach was dropped. 6.3.3 System performance Initial tests on the interface were performed using only a single station programmed to transmit with the minimum possible delay between transmissions. This maximised the packet throughput on the bus allowing reasonable numbers of packets to be checked for CRC checksum errors, manchester encoding errors and corrupted data. To enable the detection of missed packets, the station software was modified to toggle a port bit at the end of the transmission; this was used to trigger a counter the value of which was compared with that at the receiver. In addition a logic analyser was set to capture CRC check sum errors, by triggering on the combination of valid data interrupt and invalid CRC checker output. The initial system suffered from a packet error rate of the order of 1 in 10^ which was eventually traced to the manchester decoder locking on to the wrong edge of the manchester signal. To prevent this the two manchester zero bits were added to the packet at transmission before the three bit period synch waveform. This allows the decoder phase locked loop to lock to the input signal and has reduced the error rate to the extent where the time needed to record an error makes accurate figures difficult to obtain. The results obtained in several overnight runs are summarised in table 6.0. In separate runs of the system no packets were detected as missed entirely by the receiver 6.17 start ^ •pen Result File Input Run Parameters ^eset all variables Display Header Reset Enterface cRea d Interface J Rrad Interface Status Data Avaiable Buffer Empty Update Status DIsolav Read Next Packet Update Runtime Loa & •ISDlav station Data Availablc-^N Update Status Record Qlid Address &Flag Update Station Field Y Data Update Station Record Update Invalid Update Log Fie Count Update Flagfault Close Log File Count d^^HZ) nterface Overflowed Set overflow Flag Figure 6.12: Interface host control program 6.18 fie lat lUt occuDDces total = 2.1748488808E+05 itvalid= 0.88B88088B0E+0B i manerr = 4.4673880B88E+04 crcerr = 1.7360880888E+84 Figure 6.13: Bus Host display Packets Invalid Manchester CRC errors Flag Faults errors 28024668 0 0 0 0 28024661 0 3 0 0 28024284 0 0 0 0 28024418 0 0 0 0 28024263 0 0 0 0 28023860 0 1 1 0 Table 6.0: Single Station Error Rates 6.19 When additional stations were installed on the bus and packet collisions occurred the interface was found to have an additional problem, packets occasionally being received shifted one bit to the left. This was traced to a timing problem between the clock from the manchester decoder chip and the monostable pulse generator to the serial to parallel FIFO the cure being to gate the clock signal with /NVM from the decoder chip. As a secondary precaution the packet address field was reduced from 16 to 8 bits the first byte being set to $7E, the HDLC flag byte, which provides a means of identifying all shifts in data of up to 7 bits. The host program was then modified to count corrupt first bytes as flag faults. 6.4 Multistation performance Once the interface was functioning correctly with a single station three other units were constructed to allow the multistation performance to be determined. The required maximum time-outs were calculated using the known minimum transmission time due to the station implementation and the required transmission probabilities. The bus was run overnight with between one and four stations for probabilities in the range 0.1 to 0.5 each. The results (Figure 6.14) confirm those obtained in the simulated system. The host system recorded no flag faults or invalid station faults in all the runs all errors being picked up by the CRC and manchester violation checks. 6.20 to CN CN| CO to CO M r "T" c o