A microprocessor based device for traffic investigation

A microprocessor based device for traffic investigation

© EUROMICRO EUROMICROJournal6 (1980) 304-307 A Microprocessor Based Device for Traffic Investigation Giovanni Marola Marco Schiaffino Istituto di E...

277KB Sizes 1 Downloads 43 Views

© EUROMICRO EUROMICROJournal6 (1980) 304-307

A Microprocessor Based Device for Traffic Investigation Giovanni Marola

Marco Schiaffino

Istituto di Elettronica e Telecommunicazioni, Facolta' di Ingegneria Universita' di Pisa, Via Diotisalvi 2, 1-56100 Pisa, Italy

Istituto di Scienze dell' Informazione, Facolta' di Scienze M.F.N. Universita' di Pisa, Italy

This paper presents an 8-bit microprocessor based measurement equipment allowing acquisition, pre-elaboration and recording of numerical data collected near a motorway bridge for traffic investigation. The realisation of such a device was necessary to carry out the research proposed by the ECSC (European Coal and Steel Community) for a standardization. This research, developed parallel in the countries of the ECSC, has been committed to the Istituto di Scienza delle Costruzioni of the University of Pisa (Italy). For this research, we have executed the following operations: 1. the identification of vehicles heavier than some fixed weight (motor lorries); 2. The measurement of velocity and time interval (distance) between two successive vehicles.

I.

INTRODUCTION

two vehicles in order to determine the t r a f f i c density. A strain-gauge weighting device is placed between the wire I o o p # l and#2 as shown in f l g . l . When a vehicle passes on i t , voltage signals proportional to the weight of each axle are generated. The maximum voltage values converted in d i g i t a l form are collected together with the data about vehicle speed and distance between two vehicles.

Our work has been developed in two subsequent stages. During the f i r s t stage data processing and storage are carried out; in the second stage data are transmitted to a central computer f o r f i n a l data processing. The data c o l l e c t i n g equipment includes transducers and sensors placed under the road surface, the microprocessor preprocessing device, as well as a tape recorder f o r d i g i t a l data sequence recording. The preprocessing device performs the f o l l o w i n g functions: a) measurement of the distance between vehicles b) measurement of vehicle speed c) measurement of the weight of the vehicle axles. The data are placed in serial form, registered on a magnetic tape and transmitted to the central computer in order to obtain the required s t a t i s t i c a l data and the histograms. 2.

3.

DATA PREPROCESSINGAND TRANSMISSION DEVICE

The data preprocessing and transmission device consists of three parts. The f i r s t part is the section f o r the t r a f f i c i n v e s t i g a t i o n and i t consists of a series of binary counters. They r e g i s t e r both the number of clock pulses between the s t a r t and the stop signals for speed measurement and the number of the clock pulses between two successive s t a r t signals f o r distance measurement. The second part consists

DESCRIPTIONOF MEASUREMENTEQUIPIIENT; DATA ACQUISITION DEVICE

As i l l u s t r a t e d in f i g . I , two rectangular wire loops placed under the road surface at a distance of three meters one from the other are used. A 50kHz a l t e r n a t i v e current flows through the loops whose inductance varies in connection with the metal mass of the vehicle in t r a n s i t . Such changes are detected and amplified by a proper c i r c u i t . The generated e l e c t r i c signals in form of pulses act as s t a r t and stop signals f o r the determination of the vehicle speed. The i n t e r v a l between two successive s t a r t pulses is used to evaluate the distance between

MOTOR-WAY DETECTORS

MICROPROCESSOR BASED

31m~ -

PREPROCESSLNG DEVICE

t

Fig. 1. Block Diagram of the Data Acquisition Device. 304

G. Marola and M. Schiaffino of a high speed analog to d i g i t a l converter which converts the analogic signals corresponding to the weight in 8 - b i t d i g i t a l data. The t h i r d part carries out the coordination and the d i r e c t i o n of the operations by means of a microprocessor, under the control of s u i t a b l e programs. 4.

305

is s i m i l a r , except that i t is activated by each s t a r t pulse. Read and reset pulses are generated by two monostable m u l t i v i b r a t o r s MMI and MM2 r e s pec t iv ely . The conversion of the weighting device data is carried out by an analog to d i g i t a l converter triggered by pulses whose frequency f3 can be varied according to the c h a r a c t e r i s t i c s of the t r a f f i c .

WEIGHT DATA CONVERSION 5.

