© Paul E. Bennett. 1994, 1998
® All rights reserved Paul E. Bennett 1994, 1998
No liability whatsoever is accepted by Paul E. Bennett for any errors or omission in the presented material as published in Forthwrite, the newsletter of the Forth Interest Group (UK) or on the Forth Interest Group Websites.


Reading the World (1)

by Paul E. Bennett

PROLOGUE

There have been numerous requests for more hardware based articles. In answering this need, I have taken a look at what would likely be of interest to the membership. We all tend to agree that Forth is very good in control applications. Control deals with the real world issues and hence the titles for the series of articles seemed to just suggest themselves.

You are not going to be able to get stuck into that control project you have always wanted to do straight from this first article. Please be a little patient. By the end of the series you will have a useful tool collection which may stand you in good stead when you have to deal with those real world issues. At the very least it should help the more software inclined appreciate some of what the hardware types are talking about.

INTRODUCTION

The “Real World” is a very complex and difficult place to deal with. Well, as far as computers are concerned anyway. When computers need to read the “Real World” they have to do it through a variety of analogue and digital inputs to capture any of a rich mixture of observable parameters that vary in level, rate, frequency and clumpiness. Despite the variety of observable parameters the computer has to manage the observations through a very limited number of interfaces. This is aided by the inventiveness of people who can identify the physics of making the observations and turning them into electrical stimuli.

Scope

This article “Reading the World” deals with control system inputs and the important considerations of making them resilient against the nastier effects of observing real world events. We are not talking of some resurgent terrorist activity or the latest horrific disaster but the outcomes can seem every bit as disastrous to the systems engineer. Hence we are going to spend some time in this article on protection of the input circuitry and the most important, and often expensive, part; the processor chip. Damage sustained by system components can be the least of your worries especially if the system was in control of a safety critical process. Lawsuits could easily cost a lot more than the failing hardware or software.

TAMING THE DRAGON

This first part of protecting your computing investment when reading the inputs is to ensure that you understand and deal with the energy levels that will arise from the high transients that are part of the “Real World” that need to be filtered out. I am going to take each type of input in turn and discuss the protective networks required to ensure that the circuitry can survive. In doing this you are also a long way down the road to “designing for compliance” to the European Directives and many equipment standards for industrial grade systems. The only difference may just be the level of protection. It is quite often the case that providing protection for one disruptive aspect may also provide protection from another. On the other hand, it may also degrade the other protective measures and a balance needs to be struck.

The Disruptive Influences.

There are lots of phenomena in the real world that can cause damage to electronic systems. They are usually very large sources of energy (but can also be very large energy sinks) which must be managed to provide the protection required.

The main sources are:-

For the above I am going to take my example data from the Railway Industry Association (RIA) standards. This is an environment I am very familiar with and is representative of harsh industrial environments generally. Equipment designed for such standards will take almost anything that can be thrown at them (preferably within the limits specified).

I am deliberately not going to cover the non-electrical disruptive influences as these are down, mostly, to the equipment housing. I will just mention that these influences are:-

Transients

The following information on Transients is taken from RIA 12 “General Specification for Protection of Traction and Rolling Stock Electronic Equipment from Transients and Surges in DC Control Systems.”

 

Wave Form

Type of Disturbance

Voltage Level U (Tol ±3%)

Duration td1 (Maximum)

Duration td2 (Tol ±20%)

Series Resistor Rs (Tol ±10%)

C

Direct Transient

960 V

10 ms

100 ms

5 R

D

1800 V

5 ms

150 ms

5 R

E

3600 V

0.5 ms

5 ms

100 R

F

4800 V

0.1 ms

1 ms

100 R

G

8400 V

0.05 ms

0.1 ms

100 R

H

Indirect Coupled Transient

1800 V

5 ms

50 ms

100 R

J

3600 V

0.5 ms

5 ms

100 R

K

4800 V

0.5 ms

1 ms

100 R

L

8400 V

0.05 ms

0.1 ms

100 R

Surges

The following information on Supply Surges is taken from RIA 12 “General Specification for Protection of Traction and Rolling Stock Electronic Equipment from Transients and Surges in DC Control Systems”. The table below relates to the trapezoidal voltage test where td1 is the slope time (0.1U to 0.9U) and td2 is the retention time (between 0.9U points on up and down ramps).

Wave Form

Type of Disturbance

Voltage Level U (Minimum)

Duration td1 (Maximum)

Duration td2 (Minimum)

Series Resistor Rs (Tol ±10%)

A

Supply Related Surge

3.5 x Vc

2.0 ms

20 ms

0.2 R

B

1.5 Vc

0.1 s

1.0 s

0.2 R