The lo g i c c i r c u i t f o r the measurement of a vehicle speed and of the distance between two successive vehicles is shown in f i g . 2 . The start and stop signals are conveniently amplified and then applied to comparators. Each comparator threshold level is prefixed according to the amplitude of the noise present in the signal. The leading edge of the s t a r t signal is used to t r i g g e r a l l the counters and a b i s t a b l e m u l t i v i b r a t o r (FFI). Such a m u l t i v i b r a t o r is reset by the t r a i l i n g edge of the stop signal. The generated rectangular signal opens f o r the t r a n s i t time of a l o r r y the gate GI, so the pulses at freouency f l can be counted. At the end of such time i n t e r v a l the binary data stored in the counters are sent to the Input Port n . l , whose outputs are connected to the databus of the COSMAC microprocessor which reads and process them. As to the counting f or the distance the process

INTERRUPTREQUESTSHANDLING

As shown in f i g . 3 the i n t e r r u p t requests coming from several Input Ports are sent through an OR gate to the microprocessor i n t e r r u p t input with the so called i n t e r r u p t single l i n e technique I2]. At the same time i n t e r r u p t requests are sent to the input flags EFI,EF2,EF3 [31 allowing the Central Processing Unit to recognize the i n t e r r u p t i n g Input Port. I f the active device is the A/D converter,the CPU transfers data in i t s working registers and selects by proper routine the maximum values. These data are stored in the microcomputer RAM togheter with the corresponding data of v e l o c i t y and distance. Then, arranged in blocks, they are transferred to the recorder . In order to recognize, during the successive reading, the v e l o c i t y and distance data, two bytes equal to 0000 and FFFF respectively , are preponed. We note that there are as many

RESET

h START

BINARY COUNTI IBINARYCOUNT]

I

r-] LL J,NT+' /

I

INPUT PORT n. 2

e,N+

I--..,+ •

INPUT PORT n 1

I

.+

INPUT PORT n 3

e,N. OOUN+ WB'N OOU.T I +16



+16

3

f2 f3

INPUT PORT n4 PULSES

DATA+

END CONV.

Fig. 2. Block Diagram of Data Pre-Elaboration Device: Section Relevant to the Calculation of Speed and Distance f o r the D i g i t a l Conversion of Weigth Signals.

306

A Microprocessor Based Device f o r T r a f f i c

DISTANCE COUNTERS 16 bit

I

SPEED COUNTER

EF31

INTi

I

I

A/D

CONVERTER

8 bit

PORT n.1

INPUT PORT n. 2 e 3

EF1 EF2:I

Investigation

]

8bt

A

PORT n. 4

>

DATA BUS MICROCOMPUTER UART

COSMAC

I

I

t

DIGITAL RECORDER

Fig. 3. Block Diagram o f the Linking Among the Microcomputer, the Data A c q u i s i t i o n System and the D i g i t a l Recorder.

maximum values in the axles o f the l o r r y . 6.

block

as

the

loaded

DATA STORAGE AND READING

The asynchronous r e c e i v i n g - t r a n s m i t t i n g unit (UART) c o n t r o l s the s e r i a l r e c o r d i n g o f RAM d a t a , coded in ASCII f o r m a t , in the magnetic r e c o r d e r . RAM reading method is based on the use of two p o i n t e r s : the f i r s t one address the storage of data sent from the measurement d e v i c e , and the second one c o n t r o l s the reading of them. Then the microcomputer c a r r i e s on the RAM r e a d i n g , each time i n c r e a s i n g the reading pointer until i t s value equals the w r i t i n g pointer. 7.

FREQUENCIES USED TO CARRY OUT MEASUREMENTS

The microprocessor clock frequency fo i s 2 MHz. By means of a d i v i d e r c h a i n , we have got the f r e q u e n c i e s needed to perform the measurements. Such f r e q u e n c i e s are: f l = frequency used f o r speed measurement f2 = frequency used f o r d i s t a n c e measurement f3 = frequency used f o r s t r a i n - g a u g e data conversion As to frequency f l , l e t us consider the following relationship: tmax = s/vmin where: s = d i s t a n c e between the loops vmin = minimum speed of the v e h i c l e s tmax = maximum time i n t e r v a l e s t a b i l i s h e d f o r the speed e v a l u a t i o n

Since one byte i s reserved f o r tmax, the needed c l o c k frequency f l , is given by: " f l = 256/tmax = 256/s.vmin (Hz) The minimum speed is to be f i x e d in r e l a t i o n to the road slope and to the traffic characteristics. In our particular case, choosen f o r vmin = 5 Km/h, we have f l = 118 Hz. Thus we have used the value 128 Hz, o b t a i n a b l e by the c l o c k frequency. Since f o r the d i s t a n c e measurement two Input Ports are needed which s t o r e two b y t e s , i t f o l l o w s t h a t : f2 = 65,536/tmax (Hz) In our case we put the maximum time between two successive v e h i c l e s equal to I0 minutes. Thus the frequency r e s u l t s : f2 = 65,536/600 = 109.2 (Hz) Hence we have used the frequency f2 = 128 Hz. I f we now a t t e m p t to find the maximum conversion frequency f 3 , we must take i n t o account t h a t during the corresponding p e r i o d T3 the f o l l o w i n g o p e r a t i o n s are to be performed: - a) the conversion of one a n a l o g i c value - b) the execution of the i n t e r r u p t routine t h a t reads the converted item of d a t a , compares i t w i t h the previous data in o r d e r to f i n d the maximum value and then stores it in the a u x i l i a r y RAM. - c) the v e r i f i c a t i o n of the UART s t a t u s , t h a t i s CPU before sending a new item check i f UART has f i n i s h e d to t r a n s m i t the previous d a t a . Therefore the sampling frequency f3 i s given by: f3 = I / ( T c + Ti + Tvu) where: Tc i s the conversion time

G. Marola and M. Schiaffino Ti is the time f o r the i n t e r r u p t routine execution Tvu is the time to check the UART status In the case in which UART is ready to transmit the new item of data, the above described cycle of operations is changed. During the time normally used to check UART, a single data is transferred from the memory to the UART (time Ttmu). This can be obtained in subsequent stages by u t i l i z i n g the time normally spent only f o r the UART check. Such a method is possible as i t d o e s not i n t e r f e r e with the a c q u i s i t i o n and the recording of the maximum values during the time Ti. In our case the i n t e r r u p t routine execution requires 52 CPU i n s t r u c t i o n s that is Ti = 416 microsec. To check the UART status 3 instruction are needed, then we have Tvu = 24 microsec. This leads to f3max = 2,173 (Hz). As t h i s value results higher than that we have experimentally found s a t i s f a c t o r y fo r the weight s i g n a l reconstruction, we used a near ten times smaller frequency s i g n a l , that is f3 = 256

(Hz). CONCLUSIDNS This paper describes a measuring equipment by which the preprocessing and storage of data relevant to a motorway t r a f f i c i n v e s t i g a t i o n was made. i t is shown how the use of the microprocessor allows, by means o f the i n t e l l i g e n c e i t brings to the system, the a c q u i s i t i o n of useful data only; i t is therefore possible to store a l l the necessary information with a conventional digital cassette recorder. Attention has been devoted to the c a l c u l a t i o n of the more s u i t a b l e values of the reference frequencies f o r the evaluation of the speed and o f the distance between two vehicles and f o r the conversion frequency, Such values avoid to overcharge the processing sections. The method we have developed is v a l i d f o r a l l cases in which the a c q u i s i t i o n of a l o t of data f o r s t a t i s t i c a l purposes is required. In f a c t t h i s a p p l i c a t i o n points out that the use of a microcomputer can remarkably

simplify the study of phenomena which presents significant characteristics only in particular time intervals, even i f they take place during a long time period. ACKNOWLEDGEMENTS We are grateful to G. Prati f o r paper revision and to R. Cerrai and C. Morini f o r the help in the construction of the device and measurements.

REFERENCES [i]L.

Sanpaolesi, S. Caramelli, R. Del Corso,

307

A. F a v i l l i , Misure ed i n t e r p r e t a z i o n e dei carichi dinamici sui ponti. Ricerca P. 364/2. I s t i t u t o di Scienza delle Costruzioni. UniversitA di Pisa 1979. [2] C a v a l c o l i , Madaschi, S c i b i l i a , Principi Hardware e Software dei Sistemi a Microprocessore. Clup, Milano 1979. [3] User Manual f o r the CPD 1802 COSMACMicroprocessor, RCA Solid State D i v i s i o n , Sommerv i l l e , NY, 1976. Giovanni Marola was born in Vicenza, Italy, in 1940. He received the PhD degree in Electronic Engineering from Padua University in 1966. He has been with the faculty of Electronic Engineering at Pisa University since 1967 where he is currently Associate Professor of Industrial Electronics. His fields of interest are power electronics and microprocessor-based control systems. Marco Schia~fino was born in Livorno, Italy, in 1935. He received the PhD in Physics from Pisa University in 1959. From 1963 to 1970 he was Assistant Professor with the Department of Electronics and Telecommunications of the Italian Naval Academy in Livorno. He is currently Professor of Digital Electronics in the Institute of Information Science of Pisa University. His research interests include satellite communications, active filters and microprocessor applications.