Radio Frequency Energy

Control equipment has to continue to function correctly in the presence of Radio Frequency Energy with field strengths up to 20V/metre in the bands 0.15mhz to 1.2ghz. This includes carrier wave only and keyed transmission of such fields.

THE HARDWARE

In the remaining space for this issue I am only going to provide a look at one of the inputs (perhaps the most common one). Other inputs and outputs will follow in subsequent issues.

The main principle that I work with in developing a system relies on a boxes within boxes approach. The boxes do not necessarily have to be enclosure partitions although that does help on occasions.

Digital Input

The digital input is used for detecting the state of switches, relays and voltage sources that present either of two logical states. Digital states are either ON or OFF. However, the “Real World” manages to add noise or uncertainty to these two states and hence this noise requires filtering to eliminate its effect. A fully filtered digital input is shown in Figure 1 which minimises the ravages of the “Real World”. The input circuit also needs to draw a definite current. This (wetting) current should be enough to overcome contact resistance caused by the build up of oxides on the switch or relay contacts.

Digital Input Filter Schematic

Figure 1 Digital Input Filtering

The input terminals A and B can pick up high energy transients on the connecting wiring. Our first barrier (or box wall) are the resistors R1 and R2. These are in place to limit the power in any affecting transients. They need to be high power resistors to handle the transients energies (see the RIA12 table). C1 is a means of slowing the rise time of the signal and the reducing the radio frequency interference. R3 and R4 are to prevent the build up of static electricity in the input circuit by providing a definite, although high impedance, path to ground.

D1 is a Transorb and acts as a voltage clamping device for the input circuit. This device is capable of conducting very high currents, very rapidly, when the voltage across its terminals rises beyond its threshold voltage. The threshold voltage of D1 is selected to be slightly larger than the normal input signal voltage. D2 to D5 inclusive forms a bridge rectifier circuit. By including this in the circuit, it will not matter which way round the input signal is connected.

The zener diode D6, and resistors R5 and R6 network form a potential divider and current limiter for the optoisolator (OP1) LED. The threshold voltage for D6 is selected to ensure that the input voltage at terminals A and B reaches at least 50% signal swing before the output changes state. Optoisolator OP1 provides galvanic isolation between the input circuitry and the processor which is signaled by the transistor and R7.

Following this circuit, a simple tri-stated inverting schmitt buffer and addressing logic would be the minimum required to get the input signal on the processor bus.

THE SOFTWARE

Having dealt with the hardware, we can look at the software. The input is just one bit but the processor will read several in parallel from each address (depending on the width of the data bus. Reading inputs is as easy as reading memory locations, however, inputs are read only and the result of the read is dependent on external influence.

Example

Port

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

If we connected a Limit Switch for High Fluid Level to bit 2 of a port at address 080h we would read the input by:-

HEX
080 CONSTANT PORT
4 CONSTANT HIGH-FLUID
: CHECK-FLUID (S -- flag )
PORT @ \ read the port
HIGH-FLUID AND \ extract bit of interest.
;

With a set of inputs, selecting the bit is simply selecting the right number with which to AND the input word.

If you were having to ensure that inputs you read from a switch were likely to be correct when read, then wiring an opposite sense contact to a second input in the same bit position in a second word would enable a simple logic check to be made of the switch complement. In this next example, by ensuring that complementary inputs are the adjacent address we can grab a group of inputs, check complements then present validated data.

Port

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

Port+1

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

HEX
080 CONSTANT PORT
4 CONSTANT HIGH-FLUID

: CHECK-FLUID (S -- flag )
PORT 2@ \ fetch inputs from port and port+1
TUCK XOR AND \ save data of interest and check complements
HIGH-FLUID AND \ extract bit of interest.
;

Using complementary input sensing will protect against wire drop-off, contact short circuits or sneak supply feeds. It, naturally, takes a little more logic than that given above and some control over some of the circuitry.

SUMMARY

In this article I have explained the environment that control equipment has to contend with and given a few examples of the sort of levels of disturbance that an electronic systems engineer will have to be mindful of when designing such equipment. The examples given were from an industry where electrical disturbances are common-place (London Underground DC supplies to trains and RailTrack third rails and 25kV overhead supplies). There are a few tougher environments but then that becomes a more specialised area of system design.

I have also covered a couple of instances on reading a digital input, including one in which the software completes the integrity checking. I have not included component values with the circuit diagrams deliberately. These can be calculated from basic electrical and electronic formulae which are to be found in a wide range of books on the subject. Two useful books are in the Babani series.

The philosophy adopted for the series is based on keeping things simple with a well defined purpose for each part of the system.

Next Issue:-

In the next issue I shall describe the development of